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

Abort install if Requires-Python do not match the running version #3846

Merged
merged 5 commits into from
Oct 27, 2016

Conversation

xavfernandez
Copy link
Member

Once pypa/setuptools#631 is merged, it should be easier to add functionnal tests

I'm wondering wheither pip should provide an escape hatch via some --ignore-requires-python or not.

@dholth
Copy link
Member

dholth commented Jul 14, 2016

Yes, it should have an escape hatch.

@xavfernandez
Copy link
Member Author

Escape hatch added.

This PR would also help avoid further issues like #3390

@xavfernandez xavfernandez added this to the 8.2 milestone Jul 21, 2016
@xavfernandez xavfernandez force-pushed the check_python_requires branch 2 times, most recently from b566ab1 to ae13022 Compare July 21, 2016 15:38
logger.debug(
"Package %s has an invalid Requires-Python entry %s - %s" % (
dist.project_name, requires_python, e))
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it return without raising if invalid specifier ?

Copy link
Member Author

Choose a reason for hiding this comment

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

We used to ignore this information, so I'd say it is ok to keep ignoring it if we cannot parse it.
I'll bump the log level to warning to alert the user though.

@xavfernandez xavfernandez added the type: enhancement Improvements to functionality label Aug 1, 2016
@xavfernandez xavfernandez force-pushed the check_python_requires branch 2 times, most recently from 8b5e748 to c0db7e8 Compare August 12, 2016 08:38
@sigmavirus24
Copy link
Member

This is exciting!

@xavfernandez
Copy link
Member Author

@pfmoore @dstufft does this look ok to you ?



class UnsupportedPythonVersion(InstallationError):
"""Unsupported python version (related to PEP 345 Requires-Python)."""
Copy link
Member

Choose a reason for hiding this comment

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

"related to PEP 345 Requires-Python" sounds a bit clumsy. Maybe "according to Requires-Python package metadata"?

@pfmoore
Copy link
Member

pfmoore commented Oct 11, 2016

Other than the one minor comment, LGTM.

@xavfernandez xavfernandez reopened this Oct 11, 2016
@xavfernandez xavfernandez force-pushed the check_python_requires branch 2 times, most recently from 24eb174 to 812ae9e Compare October 18, 2016 11:22
@xavfernandez xavfernandez force-pushed the check_python_requires branch 2 times, most recently from 38b8b60 to b43fb54 Compare October 27, 2016 16:43
@xavfernandez xavfernandez merged commit 8df742e into pypa:master Oct 27, 2016
@xavfernandez xavfernandez deleted the check_python_requires branch October 27, 2016 17:24
@piotr-dobrogost
Copy link

@xavfernandez
Thanks for this!
I added it as a solution to the old standing question How to write Python code that is able to properly require a minimal python version? at SO.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 3, 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 type: enhancement Improvements to functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants