Optional automatic upgrade of pip on new releases
See original GitHub issueWhat’s the problem this feature will solve?
Whenever there is a new pip release, I get a message like this the next time I run pip install
in one of my virtualenvs:
[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: pip install --upgrade pip
Because I have never suffered any negative consequences from upgrading (thank you for that) and also because I don’t want to see the message again, I nearly always run the upgrade immediately. However, it does not feel very productive to do this manually.
Describe the solution you’d like
Instead of telling me how to upgrade pip, pip could just do the upgrade.
Here is some brainstorming how this could work. Instead of --disable-pip-version-check
, there could be a new option, something like --pip-version-upgraded-action=
, with different actions:
disable
would be the same as--disable-pip-version-check
notice
prints the notice (current behavior)ask
prompts interactively whether to do an upgradeupgrade
does the upgrade without prompting
Maybe this is going too far, but I could even imagine that ask
could become the default 1) if the prompt is only shown when input is a terminal and 2) if the options are not only “yes” and “no”, but also “no, and don’t ask again for this virtual environment”.
Alternative Solutions
Perhaps an argument could be made that no upgrade notice should be shown by default. They are not shown for other packages in the virtual environment, so why single out pip?
I am aware of --disable-pip-version-check
, but as long as consensus is that pip is important enough to be upgraded as soon as a new release comes out (hence notices are shown), I would prefer to do the upgrade.
Code of Conduct
- I agree to follow the PSF Code of Conduct.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:14 (9 by maintainers)
Well, the
--disable-pip-version-check
option (which can be set in the config file) does that, but you said originally that wasn’t a suitable solution for you.It’s important to upgrade for two main reasons:
You can, of course, make your own choice around upgrading. But the upgrade notice does reflect our advice on whether you should or not.
The reasons we don’t automatically upgrade, but just let the user know, are basically:
[^1]: Even though sadly, a lot of people do 🙁
Thanks all for your time engaging with me. I don’t think I have managed particularly well to convey that I don’t want to force an auto-update on anyone – my favorite option would be to prompt, and then it would be fully under the user’s control. However, it also appears to be more complicated than I thought (as always) and enthusiasm seems to be pretty low for the idea in general. I would not be able to submit a PR for this myself anyway, so I will let this go. It’s good to have your stance on the idea documented here. (Feel free to close.)