Skip to content

Remove Python 2 compatibility code#12

Merged
csett86 merged 2 commits into
mainfrom
copilot/remove-python2-compatibility
Jan 17, 2026
Merged

Remove Python 2 compatibility code#12
csett86 merged 2 commits into
mainfrom
copilot/remove-python2-compatibility

Conversation

Copilot AI commented Jan 16, 2026

Copy link
Copy Markdown

Project requires Python ≥3.8 but retained Python 2 compatibility layer. Removed obsolete compatibility code.

Changes

Removed six dependency:

  • Replaced six.string_typesstr
  • Replaced six.text_typestr
  • Eliminated six.PY2 conditionals (kept Python 3 paths)
  • Replaced six.moves imports with stdlib equivalents

Simplified carbonlink unpickler:

  • Removed dual-implementation SafeUnpickler class
  • Direct module name mapping (__builtin__builtins, copy_regcopyreg)

Cleaned vendored whisper.py:

  • Removed izip/ifilter/xrange compatibility shims
  • Direct use of native zip/filter/range

Removed future imports:

  • Deleted from __future__ import absolute_import

Example

Before:

import six
from six.moves import cPickle as pickle

if isinstance(windowSize, six.string_types):
    delta = parseTimeOffset(windowSize)

After:

import pickle

if isinstance(windowSize, str):
    delta = parseTimeOffset(windowSize)

Net change: 10 files, -67/+38 lines

Original prompt

Remove anything that is only required for python2 compatibility


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Remove six dependency from pyproject.toml
- Replace six.string_types with str
- Replace six.text_type with str
- Remove six.PY2 conditional in app.py and carbonlink.py
- Replace six.moves imports with Python 3 stdlib equivalents
- Remove __future__ imports
- Clean up vendored whisper.py (remove izip, ifilter, xrange compat)
- All tests passing

Co-authored-by: csett86 <1392875+csett86@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove Python 2 compatibility code Remove Python 2 compatibility code Jan 16, 2026
Copilot AI requested a review from csett86 January 16, 2026 22:17
@csett86 csett86 marked this pull request as ready for review January 17, 2026 09:05
@csett86 csett86 merged commit ad6b61e into main Jan 17, 2026
8 checks passed
@csett86 csett86 deleted the copilot/remove-python2-compatibility branch January 17, 2026 09:06
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.

2 participants