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

[FR] Lock entry for foo[bar,qux]: tell which deps come from bar vs. qux #2638

Open
jvolkman opened this issue Feb 19, 2024 · 1 comment
Open
Labels
⭐ enhancement Improvements for existing features

Comments

@jvolkman
Copy link

I'm using PDM's resolver in rules_pycross by way of parsing its lock files. Recently I've been working on adding support for extra dependencies. My plan is to model something like foo[bar,qux] as three packages: foo, foo[bar], and foo[qux], with the latter two depending on foo plus whatever other optional dependencies.

This is almost how PDM structures its lock files, with one exception: foo[bar,qux] is modeled as a single package depending on foo and the union of optional dependencies from bar and qux, but there's no way to tell which optional dependencies are contributed by which group.

One way I've thought of to fix this is to add another layer to the dependency graph: foo[bar,qux] would depend only on foo[bar] and foo[qux] and nothing else, and the single-extra packages would each list their own dependencies plus the dependency on foo.

Another way would be to keep the current structure, but to include an extra marker with each dependency in foo[bar,qux] that says which one provides it.

I like the first approach best: it seems straightforward and has some nice deduplicative properties: if foo[bar], foo[qux], and foo[bar,qux] are all present in the locked set, currently the dependencies for bar and qux would be listed twice, but with the first approach each would be listed only one.

If this sounds reasonable, I'd be willing to work on a PR.

@jvolkman jvolkman added the ⭐ enhancement Improvements for existing features label Feb 19, 2024
@frostming
Copy link
Collaborator

The second way makes more sense to me, but you need to make sure the extra markers will be evaluated correctly when traversing the lock entries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

No branches or pull requests

2 participants