[FR] Lock entry for foo[bar,qux]
: tell which deps come from bar
vs. qux
#2638
Labels
⭐ enhancement
Improvements for existing features
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]
, andfoo[qux]
, with the latter two depending onfoo
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 onfoo
and the union of optional dependencies frombar
andqux
, 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 onfoo[bar]
andfoo[qux]
and nothing else, and the single-extra packages would each list their own dependencies plus the dependency onfoo
.Another way would be to keep the current structure, but to include an
extra
marker with each dependency infoo[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]
, andfoo[bar,qux]
are all present in the locked set, currently the dependencies forbar
andqux
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.
The text was updated successfully, but these errors were encountered: