lock: make `--no-update` the default behavior and introduce `--regenerate` for the previous default behavior
Pull Request Check List
Resolves: #3248 Relates-to: #9136
- [x] Added tests for changed code.
- [x] Updated documentation for changed code.
⚠️ Breaking change. Requires a major version bump. ⚠️
The most difficult decision (if we want to let this change happen) is the name of the new option (old default behavior).
The old flag was --no-update. Why not call the new flag --update?
Because it's not exactly what it is. It does not update the locked package versions but ignores the lock file and creates a new one from scratch. The result is the same as an update because our (only) locking strategy is "use-latest" but in case we introduce alternative locking strategies in the future (cf #3527) the result will be different. Further, by not calling it --update the difference to poetry update --lock becomes clearer.
I believe that it's the right move to switch the default behavior of poetry lock to poetry lock --no-update. More often than not, users are looking to update a few packages rather than all of them. If a user updates all of the packages, the user has an increased risk of introducing a package update that contains breaking changes.
This change will result in a more user friendly tool since the behavior will be more clear and therefore less experienced users will have less confusion!
The proposed changes look good to me! Is it a good time to mark this draft as ready for review?
This PR is marked as draft to avoid that it is merged by accident because we only want to do this with a major version bump and it is very likely but not absolutely clear that the next version will be 2.0. I will mark it as ready as soon as this is clarified. The actual review shoud be quite easy because this is a simple change.