请问python的新"点子轮"具有兴建车轮在tests_requires列出的依赖任何支持?

Atl*_*s1j 10 python pip setuptools python-wheel

我使用setuptools'tests_require'来指定测试我的包所需的依赖项.

tests_require - http://pythonhosted.org/distribute/setuptools.html#new-and-changed-setup-keywords
Run Code Online (Sandbox Code Playgroud)

我已经开始使用滚轮包装了

http://wheel.readthedocs.org/en/latest/
Run Code Online (Sandbox Code Playgroud)

并为我当前的包及其所有依赖项构建wheel的目录.

pip wheel --wheel-dir=/tmp/wheelhouse .
Run Code Online (Sandbox Code Playgroud)

不过,我想也建立车轮在任何软件包tests_require列出的所有软件包.

显然,我可以在重复的test_requirements.txt文件中明确指定需求:

pip wheel --wheel-dir=/mnt/wheelhouse -r test-requirements.txt
Run Code Online (Sandbox Code Playgroud)

但后来我在测试需求文件和tests_require列表中复制了依赖项.我可以将测试需求文件读入tests_require,但这似乎是滥用需求文件,据我所知,这些文件旨在让用户能够控制指定已知可以协同工作的软件包的环境.

Requirements files - http://www.pip-installer.org/en/latest/cookbook.html
Run Code Online (Sandbox Code Playgroud)

Ale*_*nor 2

不,没有明确支持这一点。最简单的方法是将 an 添加extra到 setup.py 中:

setup(
    extras_require={
        "test": ["pytest", "your other requirements"],
    },
)
Run Code Online (Sandbox Code Playgroud)

你当然可以重复使用与listfor相同的东西test_requires,然后你就可以pip wheel .[test]并且它将为所有这些制造轮子。