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

Drop support for EOL Python <= 3.6 #362

Merged
merged 15 commits into from
Mar 31, 2024
Merged

Drop support for EOL Python <= 3.6 #362

merged 15 commits into from
Mar 31, 2024

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Feb 3, 2024

Fixes #339.

Also run https://github.com/asottile/pyupgrade to help upgrade to modern syntax.

@kloczek
Copy link

kloczek commented Mar 9, 2024

Now 3.7 is EOLEd as well.

Copy link
Owner

@mahmoud mahmoud left a 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(),))
Copy link
Owner

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.

Copy link
Contributor Author

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.

boltons/fileutils.py Outdated Show resolved Hide resolved
@@ -244,7 +236,7 @@ def set_cloexec(fd):
"""
try:
flags = fcntl.fcntl(fd, fcntl.F_GETFD, 0)
except IOError:
except OSError:
Copy link
Owner

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.

@@ -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)):
Copy link
Owner

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
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Owner

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 -*-
Copy link
Owner

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.

boltons/timeutils.py Outdated Show resolved Hide resolved
Co-authored-by: Mahmoud Hashemi <makuro@gmail.com>
@hugovk
Copy link
Contributor Author

hugovk commented Mar 25, 2024

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!

You're welcome! Please go ahead, thank you!

@mahmoud mahmoud merged commit 0e4dc6a into mahmoud:master Mar 31, 2024
9 checks passed
@hugovk hugovk deleted the rm-eol branch March 31, 2024 20:39
@mahmoud
Copy link
Owner

mahmoud commented Mar 31, 2024

Merged! Almost certainly the biggest PR in boltons history. Thanks for your help in making it happen @hugovk!

image

@hugovk
Copy link
Contributor Author

hugovk commented Mar 31, 2024

Happy to help! 🚀

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.

RFC: Make boltons Python 3.7+ only.
3 participants