Specifying optional dependencies in pypi python setup.py

Question:

How do I specify optional dependencies in python’s setup.py ?

Here’s my stab at specifying an optional dependency for an open source library of mine but it doesn’t seem to do much.

https://github.com/od-eon/django-cherrypy/blob/master/setup.py

Specifically extra_requires in this snippet:

setup(
    name='django-cherrypy',
    version='0.1',
    packages=packages,
    license='LICENSE',
    description='cherrypy, running under django',
    long_description=open('README.md').read(),
    author='Calvin Cheng',
    author_email='[email protected]',
    install_requires=['cherrypy-wsgiserver'],
    extra_requires=['newrelic'],
    url='https://github.com/od-eon/django-cherrypy',
)

Suggestions?

Asked By: Calvin Cheng

||

Answers:

You’ve got an incorrect keyword. It’s extras_require, and it’s supposed to be a dict.

setup(
    name="django-cherrypy",
    ...
    extras_require = {
        'mysterious_feature_x':  ["newrelic"]
    }
)
Answered By: voithos
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.