pipx icon indicating copy to clipboard operation
pipx copied to clipboard

Pin the version of an installed package so that `pipx upgrade-all` doesn't inadvertently upgrade the version

Open taranlu-houzz opened this issue 2 years ago • 8 comments

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.

taranlu-houzz avatar Sep 14 '22 18:09 taranlu-houzz

pipx pin feels like a straightforward choice, analogous to e.g. Homebrew.

uranusjr avatar Sep 15 '22 07:09 uranusjr

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.

aj-white avatar Jan 07 '23 15:01 aj-white

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.

hansingt avatar Mar 29 '23 11:03 hansingt

PR welcome.

gaborbernat avatar Dec 02 '23 17:12 gaborbernat

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.

vikahl avatar Feb 13 '24 15:02 vikahl

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.

dukecat0 avatar Mar 17 '24 07:03 dukecat0

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!

hansingt avatar Mar 18 '24 06:03 hansingt

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)

dukecat0 avatar Mar 18 '24 08:03 dukecat0