setuptools 30.3.0引入了声明性包配置,允许我们将大多数用于直接传递给setuptools.setup
文件中setup.cfg
的选项。例如,给出以下setup.cfg:
[metadata]
name = hello-world
description = Example of hello world
[options]
zip_safe = False
packages =
hello_world
install_requires =
examples
example1
仅包含
的setup.py.import setuptools
setuptools.setup()
将做所有正确的事情。
但是,我还没有找到extras_require
的正确语法。在setup
args中,它是一个字典,如
setup(extras_require={'test': ['faker', 'pytest']})
但我无法找出在setup.cfg中使用的正确语法。我尝试阅读文档,但我无法找到setuptools对字典的正确语法。我也尝试了一些猜测
[options]
extras_require =
test=faker,pytest
失败了。
Traceback (most recent call last):
File "./setup.py", line 15, in <module>
'pylint',
File "/lib/site-packages/setuptools/__init__.py", line 128, in setup
_install_setup_requires(attrs)
File "/lib/site-packages/setuptools/__init__.py", line 121, in _install_setup_requires
dist.parse_config_files(ignore_option_errors=True)
File "/lib/python3.6/site-packages/setuptools/dist.py", line 495, in parse_config_files
self._finalize_requires()
File "/lib/python3.6/site-packages/setuptools/dist.py", line 419, in _finalize_requires
for extra in self.extras_require.keys():
AttributeError: 'str' object has no attribute 'keys'
阅读代码,我并非100%确定支持此代码,但基于PEP 508,这似乎应该是受支持的用例。我错过了什么?