pipx
pipx copied to clipboard
pipx upgrade with a specificier
How would this feature be useful?
Since 0.15 pipx got rid of the --spec
argument, but now I can’t upgrade a package to a difference spec. Previously I could
pipx install virtualenv
# Some time later…
pipx upgrade virtualenv --spec "virtualenv>=30.0b2"
pipx upgrade virtualenv --spec "git+https://github.com/pypa/virtualenv.git"
Describe the solution you'd like
Either add back the --spec
argument for upgrade
, or allow e.g.
# Current fails with "Package cannot be a url"
pipx upgrade "git+https://github.com/pypa/virtualenv.git"
# Current fails with "FileNotFoundError"
pipx upgrade "virtualenv>=30.0b2"
Just to check, will the workaround work: pipx uninstall
followed by pipx install
? Or is there a reason (besides extra typing) that that's worse?
Another idea, #256 could replace this functionality.
I’d assume upgrade
to keep injected packages. reinstall
makes sense as well.
Ah yes, preserving injected packages, that makes sense with upgrade
.
In general I think we need to look at the options for upgrade
(and reinstall
if it is created separate from reinstall-all
). It would be nice to have the options for these commands only supersede the existing metadata if they are present, and otherwise the existing metadata in the venv would be used. I don't think that's currently how they're set up.
Just to check, will the workaround work:
pipx uninstall
followed bypipx install
? Or is there a reason (besides extra typing) that that's worse?
If one is trying to automate, i.e. have a script that ensures a specific rev of something is installed, then it is a bit of work to find the right pipx_metadata.json file and find the right field and see if the uninstall/install sequence is needed.
I wonder if this would be worth a different pipx subcommand, like possibly modify
.
While uninstall
and install
in principle do the job, it might take quite some time if you have many large dependencies.
I would prefer to reuse as much as possible from the existing installation.
I use the following as a workaround to downgrade/upgrade as required, e.g.:
$ pipx inject poetry poetry==1.2.2
I would be also expecting that the same spec as in pip is supported.
The fact that we use pip to install packages is an implementation detail, so I don't want --upgrade flag. But happy to fix original issue.