-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Remove Python 2 code from setup #10470
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
Conversation
setupext.py
Outdated
msgs += ['using mock %s' % mock.__version__] | ||
except ImportError: | ||
msgs += [msg_template.format(package='mock')] | ||
msgs += ['using unittest.mock'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would not even bother with the message, it's just a boring regular stdlib module now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor suggested change, but not blocking merge
Fixed your comment and also found a couple more instances of |
I also moved the check in |
if sys.version_info < (3, 5): # noqa: E402 | ||
raise ImportError(""" | ||
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4. | ||
Beginning with Matplotlib 3.0, Python 3.5 and above is required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both lines -> "Matplotlib 3.0+ requires Python 3.5 or above."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as before and it's being explicit on purpose, as it's following IPython's lead.
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4. | ||
Beginning with Matplotlib 3.0, Python 3.5 and above is required. | ||
|
||
See Matplotlib `INSTALL.rst` file for more information: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more information see https://github.com/matplotlib/matplotlib/blob/master/INSTALL.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't fit on a line nicely.
@@ -14,6 +14,17 @@ | |||
|
|||
import sys | |||
|
|||
if sys.version_info < (3, 5): | |||
error = """ | |||
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
|
||
Make sure you have pip >= 9.0.1. | ||
""" | ||
sys.exit(error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this behave if installed as a dependency of something via pip? Modern pip should never try, but what do old versions of pip do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's why we error out and the message suggests that you install a new pip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a normal install, it does this:
$ pip install -e .
Obtaining file:///.../matplotlib
Complete output from command python setup.py egg_info:
Matplotlib 3.0+ does not support Python 2.x, 3.0, 3.1, 3.2, 3.3, or 3.4.
Beginning with Matplotlib 3.0, Python 3.5 and above is required.
This may be due to an out of date pip.
Make sure you have pip >= 9.0.1.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in .../matplotlib/
I'm not sure how to test it out as a dependency, but I'd guess you get a similar error.
This reduces the number of files we need to keep Python 2 compatible.
This will allow us to import anything new things from the standard library without breaking Python 2.
Rebased due to conflicts. |
This was missing from e3442ae.
PR Summary
A bit of a follow up to #10425. Use @anntzer's suggestion to exit earlier (and thus require Python 2 compatibility for fewer files), and then drop the Python 2 stuff from
setupext.py
.PR Checklist