Is it possible to specify (editable) source dependencies in setup.py
that are known to reside on the local file system?
Consider the following directory structure, all of which lives in a single VCS repository:
projects utils setup.py ... app1 setup.py ... # app1 files depend on ../utils app2 setup.py ... # app2 files depend on ../utils
Given the following commands:
cd projects mkvirtualenv app1 pip install -e app1
I'd like to have all the dependencies for app1 installed, including "utils", which is an "editable" dependency. Likewise, if I did the same for app2.
I've tried playing with all different combinations of file://...
URLs in install_requires
and dependency_links
to no avail. I'd like to use a dependency link URL like src+file://../utils
, which would tell setuptools that the source for the package is on the file system at this relative path. Is there a way to do this?
To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
Follow the below steps to install the Setuptools package on Linux using the setup.py file: Step 1: Download the latest source package of Setuptools for Python3 from the website. Step 3: Go to the setuptools-60.5. 0 folder and enter the following command to install the package.
Type “ pip install setuptools ” (without quotes) in the command line and hit Enter again. This installs setuptools for your default Python installation. The previous command may not work if you have both Python versions 2 and 3 on your computer.
i managed to provide relative local dependency in setup.py with:
setup( install_requires=[ 'utils @ file://localhost/%s/../utils/' % os.getcwd().replace('\\', '/'), ], )
but maybe someone know better solution
I had an identical problem where I needed to depend on modules in a sibling folder. I was able to find a solution after stumbling upon https://caremad.io/2013/07/setup-vs-requirement/
I ended up requirements.txt to refer specifically to the file I wanted, and then installing everything with
pip install -r requirements.txt
requirements.txt
-e ../utils -e .
And setup.py has all my other dependencies, including utils. When pip tries to install app1 itself, it realizes that the utils dependency has already been filled, and so passes over it, while installing the other requirements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With