In post_setup.py, the if _name_ = '_main_': statement allows you to manually launch post-install from command line. Dependencies The dependencies of your package can be specified in the installrequires section of the options: options installrequires pandas 1.4.1 PyYAML > 6. ![]() With the common idea of launching setup.py from its directory, you will be able to import post_setup.py else it will launch an empty function. Setuptools has a nice set of options that we can add. The setup script is the centre of all activity in building, distributing, and installing modules using the Distutils. In setup.py: from re import setupįrom _data import install_dataįrom post_setup import main as post_install post_setup.py will contain a function which does the post-install and setup.py will only import and launch it at the appropriate time. Read this discussion if you are wondering why there is none.Ī solution could be to include a post_setup.py in setup.py's directory. there are no any pre-install entry points available on setuptools. """Pre-installation for installation mode.""" ![]() """Pre-installation for development mode."""Ĭheck_call("apt-get install this-package".split()) You can even call shell commands during installation, like in this example which does pre-installation preparation: from setuptools import setup ![]() """Post-installation for installation mode."""Īnd insert cmdclass argument to setup() function in setup.py: setup( # PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION ![]() """Post-installation for development mode.""" You will make a few additions to setup.py and there is no need for an extra file.Īlso you need to consider two different post-installations one for development/editable mode and the other one for install mode.Īdd these two classes that includes your post-install script to setup.py: from setuptools import setupįrom import developįrom import install It will not work when installing from a binary wheel (. Note: The solution below only works when installing a source distribution zip or tarball, or installing in editable mode from a source tree.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |