Closed jsirois closed 6 months ago
Ok, another pretty big one. Thanks again for your review efforts.
The real changes are in:
pex3 lock (update) ...
and performs post-processing of the update to display what would-be / is updated.One note to draw attention to is here: https://github.com/pantsbuild/pex/issues/2334#issuecomment-1897604016
Basically, this change introduces everything needed to implement minimal lock auto-update, even for Pants. IOW ~like cargo where if you change the input requirements, the lock just gets auto-minimally updated implicitly. That said, it would be clunky to poke around in the existing lock to come up with the full set of -R <new-req-1> ... -R <new-req-N> -d <removed-proj-1> ... -d <removed-proj-M>
to affect that style of update. This change was large; so I'd like to work through this PR and likely release, then circle back and add the lock update with bare requirements / -r requirements
feature that will enable doing this automatically.
Users will love this (post https://github.com/pantsbuild/pex/issues/2334#issuecomment-1897604016 anyway). And once we have that, Pants should be able to auto-update lockfiles when requirements change, a la Cargo.
As that comment alluded, nothing blocks that functionality as soon as this is merged. Its clunky for a human, but Pants is not that. IIUC it is easy for pants to create a lock if none present, or else update the present lock by gathering requirements, compare to prior requirements in lock, separate in 2 groups of changed + new and deleted, call pex3 lock update with the corresponding set of -R and -d. That said, I can see if you want to wait instead of writing a bunch of logic you then turn around and rip out shortly after.
Previously you could only add new top-level requirements to a lock or refine constraints against an existing locked item. Now you can
-d
/--delete-project
a top-level requirement from the lock as well as replace a top-level requirement with-R
/ `--replace-project.Fixes #2332 Fixes #2334