Remove Python 2 compatibility shims#2771
Merged
Merged
Conversation
Remove all Python 2 compatibility shims (six and future packages) and replace with stdlib equivalents: - six.iteritems(d) → d.items() - six.itervalues(d) → d.values() - six.string_types → str - six.text_type → str - six.moves.xrange → range - six.moves.reduce → functools.reduce - six.moves.builtins → builtins - six.moves.cPickle → pickle - six.raise_from(X, e) → raise X from e - six.ensure_str(s) → s - past.builtins.xrange → range Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
dyf
approved these changes
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview:
sixandfutureare Python 2 compatibility shims. Python 3 was released 18 years ago. AllenSDK now requires Python 3.10+. Time to stop using Python 2.Addresses:
Drop 18+ year old python code.
Type of Fix:
functionality to not work as expected)
Solution:
Remove all Python 2 compatibility shims (six and future packages) and replace with stdlib equivalents.
Changes:
Remove all
import six/from six import .../from past.builtins import ...across the codebase and replace with stdlib equivalents:
six.iteritems(d)d.items()six.itervalues(d)d.values()six.string_typesstrsix.text_typestrsix.moves.xrangerangesix.moves.reducefunctools.reducesix.moves.builtinsbuiltinssix.moves.cPicklepicklesix.raise_from(X, e)raise X from esix.ensure_str(s)s(already str in Python 3)past.builtins.xrangerangeDrop
sixandfuturefrompyproject.tomldependencies.Validation:
Checklist
Allen Institute Contribution Guidelines
Numpy Standards
appropriate
rc/x.y.z as its merge target