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

Read package metadata from pyproject.toml when statically defined #2676

Merged
merged 1 commit into from
Mar 27, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Now that we're resolving metadata more aggressively for local sources, it's worth doing this. We now pull metadata from the pyproject.toml directly if it's statically-defined.

Closes #2629.

@charliermarsh charliermarsh added the performance Potential performance improvement label Mar 26, 2024
@charliermarsh charliermarsh force-pushed the charlie/pyproject branch 4 times, most recently from c2fed4c to adeb3e7 Compare March 26, 2024 20:57
@charliermarsh charliermarsh marked this pull request as ready for review March 26, 2024 20:57
@@ -987,7 +986,7 @@ fn reinstall_build_system() -> Result<()> {

----- stderr -----
Resolved 8 packages in [TIME]
Downloaded 7 packages in [TIME]
Downloaded 8 packages in [TIME]
Copy link
Member Author

Choose a reason for hiding this comment

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

This is correct, because we no longer download flit-core during the resolution phase.

/// PEP 621 project metadata.
///
/// This is a subset of the full metadata specification, and only includes the fields that are
/// relevant for dependency resolution.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/// relevant for dependency resolution.
/// relevant for dependency resolution.
/// See <https://packaging.python.org/en/latest/specifications/pyproject-toml>.

Comment on lines +440 to +447
let s = r#"
[project]
name = "asdf"
"#;
let meta = Metadata23::parse_pyproject_toml(s);
assert!(matches!(meta, Err(Error::FieldNotFound("version"))));
Copy link
Member

Choose a reason for hiding this comment

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

That is even an invalid pyproject.toml ("The keys which are required but may be specified either statically or listed as dynamic are: version")

assert!(meta.provides_extras.is_empty());

let s = r#"
[project]
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure most users don't get that eliding the dependencies key means declaring that you have no deps, but that's the spec.

@charliermarsh charliermarsh merged commit 365c292 into main Mar 27, 2024
31 checks passed
@charliermarsh charliermarsh deleted the charlie/pyproject branch March 27, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Potential performance improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider reading pyproject.toml metadata directly
2 participants