Skip to content

Upgrade python version - #180

Merged
jmsevin merged 14 commits into
mainfrom
upgrade-python-version
Jul 30, 2026
Merged

Upgrade python version#180
jmsevin merged 14 commits into
mainfrom
upgrade-python-version

Conversation

@jmsevin

@jmsevin jmsevin commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

This pull request implements the migration to Python 3.14, introduces a flexible container build process, and updates several dependencies for compatibility and security. Several minor code and test improvements are included to support the transition and ensure reliability.

Python 3.14 Migration and Build Improvements

  • Updated Dockerfile and docker-compose.yaml to support building with a configurable Python version (defaulting to 3.14) using the PYTHON_VERSION build argument, enabling easy rollback to Python 3.12 if needed. [1] [2] [3]
  • Changed the required Python version in pyproject.toml to >=3.12,<3.15 and updated key dependencies (torch, torchvision, numpy, langsmith) for Python 3.14 compatibility. [1] [2] [3]

Code and Test Adjustments for Compatibility

  • Refactored src/app/services/sql_db/sql_service.py to defer database engine creation until session use, improving startup flexibility in the new Python environment.
  • Updated test mocks in test_abst_chat.py and test_pdf_extractor.py for improved async compatibility and correctness under Python 3.14. [1] [2] [3] [4]

Minor Code Cleanup

  • Removed an unused blank line in src/app/shared/infra/tracing.py.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR upgrades the service’s runtime and build tooling to support Python 3.14 (while keeping rollback compatibility with Python 3.12), updates key Python dependencies accordingly, and adds an operational runbook + baseline tooling to support safe rollout.

Changes:

  • Make container builds configurable via PYTHON_VERSION (default 3.14) in Dockerfile and docker-compose.yaml.
  • Update pyproject.toml Python constraint and bump several dependencies for compatibility/security.
  • Add migration runbooks/scripts and adjust a few tests + SQL session initialization behavior to better support the migration.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Dockerfile Adds PYTHON_VERSION build arg and uses it for base images to enable easy Python version switching.
docker-compose.yaml Forwards PYTHON_VERSION as a build arg with a default of 3.14 for local/dev parity.
pyproject.toml Updates supported Python range and bumps core dependencies for the migration.
src/app/services/sql_db/sql_service.py Defers singleton DB engine/session factory instantiation until the first session request.
src/app/tests/services/test_abst_chat.py Fixes async mocks to return correct values and improves stream/non-stream mock behavior.
src/app/tests/services/test_pdf_extractor.py Adjusts HTTP response mocking to match the sync .json() usage in implementation.
src/app/shared/infra/tracing.py Removes an unused blank line (cleanup).
migration/python-3.14/phase0-baseline.md Documents a Python 3.12 baseline snapshot to compare against post-migration.
migration/python-3.14/phase0_collect_baseline.sh Adds a script to automate baseline lint/test/startup checks and artifact capture.
migration/python-3.14/phase4-cutover.md Documents container cutover and rollback build/tagging procedures.
migration/python-3.14/phase5-rollout.md Provides a rollout/observability/rollback runbook for staged + production deployments.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jmsevin
jmsevin merged commit 8551ab4 into main Jul 30, 2026
3 checks passed
@jmsevin
jmsevin deleted the upgrade-python-version branch July 30, 2026 13:11
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