将依赖项添加到 [tool.poetry.extras]
我需要将依赖项添加到我的软件包的额外依赖项中,而不是我依赖的软件包。
但是到处都可以描述如何通过其附加功能将软件包添加到我的依赖项中(例如文档或 )
[tool.poetry]
name = "my_project"
[tool.poetry.dependencies]
python = ">=3.8"
PyYAML = {version = "^6.0", optional = true}
matplotlib = {version = "^3.5.1", optional = true}
[tool.poetry.extras]
my_extras = ["PyYAML"]
以前我只是手动编辑pyproject.toml
,但是现在,这些额外的套件被传播到poetry.lock.lock
,因此,如果我这样做它只是在pyproject.toml
中,我从诗歌
获得警告,即我的锁定文件和pyproject文件未同步。 (当然,我可以同时编辑它们,但这是一种肮脏的方式)
将matplotlib
<代码> my_extras 添加的命令是什么?
I need to add dependencies to extra dependencies of my package, not packages that I depend on.
But everywhere it's described how to add package to my dependencies with their extras (e.g. documentation or this question)
My pyproject.toml
contents:
[tool.poetry]
name = "my_project"
[tool.poetry.dependencies]
python = ">=3.8"
PyYAML = {version = "^6.0", optional = true}
matplotlib = {version = "^3.5.1", optional = true}
[tool.poetry.extras]
my_extras = ["PyYAML"]
Previously I just manually edited pyproject.toml
, but now these bundles of extras are propagated to poetry.lock
, so if I do it just in pyproject.toml
I get warning from poetry
that my lock file and pyproject file are not synchronised. (Of course I can edit them simultaneously, but it's a dirty way)
What is the command to add matplotlib
to my_extras
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前没有命令可以将依赖项添加到额外的组中。您必须手动编辑
pyproject.toml
并随后运行poetry lock --no-update
。At the moment there is no command to add a dependency to an extra group. You have to manual edit the
pyproject.toml
and runpoetry lock --no-update
afterwards.