[英]Nest or combine extras_require for setuptools in setup.cfg
Is it possible to re-use dependencies already specified in the [options.extras_require]
for other entries in the [options.extras_require]
?是否可以将 [options.extras_require] 中已指定的依赖项重新用于[options.extras_require]
[options.extras_require]
中的其他条目? Say, for example, a team of devs is using mypy
to check their type annotations during development, and black
to auto-format their code.例如,一个开发团队正在使用mypy
在开发过程中检查他们的类型注释,并使用black
来自动格式化他们的代码。 in this case, they would specify the [options.extras_require]
like:在这种情况下,他们会指定[options.extras_require]
像:
[options.extras_require]
dev = black, mypy
But now a testing environment is set-up, which also uses mypy
to check type hints, but doesn't need black
.但是现在设置了一个测试环境,它也使用mypy
来检查类型提示,但不需要black
。 So the config is extended to look like:因此配置扩展为如下所示:
[options.extras_require]
test = mypy
dev = black, mypy
Now any testing-dependency also needed for development is repeated for the development-dependencies.现在,对开发依赖项重复开发所需的任何测试依赖项。
Is there any way to avoid this by saying that dev
requires all in test
as well?有没有办法通过说dev
也需要 all in test
来避免这种情况?
You can make a reference to the extra package:您可以参考额外的 package:
[metadata]
name = foo
[options.extras_require]
test = mypy
dev = black; foo[test]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.