gpt4 book ai didi

installation - setup.py/setup.cfg 安装所有附加功能

转载 作者:行者123 更新时间:2023-12-04 13:14:29 32 4
gpt4 key购买 nike

我在 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

我希望通过运行来安装所有附加组件

pip install PACKAGE[all]

最佳答案

我相信 setuptools 使用 configparser's BasicInterpolation在解析 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

构建 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

引用:

关于installation - setup.py/setup.cfg 安装所有附加功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61609869/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com