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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ you should use the `update` command.
poetry update
```

This will resolve all dependencies of the project and write the exact versions into `poetry.lock`.
This will resolve all dependencies of the project, write the exact versions into `poetry.lock`,
and subsequently update the non-optional dependencies.

If you just want to update a few packages and not all, you can list them as such:

Expand Down Expand Up @@ -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 non-optional dependencies of the project.
Copy link
Member

Choose a reason for hiding this comment

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

I do not think this is a 100% accurate. Dependencies specified in optional groups will also update iff a dependency in the activated group(s) has a dependency on any of them. Otherwise, it wont.

Copy link
Author

Choose a reason for hiding this comment

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

I don't know how to formulate it better.

All I know is that I was very confused that I had to specify --with or poetry would not update several of my already installed packages (as in, it would not install newer versions). I found that behavior very counterintuitive, so I thought maybe others are confused too, so I tried to be a good citizen and improve the documentation.

Maybe

You need to specify the same optional dependency groups that you specified when you ran poetry install, otherwise poetry might not install newer versions of your already installed packages. Specifying no or different groups might leave your system in a broken state with incompatible packages.

That conveys more clearly what I want to warn about, and also adds a few 'might's in there in case the installed package whose group is not selected but that is a dependency of an active group is updated anyway.

Optional dependency groups are only updated when they are specified through `--with`.
{{% /note %}}

## add

The `add` command adds required packages to your `pyproject.toml` and installs them.
Expand Down