Dan*_*off 3 installation setuptools setup.py
我在 setup.cfg 中寻找“继承”其他附加功能的可能性,如下所示:
[options.extras_require]
all =
<doc>
<dev>
<test>
doc =
sphinx
dev =
dvc
twine # for publishing
<test>
test =
flake8
pytest
pytest-cov
coverage
pytest-shutil
pytest-virtualenv
pytest-fixture-config
pytest-xdist
Run Code Online (Sandbox Code Playgroud)
我希望通过运行来安装所有附加功能
pip install PACKAGE[all]
Run Code Online (Sandbox Code Playgroud)
我相信setuptools在解析文件时使用configparser
'sBasicInterpolation
setup.cfg
。因此,您可以利用这一点来执行以下操作:
[options.extras_require]
all =
%(doc)s
%(dev)s
%(test)s
doc =
sphinx
dev =
dvc
twine # for publishing
%(test)s
test =
flake8
pytest
pytest-cov
coverage
pytest-shutil
pytest-virtualenv
pytest-fixture-config
pytest-xdist
Run Code Online (Sandbox Code Playgroud)
构建sdist
然后查看*.egg-info/requires.txt
项目的文件以获取结果。由于test
被包含在all
两次中,一次是直接的,一次是通过 间接的,所以dev
在 中会有一些重复all
,但很可能这不是什么大问题。
理论上应该适用于所有构建后端和前端的另一个解决方案是“自依赖”:
[options.extras_require]
all =
PROJECT[doc]
PROJECT[dev]
PROJECT[test]
doc =
sphinx
dev =
dvc
twine # for publishing
PROJECT[test]
test =
flake8
pytest
pytest-cov
coverage
pytest-shutil
pytest-virtualenv
pytest-fixture-config
pytest-xdist
Run Code Online (Sandbox Code Playgroud)
参考:
归档时间: |
|
查看次数: |
1038 次 |
最近记录: |