Skip to content

fix(python): upgrade pydantic to 2.12 for Python 3.14 compatibility#421

Merged
davideme merged 1 commit intomainfrom
python-fix-pydantic-python314-support
Feb 24, 2026
Merged

fix(python): upgrade pydantic to 2.12 for Python 3.14 compatibility#421
davideme merged 1 commit intomainfrom
python-fix-pydantic-python314-support

Conversation

@davideme
Copy link
Owner

Summary

  • Add pydantic = "^2.12.0" as a direct dependency to force the upgrade from 2.11.x
  • Update pydantic-settings to ^2.12.0 to stay in sync
  • Regenerate poetry.lock (pydantic → 2.12.5, pydantic-core → 2.41.5) and requirements.txt

Problem

After #419 updated .python-version to 3.14, Cloud Build started failing because pydantic-core==2.33.2 uses pyo3 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:

error: the configured Python interpreter version (3.14) is newer than PyO3's maximum supported version (3.13)

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 to pydantic 2.12, which is the first pydantic release with official Python 3.14 support.

Test plan

  • Cloud Build completes successfully with Python 3.14
  • poetry run pytest passes locally

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings February 24, 2026 11:17
@davideme davideme merged commit aac7108 into main Feb 24, 2026
6 checks passed
@davideme davideme deleted the python-fix-pydantic-python314-support branch February 24, 2026 11:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.0 as an explicit dependency and bump pydantic-settings to ^2.12.0
  • Regenerate poetry.lock and requirements.txt to resolve to pydantic 2.12.5 / pydantic-core 2.41.5
  • Add a src/python/cloudbuild.yaml to 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:
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

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.).

Copilot uses AI. Check for mistakes.
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.

2 participants