Skip to content

Once a day check PyPI for the latest version of pip #1214

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

Closed
wants to merge 6 commits into from

Conversation

dstufft
Copy link
Member

@dstufft dstufft commented Sep 28, 2013

Packaging is quickly evolving and it's recommended that users upgrade as quick as possible. This will let users know that there is an upgrade available in a non intrusive method. In case that someone does not wish to ping PyPI once a day or so (assuming they are executing pip at least once a day) there is an option to disable it --disable-version-check.

@qwcode
Copy link
Contributor

qwcode commented Sep 28, 2013

ok, but let's add tests for this..

@dstufft
Copy link
Member Author

dstufft commented Sep 28, 2013

ok!

@qwcode
Copy link
Contributor

qwcode commented Sep 28, 2013

after having fixed a series of 1-2 yr old bugs recently, that never had to exist, if tests had been added originally, I'm a little sensitive : )

@dstufft
Copy link
Member Author

dstufft commented Sep 28, 2013

No worries! I like having someone keep me honest :)

@dstufft
Copy link
Member Author

dstufft commented Sep 28, 2013

It's why I typically like either someone else to merge my PRs, or someone to tell me to merge them :)

@hpk42
Copy link

hpk42 commented Sep 28, 2013

I don't like that pip suddenly hardcodes a connection to https://pypi.python.org here. When using devpi-server, it serves as the sole endpoint for pip but this change would break that.

Independently, there might be reasons why systems use a specific pip version. I understand it's possible to disable the version check but i remeain skeptical of the whole idea. People usually have a lot of software and it's more useful to use some of the pip wrappers/helps which check about e.g. all versions in a virtualenv or requirements.txt. pip doing this self-check isn't not really buying that much i would think.

@dstufft
Copy link
Member Author

dstufft commented Sep 28, 2013

The typical index server isn't used because it's not using PackageFinder so it doesn't use the simple API and because it's explicitly asking if the pip developers have released a newer version or not, not if a newer version is installable.

If a system uses a specific version they are free too. They can either just visually ignore the message (It's just a warning, it's not a prompt or anything) or they can disable the check.

The purpose of this message is simple, the more people on newer versions of pip the better while the world of packaging is improving as rapidly as it is. Ideally the goal would be to remove this check once things have settled down a bit. I've talked to a few people involved in projects that used similar checks during periods of rapid improvement and their views have all been positive towards it.

Personally I believe that the check does buy a good bit, and the downsides are pretty minimal.

@hpk42
Copy link

hpk42 commented Sep 28, 2013

If i see it correctly, the PR currently raises if a connection to https://pypi.python.org cannot be established or errors out. This would break in confined environments (where people might choose to install only from local sources, or via devpi-server which allows temporary offline operations). So at least the check should never error out or disrupt installations.

Moreover, devpi-server can easily offer the "json" page but the question is how the check could be extended to try it.

Also, i think this change means that all tox runs will do the version check for each environment ... or wait. How is this going to work at all? If pip stores the versioncheck timestamp in the home dir, what about different virtualenvs using different versions of pip? Would this check even reliably work?

@dstufft
Copy link
Member Author

dstufft commented Sep 28, 2013

This PR swallows any exceptions that happens inside the version checking and simply logs an error (to a level that is not displayed by default).

Yes it's true it stores it in the home directory and that a check on one virtualenv may prevent a check on another virtualenv. I decided to keep it this way to prevent users from getting "warning fatigue".

"upgrading." % vers)
except Exception as exc:
logger.info("There was an error checking the latest version of"
" pip: %s" % str(exc))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need a str here. Also, you might want to consider a way to dump the traceback, sooner or later you'll want it.

@dstufft
Copy link
Member Author

dstufft commented Sep 30, 2013

I've addressed most of the concerns @alex had besides how virtual environments are going to be handled.

@hpk42 I would expect a tool like tox to issue --disable-version-check because you don't show the output of the pip install command anyways.

So I guess we need to figure out what solution we find acceptable for this. The largest worry is that of warning fatigue. I think it's somewhat unnice to spam the user with a bunch of warnings if they are purposely ignoring the upgrade instructions (although perhaps the answer is --disable-version-check in that case?).

@dstufft
Copy link
Member Author

dstufft commented Sep 30, 2013

Oh also @hpk42 does the fact that this swallows exceptions and provides a way to disable it satisfy your concerns with it? It will use the same requests settings as the rest of pip so things like proxies and such will automatically be carried over.

@hpk42
Copy link

hpk42 commented Sep 30, 2013

tox already has a problem in that it needs to adapt to pip-1.3.1/pip-1.4 changes (--pre). With this PR accepted it might need to grow support for passing --disable-version-checks as well. Obviously, from that perspective i generally prefer it if behaviour changes are triggered by an option, rather than the need to neutralize a change via a new option. Doesn't really work here because you want to force the check. I assume it's possible to set an environment variable as well to disable the check. Is that right?

@dstufft
Copy link
Member Author

dstufft commented Sep 30, 2013

Yea, all pip options should be settable by flag, env var, or config file. It's baked into the configuration system as far as I know.

@qwcode
Copy link
Contributor

qwcode commented Oct 1, 2013

yes, PIP_* is baked into the config system for any flag/option, and a lot of that code got new tests recently!!

@dstufft
Copy link
Member Author

dstufft commented Oct 27, 2013

Still need to write tests for this, but I've refactored this so it only hits PyPI once a week. It stores the last check and the version it found and uses that for comparison.

@dstufft
Copy link
Member Author

dstufft commented Nov 4, 2013

I'm withdrawing this PR.

@dstufft dstufft mentioned this pull request Sep 18, 2014
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants