(obviously whatever poetry/pdm/uv are already doing is going to be more well thought out than my example solution, but for example…)
I dont see why this would imply a pyproject.toml necessarily, so long as the information about the set of groups/extras is included in the lockfile. Record the groups at the top level of the file (generalizing across dependency groups and extras, which should be the same as far as installation goes), and then record a groups: ["foo", "bar"]
per dependency that belongs to those groups (if that dependency is not already required outside groups).
An installer with no concept of this feature, like you mention, is simply the same as a no-extras scenario, i.e. install only dependencies with no groups. An installer with the ability to select for extras/groups, given some set of groups (maybe check that the groups are valid and…) would install a dependency if at least one dependency’s groups
matches the groups provided.
It doesn’t seem obvious to me how this concept is any different than any of the static environmental markers. Some python_version==3.9
in the lockfile is really just the same thing as if someone supplied a python39
extra, as far as the comparative installation behavior goes…beyond the fact that python_version
involves math and applies to transitive dependencies, whereas extras/groups do neither.
If nothing else, I feel like it should be explicit in the PEP about how/why extras/groups are not important, or how they can be punted and backwards compatibly standardized later