在pypi python setup.py中指定可选的依赖项

时间:2012-05-13 14:41:22

标签: python setup.py pypi

如何在python的setup.py

中指定可选的依赖项

这是我为我的开源库指定可选依赖项的尝试,但它似乎没有做太多。

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

此代码段中的extra_requires具体为:{/ p>

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='calvin@calvinx.com',
    install_requires=['cherrypy-wsgiserver'],
    extra_requires=['newrelic'],
    url='https://github.com/od-eon/django-cherrypy',
)

建议?

1 个答案:

答案 0 :(得分:31)

你的关键字不正确。它是extras_requireit's supposed to be a dict.

setup(
    name="django-cherrypy",
    ...
    extras_require = {
        'mysterious_feature_x':  ["newrelic"]
    }
)