我使用pip-tools来管理我的依赖项和环境,它完美地为我的包生成了一个requirements.txt文件,该文件由如下所示的setup.py组成:
#! /usr/bin/env python
import os
from setuptools import setup
if "CI_COMMIT_TAG" in os.environ:
VERSION = os.environ["CI_COMMIT_TAG"]
else:
VERSION = "0.0.0"
setup(version=VERSION)和一个像这样的setup.cfg:
...
[options]
python_requires = >=3.7
zip_safe = False
packages = find:
include_package_data = True
install_requires =
PyYAML
Cython
numpy==1.17.5
pandas==0.25.3
...
package_dir=
foo=bar
[options.extras_require]
testing =
tox>=3.1.2
pytest>=3.4.0
coverage =
coverage
pytest-cov>=2.5.1
other =
anybadge
...运行$ pip-compile --index-url https://foo@bar@gitlab.my.host/api/v4/projects/236/packages/pypi/simple --no-header --allow-unsafe会产生我的包要求:
...
async-timeout==3.0.1
# via aiohttp
attrs==21.2.0
# via aiohttp
bcrypt==3.2.0
...但这只包括来自我的setup.cfg文件的install_requires部分的所有包,而不包括来自extras_require的需求。它应该使用here中描述的dev_requirements.in文件,但我宁愿只使用一个配置文件。
如何使用pip-compile从setup.cfg文件的此extras_require部分创建单独的dev_requirements.txt,而不必创建dev_requirements.in文件?
提前感谢!
发布于 2021-08-09 13:52:09
挖掘了一段时间后,我在另一个issue中找到了答案
$ pip-compile --extra testing --extra other
https://stackoverflow.com/questions/68712892
复制相似问题