fix(python): upgrade pydantic to 2.12 for Python 3.14 compatibility#421
Merged
fix(python): upgrade pydantic to 2.12 for Python 3.14 compatibility#421
Conversation
pydantic-core 2.33.2 used pyo3 0.24.1 which capped Python support at 3.13. After upgrading .python-version to 3.14 in #419, Cloud Build failed because pydantic-core could not compile its Rust extension. Upgrade pydantic to ^2.12.0 (pinning pydantic-core to 2.41.5 which ships pre-built Python 3.14 wheels) so no Rust compilation is needed. Also update pydantic-settings to ^2.12.0 to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Upgrades the Python service’s Pydantic stack to versions that include prebuilt pydantic-core wheels for CPython 3.14 to unblock Cloud Build, and refreshes generated dependency artifacts accordingly.
Changes:
- Add
pydantic ^2.12.0as an explicit dependency and bumppydantic-settingsto^2.12.0 - Regenerate
poetry.lockandrequirements.txtto resolve topydantic 2.12.5/pydantic-core 2.41.5 - Add a
src/python/cloudbuild.yamlto build/deploy the Python service via Cloud Build + Cloud Run
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/python/pyproject.toml | Pins Pydantic/Pydantic-settings versions to the 2.12 line for Python 3.14 compatibility. |
| src/python/poetry.lock | Updates locked transitive versions (notably pydantic-core) to versions with CPython 3.14 wheels. |
| src/python/requirements.txt | Refreshes exported/pinned requirements to match the new lock resolution. |
| src/python/cloudbuild.yaml | Introduces Cloud Build configuration to build, push, and deploy the Python API. |
Comment on lines
+1
to
+3
| steps: | ||
| - name: gcr.io/k8s-skaffold/pack | ||
| args: |
There was a problem hiding this comment.
This PR adds a new src/python/cloudbuild.yaml (Cloud Build/Cloud Run deployment config), but the PR description only mentions dependency/lockfile updates. Please update the PR description (or add an inline comment) to explain why this file is being introduced and how it’s intended to be used (e.g., new trigger, replacing an existing build config, etc.).
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.
Summary
pydantic = "^2.12.0"as a direct dependency to force the upgrade from 2.11.xpydantic-settingsto^2.12.0to stay in syncpoetry.lock(pydantic → 2.12.5, pydantic-core → 2.41.5) andrequirements.txtProblem
After #419 updated
.python-versionto3.14, Cloud Build started failing becausepydantic-core==2.33.2usespyo3 v0.24.1, which has a hard cap of Python 3.13. The build tried to compile the Rust extension from source and failed with:Fix
pydantic-core 2.41.5(released Nov 2025) ships pre-built wheels for CPython 3.14, so no Rust compilation is needed during the Cloud Build. This is tied topydantic 2.12, which is the first pydantic release with official Python 3.14 support.Test plan
poetry run pytestpasses locally🤖 Generated with Claude Code