我正在尝试使用PEP 426中指定的:test:
和pip
来实施特殊setuptools
个附加内容。
我创建了以下setup.py
:
#!/usr/bin/env python3
from setuptools import setup
setup(
name='spam',
version='0.0.0',
tests_require=['requests'])
正在运行./setup.py bdist_wheel
给我一个包含以下metadata.json
:
{
"name": "spam",
"test_requires": [
{
"requires": [
"requests"
]
}
],
"extensions": {
"python.details": {
"document_names": {
"description": "DESCRIPTION.rst"
}
}
},
"summary": "UNKNOWN",
"generator": "bdist_wheel (0.24.0)",
"version": "0.0.0",
"metadata_version": "2.0"
}
我希望能够通过指定额外的test_requires
来安装:test:
。但是,这会得到以下输出:
$ pip install spam-0.0.0-cp34-cp34m-linux_x86_64.whl\[:test:\]
Exception:
Traceback (most recent call last):
File "/tmp/5221/lib/python3.4/site-packages/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/tmp/5221/lib/python3.4/site-packages/pip/commands/install.py", line 305, in run
name, None, isolated=options.isolated_mode,
File "/tmp/5221/lib/python3.4/site-packages/pip/req/req_install.py", line 179, in from_line
isolated=isolated)
File "/tmp/5221/lib/python3.4/site-packages/pip/req/req_install.py", line 52, in __init__
req = pkg_resources.Requirement.parse(req)
File "/tmp/5221/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2873, in parse
reqs = list(parse_requirements(s))
File "/tmp/5221/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2816, in parse_requirements
DISTRO, CBRACKET, line, p, (1,), "'extra' name"
File "/tmp/5221/lib/python3.4/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2785, in scan_list
raise ValueError(msg, line, "at", line[p:])
ValueError: ("Expected 'extra' name in", 'spam-0.0.0-cp34-cp34m-linux_x86_64.whl[:test:]', 'at', ':test:]')
尝试使用pip install -e .\[:test:\]
无论我使用的是Python 2.7还是3.4。我使用最新的virtualenv做了所有事情(pip == 6.0.6
,setuptools == 12.0.4
,wheel == 0.24.0
)
我做错了什么?