Add warning when dependencies are empty with Poetry metadata#1650
Add warning when dependencies are empty with Poetry metadata#1650charliermarsh merged 6 commits intoastral-sh:mainfrom
Conversation
| if pyproject_toml.build_system.is_some_and(|build_system| { | ||
| build_system | ||
| .requires | ||
| .iter() | ||
| .any(|v| v.name.as_dist_info_name().starts_with("poetry")) | ||
| }) { | ||
| warn_user!("uv does not currently support the Poetry-style pyproject.toml (Your requirements.txt would be empty)"); | ||
| } |
There was a problem hiding this comment.
Could we move this down and make it conditional on requirements being empty? It's possible that they've added a dependency section we can read even if they're using Poetry.
We have a similar warning for requirements.txt files
uv/crates/requirements-txt/src/lib.rs
Lines 317 to 322 in 2ea44d8
Maybe we can phrase it the same with a hint that we can't read Poetry's dependencies?
There was a problem hiding this comment.
(Is it possible to make this conditional on whether tool.poetry.dependencies is populated? I assume not, since we don't include that in TOML schema. If so, this is totally fine.)
There was a problem hiding this comment.
@zanieb Thank you for your suggestion. I updated my PR and also fixed a test case. Let me know if I miss anything!
@charliermarsh Thank you for your comment. Are you planning to support the poetry-style format? If so, and no one is working on it, I'm interested in contributing.
9b7e524 to
d071555
Compare
poetry dependencies found.| .iter() | ||
| .any(|v| v.name.as_dist_info_name().starts_with("poetry")) | ||
| }) { | ||
| warn_user!("`{}` does not contain any dependencies (hint: Poetry's format is not supported for now)", path.normalized_display()); |
There was a problem hiding this comment.
Maybe this should be more specific, e.g. hint: specify dependencies in project.dependencies section, tool.poetry.dependencies is not currently supported. I can imagine users taking "Poetry's format" to mean all kinds of things, like literally the use of pyproject.toml
Good feedback from: #1650 (comment)
Resolve #1630
PyProjectTomldoesn't seem to have atoolfield, so instead of checking it, I check ifrequirementsis empty.uv/crates/uv-build/src/lib.rs
Lines 176 to 184 in c04f597