Skip to content

Backend 3: Upgrade Python 3.10 to 3.13#9321

Open
camd wants to merge 8 commits intomasterfrom
camd/back-end-package-upgrade-phase-3
Open

Backend 3: Upgrade Python 3.10 to 3.13#9321
camd wants to merge 8 commits intomasterfrom
camd/back-end-package-upgrade-phase-3

Conversation

@camd
Copy link
Copy Markdown
Collaborator

@camd camd commented Mar 22, 2026

Summary

  • Upgrade Python from 3.10 to 3.13 across Docker images, CI, and tooling config
  • Update base images from Debian Bullseye to Bookworm (required for Python 3.13)
  • Fix compatibility issues: netcatnetcat-openbsd, ENV format in Dockerfile
  • Remove Python 3.10 backport deps (backports-asyncio-runner, exceptiongroup, tomli) that are now in stdlib
  • Add setuptools to dev requirements (removed from stdlib in Python 3.13)
  • Remove pyqt5/pyqt5-qt5/pyqt5-sip from common.txt — no Python 3.13 wheels and unused by Treeherder (declared by mozdetect but only needed for GUI/plotting features)
  • Upgrade zstandard 0.22.0 → 0.23.0 (0.22 fails to build on 3.13)
  • Add deprecation warning filters for datetime.utcfromtimestamp()/utcnow() (deprecated in 3.12+, TODO to migrate to timezone-aware calls)

Dependencies

Known limitations

  • mozdetect declares pyqt5 as a dependency, but PyQt5 has no Python 3.13 wheels. Since Treeherder only uses mozdetect's data analysis functions (not GUI), this is safe to skip. pip check in CI is filtered to allow this.
  • datetime.utcfromtimestamp() and datetime.utcnow() calls are suppressed via warning filters rather than migrated — there are 20+ call sites across source and tests. A follow-up PR should migrate these to datetime.fromtimestamp(ts, datetime.UTC).

Test plan

  • Full backend test suite passes (1360 passed, 2 skipped, 9 xfailed)
  • Docker dev image builds and runs on Python 3.13
  • pip check passes (with known mozdetect/pyqt5 filter)
  • CI linters pass (tox -e linters)
  • Verify production Docker image builds cleanly

🤖 Generated with Claude Code

@camd camd changed the title Upgrade Python 3.10 to 3.13 BE3: Upgrade Python 3.10 to 3.13 Mar 22, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.55%. Comparing base (f746007) to head (2a8023a).

Additional details and impacted files
@@                          Coverage Diff                           @@
##           camd/back-end-package-upgrade-phase-2    #9321   +/-   ##
======================================================================
  Coverage                                  82.55%   82.55%           
======================================================================
  Files                                        616      616           
  Lines                                      35312    35312           
  Branches                                    3323     3313   -10     
======================================================================
+ Hits                                       29152    29153    +1     
+ Misses                                      5816     5815    -1     
  Partials                                     344      344           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@camd camd changed the title BE3: Upgrade Python 3.10 to 3.13 Phase 3: Upgrade Python 3.10 to 3.13 Mar 23, 2026
@gmierz
Copy link
Copy Markdown
Collaborator

gmierz commented Apr 9, 2026

Just want to make a note here that I've filed an issue in mozdetect to get rid of pyqt there, I checked and even with the new graphing capabilities, we don't need to have those to build the graph: gmierz/mozdetect#3

@camd camd changed the title Phase 3: Upgrade Python 3.10 to 3.13 Backed 3: Upgrade Python 3.10 to 3.13 Apr 12, 2026
@camd camd changed the title Backed 3: Upgrade Python 3.10 to 3.13 Backend 3: Upgrade Python 3.10 to 3.13 Apr 12, 2026
camd and others added 8 commits April 12, 2026 10:42
…h freezegun, update pytest-asyncio

- pytest-asyncio: 1.2.0 → 1.3.0 (prepares for Python 3.11+ compatibility)
- pytest-freezegun (unmaintained fork) → freezegun 1.5.5 (direct usage with
  custom marker fixture)
- betamax 0.9.0 + betamax-serializers → vcrpy 8.1.1 (actively maintained
  HTTP cassette library)
- Converted 12 betamax JSON cassettes to VCR.py YAML format
- Added freeze_time marker fixture in conftest to replace pytest-freezegun plugin
- Registered freeze_time marker in setup.cfg

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Requirements were compiled on Python 3.13 where tomli, exceptiongroup,
and backports-asyncio-runner are stdlib/unnecessary. On Python 3.10
(used by CI and Docker), these are required transitive deps. Add them
with hashes so pip check passes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…h freezegun, update pytest-asyncio

- pytest-asyncio: 1.2.0 → 1.3.0 (prepares for Python 3.11+ compatibility)
- pytest-freezegun (unmaintained fork) → freezegun 1.5.5 (direct usage with
  custom marker fixture)
- betamax 0.9.0 + betamax-serializers → vcrpy 8.1.1 (actively maintained
  HTTP cassette library)
- Converted 12 betamax JSON cassettes to VCR.py YAML format
- Added freeze_time marker fixture in conftest to replace pytest-freezegun plugin
- Registered freeze_time marker in setup.cfg

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Django 5.2 is the latest LTS release (supported until April 2028).
No code changes required - the codebase was already compatible.
System checks pass cleanly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update Docker images to python:3.13-slim-bookworm / python:3.13-bookworm
- Update CI to cimg/python:3.13-node
- Update ruff target-version to py313, tox envlist to py313
- Fix dev.Dockerfile: netcat -> netcat-openbsd (Bookworm), ENV format
- Remove Python 3.10 backport deps (backports-asyncio-runner, exceptiongroup, tomli)
- Add setuptools to dev.txt (removed from stdlib in 3.13)
- Remove pyqt5/pyqt5-qt5/pyqt5-sip (no 3.13 wheels, unused by Treeherder)
- Upgrade zstandard 0.22.0 -> 0.23.0 (0.22 doesn't build on 3.13)
- Add deprecation warning filters for datetime.utcfromtimestamp/utcnow
- Filter pip check for known mozdetect/pyqt5 incompatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
numpy 1.26.4 has no prebuilt wheel for Python 3.13, causing the
Docker build to fail when trying to compile from source without g++.
numpy 2.2.6 ships cp313 wheels for all platforms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ruff's UP017 rule enforces using datetime.UTC (available since
Python 3.11) instead of datetime.timezone.utc when targeting py313.
Also removes the now-unused timezone imports (F401).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@camd camd force-pushed the camd/back-end-package-upgrade-phase-2 branch from 0ae2e99 to f746007 Compare April 13, 2026 01:06
@camd camd requested a review from a team as a code owner April 13, 2026 01:06
@camd camd force-pushed the camd/back-end-package-upgrade-phase-3 branch from 790634e to 2a8023a Compare April 13, 2026 01:07
Base automatically changed from camd/back-end-package-upgrade-phase-2 to master April 21, 2026 17:00
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.

3 participants