Skip to content

Remove Python 2 artifacts from codebase#309

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/remove-python2-artefacts
Draft

Remove Python 2 artifacts from codebase#309
Copilot wants to merge 2 commits into
masterfrom
copilot/remove-python2-artefacts

Conversation

Copilot AI commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Python 2 reached end-of-life on January 1, 2020. This PR removes all Python 2 compatibility shims and the future package dependency.

__future__ imports removed

All from __future__ import absolute_import, division, print_function, unicode_literals lines dropped from ~19 files — these are no-ops on Python 3.

Runtime compatibility branches eliminated

  • basestring try/except → str
  • sys.version[0] == '2' guards for functools, zip_longest, and izip_longest → direct Python 3 imports
  • sys.version_info >= (3, 5) guard in helper.py → always use concurrent.futures.ThreadPoolExecutor
  • try/except ImportError fallbacks from collections → direct collections.abc imports (Iterable, Mapping, Sequence)
  • Python 2 __div__/__rdiv__/__idiv__ block in _compat/mixins.py removed
  • Python 2 __all__ ASCII encoding block in particles/__init__.py removed

future package dependency removed

Replaced future.utils.with_metaclass with native Python 3 metaclass syntax:

# Before
class Dumpreader_ifc(with_metaclass(abc.ABCMeta, FieldAnalyzer)):

# After
class Dumpreader_ifc(FieldAnalyzer, metaclass=abc.ABCMeta):

Misc

  • run-tests.py: removed -2 / --pycmd python2 CLI argument
  • pyproject.toml: removed future from dependencies, dropped stale Python 2 comment

Copilot AI linked an issue Jun 8, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Remove Python 2 artefacts from codebase Remove Python 2 artifacts from codebase Jun 8, 2026
Copilot AI requested a review from skuschel June 8, 2026 13:46
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.

python 2 end of life

2 participants