I am developing a python library which depends on package A
from PyPI and B
from another index. How do I specify the dependencies, given B
is already listed in PyPI?
Asked
Active
Viewed 2,855 times
1

soslan
- 78
- 1
- 7
-
The meta info in a python package regarding dependencies does not include info on how to get it, that'ss part of the deployment process. Can you pre-install `B` with `--index-url` pointing to the alternative index before installing your library? – Arne Sep 16 '19 at 11:27
-
@Arne my library is supposed to be a dependency itself, so it should be installed automatically. – soslan Sep 18 '19 at 08:10
-
Then maybe this answer can help https://stackoverflow.com/a/13587734/962190 – Arne Sep 18 '19 at 08:32
1 Answers
0
With setuptools
you can specify dependency_links
as an argument to the call to setuptools.setup
in your setup.py
script. See the setuptools documentation on "Dependencies that aren’t in PyPI".
This won't work well when installing with pip
though. There's currently no good way to enforce this on the users of your package and for good reason. Instead you will have to document your package well enough in order to instruct the users of your package to install it with the correct pip
options: --index-url
, --extra-index-url
, or --find-links
.
Untested: For the comfort of the users of your package you could provide a constraints.txt
file summing up the previously mentioned pip
options.