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

Add an initial implementation of PEP 735 Dependency Groups #24

Merged
merged 3 commits into from
Oct 13, 2024

Conversation

sirosen
Copy link
Contributor

@sirosen sirosen commented Oct 13, 2024

resolves #23

This initial implementation takes the form of

  • treating the dependency-groups table as a Map<String, Vec<DependencyGroupSpecifier>>
  • defining DependencyGroupSpecifier as a string or an include

There are a couple of points I'm not certain about. Although I would be amenable to changing these, I might have to defer to someone more expert, as my Rust is pretty weak.

I don't know if it's satisfactory for the table to be defined as a type alias? It seemed like the best fit, but I'm not sure if there's a better way of doing this.

This is within the SHOULD/MAY bounds of the spec, in that tools are allowed to load and validate all of the data eagerly, but the spec also explicitly prefers lazy validation of the table contents.
There are a few ways I thought it might be possible to tackle this (e.g., add a branch to the DependencyGroupSpecifier enum for a Map<String, toml::Value>), but ultimately it feels like a good fit for Python and a poor fit for Rust.
Eagerly validating the content just seems to me like the most language-appropriate behavior.

@konstin konstin added the enhancement New feature or request label Oct 13, 2024
@konstin
Copy link
Member

konstin commented Oct 13, 2024

Thank you! Looks good, i chose to switch the dependency groups from a type alias to newtype struct pattern, this allows us to add methods such as getting a dep group with resolved includes on it in the future.

@konstin konstin merged commit d630f04 into PyO3:main Oct 13, 2024
5 checks passed
@sirosen sirosen deleted the add-dependency-groups branch October 13, 2024 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for dependency groups
2 participants