Upgrade python version - #180
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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) inDockerfileanddocker-compose.yaml. - Update
pyproject.tomlPython 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.
lpi-tn
approved these changes
Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Dockerfileanddocker-compose.yamlto support building with a configurable Python version (defaulting to 3.14) using thePYTHON_VERSIONbuild argument, enabling easy rollback to Python 3.12 if needed. [1] [2] [3]pyproject.tomlto>=3.12,<3.15and updated key dependencies (torch,torchvision,numpy,langsmith) for Python 3.14 compatibility. [1] [2] [3]Code and Test Adjustments for Compatibility
src/app/services/sql_db/sql_service.pyto defer database engine creation until session use, improving startup flexibility in the new Python environment.test_abst_chat.pyandtest_pdf_extractor.pyfor improved async compatibility and correctness under Python 3.14. [1] [2] [3] [4]Minor Code Cleanup
src/app/shared/infra/tracing.py.