admin管理员组文章数量:1403468
I'm trying to let people on my project (including myself) migrate to uv
while maintaining compatibility with people who still want to use poetry
(including some of our builds). Now that poetry
2.0 has been released, and the more standard [project]
fields are supported, this should be possible.
It's working well in almost all ways, but the main glitch I'm hitting is the set of dev dependencies. uv
and the standard seem to want them as
[dependency-groups]
dev = [ "bandit ~= 1.8.3", ... ]
while poetry
seems to want them as
[tool.poetry.group.dev.dependencies]
bandit = "^1.8.3"
...
. Without including that section, the dev dependencies get left out of the lockfile when doing poetry lock
.
Anyone have any techniques for getting the two tools to play nicely in this situation?
I'm trying to let people on my project (including myself) migrate to uv
while maintaining compatibility with people who still want to use poetry
(including some of our builds). Now that poetry
2.0 has been released, and the more standard [project]
fields are supported, this should be possible.
It's working well in almost all ways, but the main glitch I'm hitting is the set of dev dependencies. uv
and the standard seem to want them as
[dependency-groups]
dev = [ "bandit ~= 1.8.3", ... ]
while poetry
seems to want them as
[tool.poetry.group.dev.dependencies]
bandit = "^1.8.3"
...
. Without including that section, the dev dependencies get left out of the lockfile when doing poetry lock
.
Anyone have any techniques for getting the two tools to play nicely in this situation?
Share Improve this question asked Mar 20 at 16:40 Ken WilliamsKen Williams 24.1k12 gold badges97 silver badges153 bronze badges 2 |1 Answer
Reset to default 4Until poetry
adds support for PEP-735, you can (ab)use the project.optional-dependencies
to achieve something similar:
[project.optional-dependencies]
dev = ["bandit ~= 1.8.3"]
Since this is a standard table, it can be used by both poetry and uv:
$ poetry sync --extras dev
$ poetry sync --all-extras
$ uv sync --extra dev
$ uv sync --all--extras
The caveat here is that, as the name implies, these optional dependencies are still part of the project metadata and as such they'll be part of the published metadata on PyPI and users will be able to install them with $tool install foobar[dev]
.
本文标签: pythonUse a single pyprojecttoml for 39poetry39 amp 39uv39 dev dependenciesStack Overflow
版权声明:本文标题:python - Use a single pyproject.toml for 'poetry' & 'uv': dev dependencies - Stack Overf 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744395311a2604187.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
uv
orpoetry
- then these two sections might deviate. Maybe one can write a script to take the most updated version? – Gwang-Jin Kim Commented Mar 21 at 11:36[dependency-groups]
as well. – finswimmer Commented Mar 25 at 20:16