kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Remove Python 2.7 compatibility code from Kolibri

Open rtibbles opened this issue 2 months ago • 0 comments

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Python 2.7 support was officially dropped from Kolibri several versions ago. However, the codebase still contains significant amounts of Python 2.7 compatibility code, including fallback implementations, compatibility shims, and outdated syntax patterns.

Motivation

Removing this legacy code will provide several benefits:

  1. Improved code maintainability - Simpler, more readable code that uses modern Python 3 idioms
  2. Reduced technical debt - Eliminates unnecessary compatibility layers and workarounds
  3. Better performance - Native Python 3 implementations are often more efficient than compatibility shims
  4. Easier onboarding - New contributors don't need to understand Python 2/3 compatibility concerns
  5. Modernization - Aligns codebase with current Python best practices

Scope

This epic tracks the removal of all Python 2.7 compatibility code across the Kolibri codebase, including:

  • Legacy import statements (from __future__ import)
  • Python 2-style super() calls
  • Compatibility utility functions (mkdirp(), replace_file(), etc.)
  • Runtime compatibility checks (hasattr(output, "decode"), exception handling)
  • Backported functionality (lru_cache, etc.)

Sub-tasks

The work has been broken down into manageable tasks suitable for community contributors with varying experience levels. GitHub will automatically track all linked child issues below.

Testing Requirements

All pull requests must pass the existing test suite:

pytest

Contributors should run relevant tests locally before submitting PRs. See individual task issues for specific testing guidance.

Questions?

If you have questions about any of these tasks, please comment on the specific task issue or reach out to the maintainers.

Disclosure

🤖 This issue was written by Claude Code, under supervision, review and final edits by @rtibbles 🤖

rtibbles avatar Nov 07 '25 03:11 rtibbles