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

BUG: pipx upgrade doesn't understand extra dependencies #925

Open
neutrinoceros opened this issue Dec 10, 2022 · 7 comments
Open

BUG: pipx upgrade doesn't understand extra dependencies #925

neutrinoceros opened this issue Dec 10, 2022 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@neutrinoceros
Copy link

Describe the bug

This works correctly

pipx install "mycli[extras]"

but this doesn't

pipx install "mycli[extras]"
pipx upgrade "mycli[extras]"

and it fails with

Package is not installed. Expected to find /path/to/pipx/venvs/mycli[isolated], but it does not exist.

How to reproduce
For reproduction, I suggest

pipx install "coverage[toml]"
pipx upgrade "coverage[toml]"

Expected behavior
I'm not 100% sure what should happen actually, but the current error message seems broken (of course a directory with [ and ] in its name wasn't found).
I think the upgrade should go through wether or not the extra targets match the ones I used (or didn't use) the first time I installed the CLI (here coverage).

I'd be happy to contribute a patch, but I'd appreciate some guidance regarding what the expected behaviour should be.

@dukecat0
Copy link
Member

You can simply run pipx upgrade mycli and you don't need to pass extra dependencies since it's installed. But I think we can improve the error message to make it more clearly.

@dukecat0 dukecat0 added the enhancement New feature or request label Dec 21, 2022
@uranusjr
Copy link
Member

Does pipx upgrade mycli upgrade dependencies that are only pulled in by the extra? I’m under the impression it only tries to upgrade the specified package (i.e. mycli here); if so we would actually need to add some additional logic for the extra-ed case.

@dukecat0
Copy link
Member

Does pipx upgrade mycli upgrade dependencies that are only pulled in by the extra?

Not really, unless --pip-args='--upgrade-strategy eager' is passed. This is probably related to #254.

@uranusjr
Copy link
Member

uranusjr commented Dec 28, 2022

Even if we change the strategy, dependencies in the extra would still not be upgraded (because from pip’s perspective those packages are unrelated unless you pass in the extra). So for now pipx upgrade does not have a difference in behaviour whether you pass in the extra or not, but would if we change the default upgrade strategy. I’d say the current behaviour is OK (barring a better error message), but we should probably change the strategy (or have a flag to control it), which would requite us to also fix how extras are passed to upgrade.

@gaborbernat
Copy link
Contributor

PR welcome.

@layday
Copy link
Member

layday commented Mar 8, 2024

[...] which would requite us to also fix how extras are passed to upgrade.

This might've been fixed since? It looks like if I pipx install nox[uv] then pipx upgrade nox correctly issues pip --no-input install --upgrade nox[uv]. Therefore, the only change required is to pass --upgrade-strategy=eager.

@cjolowicz
Copy link

What should pipx do if the main app's version didn't change? Should it still upgrade dependencies?

(IMO it should. This will let users benefit from bugfixes and security updates to the app's dependency tree. It will also help with the more exotic case of nox[uv] where uv has a much faster release cycle than Nox.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

6 participants