Repository navigation
Upgrade backend runtime to Python 3.13 and modernize dependencies - #270
Conversation
kargig
commented
Oct 16, 2026
- Upgrade backend base Docker images and test runners to Python 3.13.
- Publish pre-compiled cp313 and cp314 wheels for octo-deco to GitHub Release deps-v1.
- Prune unused direct dependencies (celery, redis, google-auth-oauthlib, pyasn1), reducing installed packages from 114 to 99.
- Modernize dependencies to Python 3.13-compatible versions (pydantic 2.14, anyio 4.15, uvicorn 0.54, orjson 3.13, pillow 12.3, pytest 9).
- Refactor legacy Pydantic V1 class Config blocks to model_config = ConfigDict(from_attributes=True) across schemas.
- Adopt itertools.batched(..., strict=False) for C-accelerated batching.
- Migrate deprecated datetime.utcnow() to timezone-aware datetime.now(UTC) and app.utils.utcnow() across the entire codebase.
- Add --skip-ssl-verify-server-cert to test MySQL client invocations for Debian 13 (Trixie) TLS compliance with self-signed test certs.
- Downgrade optional pywebpush import error to warning in Lambda worker.
- Update GitHub Actions workflow and local development environment to Python 3.13.
- Verify 100% pass rate across all 1,870 backend tests in Docker.
- Upgrade backend base Docker images and test runners to Python 3.13. - Publish pre-compiled cp313 and cp314 wheels for octo-deco to GitHub Release deps-v1. - Prune unused direct dependencies (celery, redis, google-auth-oauthlib, pyasn1), reducing installed packages from 114 to 99. - Modernize dependencies to Python 3.13-compatible versions (pydantic 2.14, anyio 4.15, uvicorn 0.54, orjson 3.13, pillow 12.3, pytest 9). - Refactor legacy Pydantic V1 class Config blocks to model_config = ConfigDict(from_attributes=True) across schemas. - Adopt itertools.batched(..., strict=False) for C-accelerated batching. - Migrate deprecated datetime.utcnow() to timezone-aware datetime.now(UTC) and app.utils.utcnow() across the entire codebase. - Add --skip-ssl-verify-server-cert to test MySQL client invocations for Debian 13 (Trixie) TLS compliance with self-signed test certs. - Downgrade optional pywebpush import error to warning in Lambda worker. - Update GitHub Actions workflow and local development environment to Python 3.13. - Verify 100% pass rate across all 1,870 backend tests in Docker.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
- Fix Ruff lint errors in backend/lambda/email_processor.py (unsorted imports, Dict to dict, Optional to | None, and bare except). - Add field_validator on AuditLogEntry.timestamp to normalize all incoming naive database timestamps to UTC, preventing sort errors between offset-naive and offset-aware datetimes.
- Format backend/lambda/email_processor.py and backend/tests/test_weather_api.py with ruff format to satisfy CI check formatting workflow. - Fix mock target in test_get_wind_data_single_point to patch app.routers.weather.fetch_wind_data_single_point instead of service, preventing live external HTTP calls and timeout failures to Open-Meteo. - Normalize audit log entry timestamps to UTC via field validator to prevent offset-naive vs offset-aware comparison errors.
Correct the backend-tests migrations step that still pointed PYTHONPATH at python3.11 after the 3.13 upgrade. Add a --warnings flag to the Docker test runner so DeprecationWarnings can be surfaced on demand, set pytest-asyncio's fixture loop scope, and filter the known Starlette/anyio BlockingPortal warning. Replace remaining datetime.utcnow() usage in tests and Pydantic .dict() calls in dive site/tag moderation paths with timezone-aware UTC and model_dump().
- Format the 8 test files modified in commit 1c8e577 to resolve the failing GitHub Actions 'Backend Lint & Format' step. - Fix import sorting, UTC alias modernization, and strict zip handling.