Skip to content
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

Improve static metadata extraction for Poetry projects #4182

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Summary

Adds handling for a few cases to improve interoperability with Poetry:

  • If the project schema is invalid, we now raise a hard error, rather than treating the metadata as dynamic and then falling back to the build backend. This could cause problems, I'm not sure. It's stricter than before.
  • If the project contains tool.poetry but omits project.dependencies, we now treat it as dynamic. We could go even further and treat any Poetry project as dynamic, but then we'd be ignoring user-declared dependencies, which is also confusing.

Closes #4142.

@charliermarsh charliermarsh added the error messages Messaging when something goes wrong label Jun 10, 2024
Comment on lines +215 to +217
// If dependencies are declared with Poetry, and `project.dependencies` is omitted, treat
// the dependencies as dynamic. The inclusion of a `project` table without defining
// `project.dependencies` is almost certainly an error.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should warn, that's a spec violation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a spec violation in Poetry, right? What the user wrote is totally fine.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging for now but will follow-up based on your reply.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should warn because using poetry <2 and [project] together without setting dynamic has unintended consequences, either on their own is technically compliant

@charliermarsh charliermarsh merged commit 125a4b2 into main Jun 10, 2024
46 checks passed
@charliermarsh charliermarsh deleted the charlie/err branch June 10, 2024 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error messages Messaging when something goes wrong
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv lock should not treat non-compliant pyproject.toml fields as dynamic
2 participants