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

Clarify that poetry update only updates main dependencies #9857

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hugobuddel
Copy link

Add a note that --with is required to let poetry update also update optional dependency groups.

This behavior of poetry update confused me, so I thought let's try to save other people the trouble by updating the documentation.

I do want to note that I find the behavior strange. If I do poetry install --with=dev followed by poetry update, then I expect all installed dependencies to be updated, also the dev ones.

Pull Request Check List

Resolves: #issue-number-here

  • Added tests for changed code.
  • Updated documentation for changed code.

Add a note that `--with` is required to have `poetry update` also update optional dependency groups.
@dimbleby
Copy link
Contributor

update is a two-phase process: first locking, then installing. I think perhaps this is what the docs could be clearer about.

eg your first change is definitely wrong, the lockfile will be updated even for dependencies in optional groups

I think what has surprised you is that update has the same semantics as install during the install phase

The poetry file is updated, just not the installed packages
@hugobuddel
Copy link
Author

You are right, the lock file is indeed updated, but the optional dependencies that are installed are not updated; clarified that.

The behavior is rather confusing (to me at least), so it is good to be as explicit as possible.

docs/cli.md Outdated
@@ -310,6 +311,11 @@ You can do this using the `add` command.
When `--only` is specified, `--with` and `--without` options are ignored.
{{% /note %}}

{{% note %}}
`poetry update` without any options will only update the main dependencies of the project.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is pedantically not correct - non-optional dependency groups are also updated, right?

Copy link
Author

Choose a reason for hiding this comment

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

That is probably right than non-optional dependency groups are also updated, although I have not tested this; updated, thanks.

Clarify that it is the non-optional dependencies that are updated
@hugobuddel
Copy link
Author

I was wondering whether the update behavior can leave the user with a broken state, and that seems indeed possible. E.g. see this example project https://github.com/hugobuddel/poetrytest

Maybe we should add a warning that the user can be left with an inconsistent environment if poetry update is called with different dependency groups specified than when the project was first installed?

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.

2 participants