pipx
pipx copied to clipboard
Pin the version of an installed package so that `pipx upgrade-all` doesn't inadvertently upgrade the version
How would this feature be useful?
Currently, it seems that the new 1.2.0
version of poetry
has some pretty serious bugs. To avoid these, I have rolled back to the earlier 1.1.15
version. I use pipx
to manage this, which works great, but now, if I use pipx upgrade-all
, it will also upgrade poetry
back to the newer version that I don't want to use. I use pipx
for quite a few different utilities, so using pipx upgrade-all
to keep everything up to date is a common part of my workflow.
Describe the solution you'd like
It seems like an additional option for pipx install
could be introduced (something like --pin
), that would make it so the package will not be upgraded when running pipx upgrade-all
. I'm not sure how "unpinning" would be handled, and it would probably also be important to have additional feedback that a package is pinned when running pipx list
, for example.
Alternatively, maybe a new pipx pin
subcommand could be added that would be used to manage "pinning/unpinning" specific packages.
Describe alternatives you've considered
Obviously, it is possible to just upgrade individual packages, or rollback poetry
after it gets upgraded, but it is pretty annoying to have to do that.
pipx pin
feels like a straightforward choice, analogous to e.g. Homebrew.
If the objective is to prevent certain packages from upgrading then pipx upgrade-all
has a --skip
flag that can be used for this purpose.
Using the --skip
flag might be okay if e.g. some packages have temporary problems. But if you want to always skip some packages from being updated, it is errorprone and annoying to always have to thing about adding all them to the --skip
parameters.
Pinning them would be an easy way to avoid these errors and make sure they do not get updated automatically.
PR welcome.
Related, I have a similar use case where I use --suffix
to manage multiple installations of the same tool.
E.g., I have both tox 4 and tox 3 installed, to be able to migrate repos one-by-one.
$ pipx install tox
$ pipx install 'tox<3' --suffix 3
Here --upgrade-all
will upgrade both versions to the latest released.
You will be able to pin the version of it after a new version of pipx is released:
$ pipx install tox
$ pipx install 'tox<3' --suffix 3
$ pipx pin tox3
$ pipx upgrade-all
Error encountered when upgrading tox3:
Not upgrading pinned package tox3. Run `pipx unpin tox3` to unpin it.
Versions did not change after running 'pipx upgrade' for each package 😴
Some packages encountered errors during upgrade.
See specific error messages above.
Nice. I'd not have declared this as an "error", because the user explicitly decided to pin this package, but anyway. Nice to have such feature at all!
I'd not have declared this as an "error", because the user explicitly decided to pin this package.
I will make an improvement to this message. What if a summary like this is displayed at the end of the upgrade process?
Upgraded 0 package(s), not upgrading 1 pinned package(s)