Skip to content

Phase 6: Migrate psycopg2-binary to psycopg3#9328

Open
camd wants to merge 2 commits intocamd/back-end-package-upgrade-phase-5from
camd/back-end-package-upgrade-phase-6
Open

Phase 6: Migrate psycopg2-binary to psycopg3#9328
camd wants to merge 2 commits intocamd/back-end-package-upgrade-phase-5from
camd/back-end-package-upgrade-phase-6

Conversation

@camd
Copy link
Collaborator

@camd camd commented Mar 23, 2026

Summary

  • Migrate from psycopg2-binary==2.9.11 to psycopg[binary]==3.3.3 (psycopg3)
  • Django 6.0 natively supports psycopg3 — no code changes needed since all DB access goes through Django ORM
  • psycopg3 has native Python 3.14 wheels and offers better async support

Stacked on

Test plan

  • All 1360 backend tests pass (1360 passed, 2 skipped, 9 xfailed)
  • Docker image builds successfully
  • No direct psycopg2 imports in codebase (verified with grep)

🤖 Generated with Claude Code

camd and others added 2 commits March 22, 2026 18:58
- Update Docker base images to python:3.14
- Update CircleCI to cimg/python:3.14-node
- Update tox envlist to py314
- Upgrade C extension packages for cp314 wheels:
  - numpy 2.2.6 → 2.4.3
  - scipy 1.15.1 → 1.17.1
  - contourpy 1.3.2 → 1.3.3
  - pandas 2.2.3 → 2.3.3
  - zstandard 0.23.0 → 0.25.0
  - pyarrow 19.0.0 → 23.0.1
- Fix multiprocessing.Pool deadlock: Python 3.14 defaults to
  'forkserver' start method which deadlocks inside Django;
  explicitly use 'fork' context in perfcompare API
- Silence drf-spectacular E001 check (typing._UnionGenericAlias
  deprecation on Python 3.14)
- Add pytest warning filters for Python 3.14 deprecations
- Note: ruff target-version stays at py313 (ruff doesn't support
  py314 yet)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Django 6.0 natively supports psycopg3. The codebase uses Django ORM
exclusively with no direct psycopg2 imports, making this a clean swap.
psycopg3 is actively maintained and offers better async support,
connection pooling, and Python 3.14 compatibility.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@camd camd force-pushed the camd/back-end-package-upgrade-phase-5 branch from a15f6f6 to a540437 Compare March 23, 2026 16:26
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.

1 participant