Jeremy Jeremy -4 years ago 276
Python Question

Using an extra python package index url with setup.py

Is there a way to use an extra python package index (ala

pip --extra-index-url pypi.example.org mypackage
) with
setup.py
so that running
python setup.py install
can find the packages hosted on
pypi.example.org
?

Answer Source

If you're the package maintainer, and you want to host one or more dependencies for your package somewhere other than PyPi, you can use the dependency_links option of setuptools in your distribution's setup.py file. This allows you to provide an explicit location where your package can be located.

For example:

from setuptools import setup

setup(
    name='somepackage',
    install_requires=[
        'somedep'
    ],
    dependency_links=[
        'https://pypi.example.org/pypi/somedep/'
    ]
    # ...
)

If you host your own index server, you'll need to provide links to the pages containing the actual download links for each egg, not the page listing all of the packages (e.g. https://pypi.example.org/pypi/somedep/, not https://pypi.example.org/)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download