Is there a way to process dependency links automatically when installing a package with extras, without having to call --process-dependency-links
as it is the case with install_requires
?
pip install -e .[extra] --process-dependency-links
I need this because the dependency is only located on a private git repo.
Is it possible to install extras using python setup.py install
?
Is --process-dependency-links
still to be considered as it is deprecated? I am not sure about the status here.
I searched way too long to figure out how to do this with setup.cfg so hopefully this will help someone else if they don't want to use setup.py as the OP didn't specify. I've also included a custom URL for install_requires as that took a while to figure out as well.
#setup.cfg (only showing relevant parts)
[options]
install_requires =
pyyaml @ git+https://github.com/yaml/pyyaml.git@master
[options.extras_require]
jsonschema = jsonschema @ git+https://github.com/Julian/[email protected]
six = six
pip install -e .[jsonschema]
will get you the extra with a custom URL or pip install -e .[jsonschema,six]
will get you both extras (note that there are NO spaces after the .
or around the comma(s) in the extras list).python setup.py install
.--process-dependency-links
is still deprecated in spite of much complaining but the above is good enough once you know the syntax.--process-dependency-links
if you use extras_require
.Tested with pip version 19.3.1
Example:
$ pip install -e .[graphs]
# setup.py
from setuptools import setup
setup(
name='myservice',
version='0.1.0',
install_requires=[
'requests',
],
extras_require={
'graphs': [
'graphcommons @ git+ssh://[email protected]/graphcommons/graphcommons-python@master',
],
},
)
By using ssh protocol (instead of https) to access git repo, you can install from your private repos.
Not sure about python setup.py install
but pip install .[extras]
should be good enough?
Yes, in pip version 19.
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