-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add warning when dependencies are empty with Poetry metadata #1650
Conversation
crates/uv/src/requirements.rs
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
if data == Self::default() { | |
warn_user!( | |
"Requirements file {} does not contain any dependencies", | |
requirements_txt.as_ref().display() | |
); | |
} |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea: #1730
Good feedback from: #1650 (comment)
Resolve #1630
PyProjectToml
doesn't seem to have atool
field, so instead of checking it, I check ifrequirements
is empty.uv/crates/uv-build/src/lib.rs
Lines 176 to 184 in c04f597