pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.5k stars 257 forks source link

Support syncing input requirements to a lock file more easily. #2344

Closed jsirois closed 4 months ago

jsirois commented 6 months ago

With #2335, the correct set of arguments to pex3 lock update can be crafted to minimally update to a lock to an evolved set of input requirements. As noted here https://github.com/pantsbuild/pex/issues/2334#issuecomment-1900963246 though, a nicer interface would be:

pex3 lock sync "req1<2" -r reqs.txt --constraints constraints.txt --lock lock.json -- pytest ...

The idea is to perform a minimal lock update given the input requirements and constraints (or noop if reqs have not changed) and, if -- is present, execute the command line following it after syncing that command's venv with the lock.

This new notion of an ~auto minimal lock update would parse all input requirements and use the new features from #2335 to form the appropriate set of -R replacements and -d deletes to bring the lock in sync.