PEP 751: now with graphs!

No, but depending on the tool that’s what’s currently done (e.g., uv locks everything together so there’s consistency in the versions used).


As I have a lot going on in the real world (and it’s positive, but stressful), I’m going to be rather occupied for the rest of the month. As such, don’t expect me to chime in heavily until December (I will try to chime in as appropriate and stay up-to-date, though). But I did want to quickly say two things.

One, don’t worry about one lock file versus several. That’s a format detail that I think is driven by the use cases we choose to solve.

Two, I think we have to lines of thought about what the purpose of lock files are. One is locking for a specific scenario; historically this is what requirements.txt files did. The other is locking for any and all scenarios; Poetry and uv have done this by locking for all optional dependencies and dependency groups at once. Both are valid use cases, but they do lead to different design choices.

To use an example, a pyproject.toml has a couple of potential inputs into a lock file. Imagine you have:

[project]
name = "proj"
...
dependencies = [...]

[project.optional-dependencies]
ex = [...]

[dependency-groups]
dep-grp = [...]

The possible combinations here are:

  1. proj
  2. proj[ex] (although you could skip installing proj in this case if you wanted to)
  3. dep-grp
  4. proj + dep-grp
  5. proj[ex] + dep-grp

The “lock for the scenario” folks would say if you need a lock file for all of those combinations, then it’s 5 lock files, but it might be less as you may only have e.g. 2 scenarios you care about and the lock file is simpler. The “lock for all scenarios” group would have one lock file covering all 5 possibilities, but obviously the lock file is a bit more complex.

Once again, I don’t think either group is wrong and both approaches have plenty of use in the community and happy users. But this is the key question being asked: are we trying to do “requirements.txt 2” or “uv.lock and poetry.lock and pdm.lock all converge”? PEP 751 currently targets the latter case, but previously tackled the former case. As such, I can’t continue working on the PEP until we come to an agreement as to which approach we targeting. But once we do, then we can talk about goals, etc. within the scope of the approach we have chosen to go after.

10 Likes