-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
base: main
Are you sure you want to change the base?
Conversation
Add a note that `--with` is required to have `poetry update` also update optional dependency groups.
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 |
The poetry file is updated, just not the installed packages
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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 |
@hugobuddel unfortunately there not much Poetry can do in your example.
You will notice that the installed version of |
@@ -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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
The point is that poetry does not actually install a newer version of scipy, 1.10.1 is still installed. So the installation is broken after doing I don't think it is ever desirable to leave the system in a broken state. So it would be good to add a warning to the documentation that this is a possibility lest the user forgets which What poetry could do, is detect that it had previously installed scipy (through the optional test group), and that a newer version of scipy should now be installed. Or at least warn the user. |
Add a note that
--with
is required to letpoetry 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 bypoetry update
, then I expect all installed dependencies to be updated, also the dev ones.Pull Request Check List
Resolves: #issue-number-here