Search code examples
pythonpipsetuptoolssetup.py

Dependency links for extras_require in setup.py


  1. 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.

  2. Is it possible to install extras using python setup.py install?

  3. Is --process-dependency-links still to be considered as it is deprecated? I am not sure about the status here.


Solution

    1. Yes, you no longer need --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.

    1. Not sure about python setup.py install but pip install .[extras] should be good enough?

    2. Yes, in pip version 19.