-
Notifications
You must be signed in to change notification settings - Fork 354
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 support for EOL Python <= 3.6 #362
Conversation
Now 3.7 is EOLEd as well. |
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 awesome. Just a few suggestions and notes for posterity, then we can get this merged. @hugovk let me know if you'd like me to make the changes, as you've already gone above and beyond here. Thanks!
@@ -307,7 +301,7 @@ def get_profile(**kwargs): | |||
""" | |||
scrub = kwargs.pop('scrub', False) | |||
if kwargs: | |||
raise TypeError('unexpected keyword arguments: %r' % (kwargs.keys(),)) |
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.
So, some thoughts on ecoutils
. It's a pretty special case. Its original intention was for capturing analytics on a wide variety of installation targets. Whereas the rest of boltons supported back to 2.7, ecoutils supported back to 2.4, so we could detect those out-of-date envs.
2.4 is ancient but I could see an argument for keeping this one module compatible with 2.7. I'm not sure who's using it, but ~0.5% of boltons installs (~500 per day) are Python 2.7. Though tbh it might be easier to manage as a separate package and have a cleaner break.
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.
There's a lot of machines out there installing software. I expect most of the 2.7 installs are from PyPI mirrors like Bandersnatch, or CIs.
@@ -244,7 +236,7 @@ def set_cloexec(fd): | |||
""" | |||
try: | |||
flags = fcntl.fcntl(fd, fcntl.F_GETFD, 0) | |||
except IOError: | |||
except OSError: |
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.
Ah yes, the big OSError merger.
boltons/fileutils.py
Outdated
@@ -522,13 +514,13 @@ def iter_find_files(directory, patterns, ignored=None, include_dirs=False): | |||
.. _glob: https://en.wikipedia.org/wiki/Glob_%28programming%29 | |||
|
|||
""" | |||
if isinstance(patterns, basestring): | |||
if isinstance(patterns, (str, bytes)): |
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.
So I believe this function actually fails in Python 3 with a bytes
object, because the fun bytes-iterates-as-ints behavior. Probably better if we just drop the bytes support.
"""Class decorator that fills in missing comparators/ordering | ||
methods. Backport of :func:`functools.total_ordering` to work | ||
with Python 2.6. | ||
from functools import total_ordering |
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.
from functools import total_ordering | |
# import maintained for legacy compatibility: | |
# boltons used to offer a Python 2.6-compatible total_ordering implementation | |
from functools import total_ordering |
@@ -272,8 +255,7 @@ def rstrip_iter(iterable, strip_value=None): | |||
break | |||
if not broken: # Return to caller here because the end of the | |||
return # iterator has been reached | |||
for t in cache: | |||
yield t | |||
yield from cache |
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.
Excellent. Finally, PEP 380.
@@ -1,5 +1,3 @@ | |||
# -*- coding: utf-8 -*- |
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.
worth mentioning somewhere: these were originally not just for python, but also emacs. But I believe since emacs 24 (~2012 I think), emacs assumes utf-8.
Co-authored-by: Mahmoud Hashemi <[email protected]>
You're welcome! Please go ahead, thank you! |
Merged! Almost certainly the biggest PR in boltons history. Thanks for your help in making it happen @hugovk! |
Happy to help! 🚀 |
Fixes #339.
Also run https://github.com/asottile/pyupgrade to help upgrade to modern syntax.