Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lock: make --no-update the default behavior and introduce --new for the previous default behavior #9327

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

radoering
Copy link
Member

Pull Request Check List

Resolves: #3248
Relates-to: #9136

  • Added tests for changed code.
  • 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.

@@ -18,7 +18,7 @@ class LockCommand(InstallerCommand):

options: ClassVar[list[Option]] = [
option(
"no-update", None, "Do not update locked versions, only refresh lock file."
"new", None, "Ignore existing lock file and create a new one from scratch."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about --refresh?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. 😃

At first I wondered whether it is unambiguous enough but thinking a bit longer about the gist of the word I start to like it.

Copy link

@rbebb rbebb Apr 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--regenerate might be a good option as well! It would communicate that it's creating a new lock file from scratch.

@rbebb
Copy link

rbebb commented Apr 24, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

breaking change: invert lock --no-update to lock --update (or similar)
3 participants