Skip to content
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

Check the pip version is compatible ASAP #429

Closed
wants to merge 2 commits into from
Closed

Check the pip version is compatible ASAP #429

wants to merge 2 commits into from

Conversation

alexwlchan
Copy link

This avoids getting a nasty traceback if we hit an error between importing pip and running the compatibility check.

Additionally, it seems like the supported version of pip was incremented but the README wasn’t. This patch fixes the README.

I considered adding a test for this, but that would require an entirely new set of tests for what is hopefully an edge case scenario.

Resolves #484.

If running an out-of-date version of pip, it's possible to hit an
ImportError while doing package-internal imports.  This means we
never hit the compatibility check, and a nasty traceback is
printed to the console.  See #428 for one such example.

This patch runs the compatibility checks as soon as we import pip,
which minimises the risk of an unhelpful error message.

# Make sure we're using a compatible version of pip
from ..utils import assert_compatible_pip_version
assert_compatible_pip_version()
Copy link
Author

Choose a reason for hiding this comment

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

There is still a possibility of error if an ImportError is thrown in utils.py, but the fix for that is more destructive, and would mean moving this function into its own file. I don’t mind doing that, but I’ll wait to see if reviewers think that would be necessary.

@alexwlchan alexwlchan closed this Feb 20, 2017
@alexwlchan alexwlchan deleted the supported-versions branch February 20, 2017 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip-compile fails if output file already exists
1 participant