Silently allow --no-update for backward compatibility
The error The option "--no-update" does not exist is not necessary since no update is anyway the default. Erroring does not help. Contrarily, it prevents scripts or automated uses to work with both v1 and v2.
(I work in a place with shared build scripts, but users control which version of poetry they use, so when one installs poetry v2, it fails with the --no-update flag error).
Pull Request Check List
Resolves: #issue-number-here
- [X] Added tests for changed code.
- [X] Updated documentation for changed code.
Summary by Sourcery
Tests:
- Add tests to verify the behavior of the
--no-updateflag and its incompatibility with the--regenerateflag.
Reviewer's Guide by Sourcery
This pull request introduces support for the '--no-update' flag to allow backward compatibility by silently allowing its usage. The changes ensure that when '--no-update' is provided with the lock command, the locked packages are not updated, and proper error handling has been added when both '--no-update' and '--regenerate' are used simultaneously. Test cases have been updated to verify the new behavior.
Updated class diagram for LockCommand in LockCommand handling
classDiagram
class LockCommand {
+List options
+handle() int
}
%% New option added for backward compatibility
class LockCommandOptions {
+"--no-update": boolean
+"--regenerate": boolean
}
LockCommand --> LockCommandOptions : uses
note for LockCommand "The '--no-update' option is added for backward compatibility. In handle(), if both '--no-update' and '--regenerate' are present, an error is displayed and returns 1."
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Update test cases to validate the --no-update functionality. |
|
tests/console/commands/test_lock.py |
| Implement the '--no-update' option and enforce mutual exclusivity with '--regenerate'. |
|
src/poetry/console/commands/lock.py |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review! - Generate a plan of action for an issue: Comment
@sourcery-ai planon an issue to generate a plan of action for it.
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.
Not sure if this still makes sense after such a long time and so few complaints (resp. so few "thumbs up" on this PR). I think we should have printed a deprecation warning instead of just removing it in the first place but now it is probably just fine to leave it alone?
Consequence for us is that we stuck to poetry v1 and will probably move to some other toolchain rather than upgrade to v2.
Note that some other cli breakage led to the full decision, a major one being v2 poetry -C <dir> not behaving like all other linux tools (does not change the CWD).
Consequence for us is that we stuck to poetry v1 and will probably move to some other toolchain rather than upgrade to v2.
Does that mean that this PR would still help you if included in the next minor release or that it does not matter to you? In case, you are still interested in getting this merged, would it be fine for you if we print a deprecation warning if --no-update is used?
a major one being v2
poetry -C <dir>not behaving like all other linux tools (does not change the CWD).
I think that one was fixed in #9831 with Poetry 2.0.0.