pyproject.toml中的2个阵列

发布于 2025-02-01 11:51:14 字数 377 浏览 4 评论 0原文

我正在对pyproject.toml文件进行镜头,我陷入了这个简单的任务。考虑以下可选依赖性:

[project.optional-dependencies]
style = ["black", "codespell", "isort", "flake8"]
test = ["pytest", "pytest-cov"]
all = ["black", "codespell", "isort", "flake8", "pytest", "pytest-cov"]

是否有一种方法可以避免在all键中复制/粘贴所有可选dep?至少有一种方法可以做all = style + test

I'm giving a shot to the pyproject.toml file, and I'm stuck on this simple task. Consider the following optional dependencies:

[project.optional-dependencies]
style = ["black", "codespell", "isort", "flake8"]
test = ["pytest", "pytest-cov"]
all = ["black", "codespell", "isort", "flake8", "pytest", "pytest-cov"]

Is there a way to avoid copy/pasting all the optional-dep in the all key? Is there a way to do all = style + test at least?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘初心 2025-02-08 11:51:14

但是,有一种棘手的方法可以在Python包装中取决于您自己:

[project.optional-dependencies]
style = ["black", "codespell", "isort", "flake8"]
test = ["pytest", "pytest-cov"]
all = ["myproject[style]", "myproject[test]"]

source

循环依赖性是python包装明确设计的功能,因此可以继续起作用。

There is no such feature directly in the toml markup.

However, there is a tricky way to do this in Python packaging by depending on yourself:

[project.optional-dependencies]
style = ["black", "codespell", "isort", "flake8"]
test = ["pytest", "pytest-cov"]
all = ["myproject[style]", "myproject[test]"]

Source:

Circular dependency is a feature that Python packaging is explicitly designed to allow, so it works and should continue to work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文