I'm developing a package which has a few optional dependencies and 'extras'.
Goal: I want the following two things to work:
- Execute my post-install code
- Allow for 'extras' installation
Status: Currently I have been able to:
- Use - python setup.py installor- python setup.py developto execute post-install code; using the method here https://stackoverflow.com/a/36902139/8473819
- Use - pip install PACKAGE[extra]to properly install/manage extras or different package configurations.
In my research I have not found a feature of python setup.py to allow 'extras' nor a pip install feature to allow my post-install code to execute. *changed, see update
Notes:
Using pip 9.0.1, python 3.6
My post-install is simple, it just gets some information about available resources, creates a file, and prints some feedback using print().
Question: Have I missed some features, or is there not a way to cleanly accomplish both actions with just one of the install methods?
Update:
The pip install method does in fact execute my post-install code (prints are piped somewhere, only visible using -vvv arg). Another problem is that (unless installed with -e) it uses a temporary build directory like C:\Users\USER\AppData\Local\Temp\pip-ix4d6hv3-build then cleans it up, instead of building in the local directory. In this case, the my file creation either does not work, I have been unable to locate where the file is created, or it is cleaned up by pip (I tried --no-clean with same results).
Reference for others:
If installing from a local directory (not a tar/whl/etc. file), the package will be copied to a temporary directory see ^update^. Then a setuptools.command.egg_info subclass in setup.py will be executed before setuptools.command.install or setuptools.command.develop (passed in cmdclass arg).
