-
Notifications
You must be signed in to change notification settings - Fork 192
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
Drop python 2 #3566
Drop python 2 #3566
Conversation
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.
Oh yeah, that's the good stuff. Some minor comments below.
6974652
to
66550b8
Compare
I think the only thing left to do now is telling Jenkins to use py3 as well. |
Yes, but I also wanted to merge some final things that should go into |
@sphuber I've just stumbled across a very important little detail: In order for the "graceful fallback" on So that means, for the No idea why that's the case, but just tested this with a different package. It's described here (last paragraph), although you could easily miss it. |
Good catch! I will open a PR now |
a4d7d7f
to
e351001
Compare
Remove python 2 from supported version in `setup.json` and remove all dependencies that were only necessary for `python<3.5`. Additionally python 2 is removed from the build matrix on Travis. Add explicit `python_requires` keyword to `setup.json` which will ensure that `pip>=9` and other clients that support the metadata 1.2 spec only install a compatible version for the current Python runtime when installing the package.
e351001
to
3517f4b
Compare
@greschd if you'd like, I added three more commits on top since last time you reviewed. If you have the time you can just look at those commits. |
3517f4b
to
8126314
Compare
The removal of all future statements was performed with the following: find . -type f -not -path './.git*' -exec sed -i '/from __future__.*$/d' {} + The `modernizer` hook is also removed from the pre-commit config.
The majority of adaptations was done with the following commands: find . -type f -not -path './.git*' -exec sed -i '/\(import six\|from six\).*$/d' {} + find . -type f -not -path './.git*' -exec sed -i '/\(six\.add_metaclass\).*$/d' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.integer_types/int/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.string_types/str/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.text_type/str/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.binary_type/bytes/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.moves.StringIO/io.StringIO/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.StringIO/io.StringIO/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.moves.BytesIO/io.BytesIO/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.BytesIO/io.BytesIO/g' {} + find . -type f -not -path './.git*' -exec sed -i 's/six.moves.range/range/g' {} + find . -type f -not -path './.git*' -exec sed -i 's|six.iterkeys(\([^)]*\))|\1.keys()|' {} + find . -type f -not -path './.git*' -exec sed -i 's|six.iteritems(\([^)]*\))|\1.items()|' {} + find . -type f -not -path './.git*' -exec sed -i 's|six.itervalues(\([^)]*\))|\1.values()|' {} +
This is no longer needed for python 3.
In python 3 strings are stored as unicode by default so now that we dropped pyhon 2 support there is no need to keep prefixing them with the string encoding declaration `u`.
This is no longer necesary in python 3. To remove all the occurrences of this usage, the following command was used: find . -type f -not -path './.git*' -exec \ sed -i 's/super([^)]*,[^)]*)/super()/g' {} + The regex tries to find all instances of `super()` where there is content between the parentheses. The search for `[^)]*` means to look for all characters except a closing parens, which essentially makes the search non-greedy. Having just that would not be enough and we have to explicitly add another such clause separated by a comma. This is the exact format required by python 2 where the `super` call expects two arguments, first being the class itself and the second the reference, typically `self` or `cls. By making the regex more specific we avoid matching cases like: def test_without_super(self): which would be replaced to def test_without_super(): if we don't include the explicit comma in the regex between the parens.
8126314
to
b8c458b
Compare
Hash arbitrary binary strings (str in Python 2, bytes in Python 3). | ||
For compat reason between Python 2 and 3, this gets the same hash-type | ||
as for unicode in Python 2, resp. str in Python 3.""" | ||
"""Hash arbitrary byte strings.""" | ||
return [_single_digest('str', bytes_obj)] |
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.
Hmm, I'm not sure if we might want to change the "type specifier" here to be bytes - specific, now that py2 / py3 compatibility is no longer a concern.
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.
Nice work! The bytes hashing prefix can also be discussed separately -- since that would invalidate current hashes, it probably shouldn't be buried in this merge.
Fixes #3562