Installation setup.py/setup.cfg安装所有附加组件

Installation setup.py/setup.cfg安装所有附加组件,installation,setuptools,setup.py,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

我在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
我相信setuptools在解析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文件以获得结果。由于测试包含在所有两次中,一次是直接的,一次是通过dev间接的,所以会有一些重复,但很可能不会有太大的问题

[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