Skip to content

Relax pydantic upper bound to support Python 3.14#333

Open
sporkd wants to merge 2 commits into
pathintegral-institute:mainfrom
sporkd:fix/relax-pydantic-upper-bound
Open

Relax pydantic upper bound to support Python 3.14#333
sporkd wants to merge 2 commits into
pathintegral-institute:mainfrom
sporkd:fix/relax-pydantic-upper-bound

Conversation

@sporkd

@sporkd sporkd commented May 7, 2026

Copy link
Copy Markdown

Summary

mcpm cannot be installed on Python 3.14 (the current stable release) because the pydantic dependency is constrained to <2.12.0, which forces resolution to a pydantic-core version that has no pre-built wheels for Python 3.14 and cannot be compiled from source.

Dependency chain causing the failure:

  1. pyproject.toml specifies pydantic>=2.5.1,<2.12.0
  2. This resolves to pydantic==2.11.10pydantic-core==2.33.2
  3. pydantic-core==2.33.2 has no pre-built wheels for cp314 on any platform
  4. Building from source fails because its Rust dependencies (PyO3 0.24.1, jiter 0.9.0) use CPython C APIs (PyUnicode_New, PyUnicode_KIND, PyUnicode_DATA) that were removed in Python 3.14

Why this fix works:

pydantic>=2.13 depends on pydantic-core>=2.46, which ships pre-built wheels for Python 3.14. Homebrew's mcpm 2.14.0 formula already packages mcpm against pydantic 2.13.3 without issues.

Change: pydantic>=2.5.1,<2.12.0pydantic>=2.5.1,<3.0

Build failure on Python 3.14

error[E0425]: cannot find function `PyUnicode_New` in module `pyo3::ffi`
  --> .../jiter-0.9.0/src/py_string_cache.rs:217:26

error[E0425]: cannot find function `PyUnicode_KIND` in module `pyo3::ffi`
  --> .../jiter-0.9.0/src/py_string_cache.rs:219:33

💥 maturin failed
  Caused by: Failed to build a native library through cargo

help: `pydantic-core` (v2.33.2) was included because `mcpm` (v2.14.0)
      depends on `pydantic` (v2.11.10) which depends on `pydantic-core`

Summary by CodeRabbit

  • Chores
    • Updated dependency version constraints to support newer compatible versions.

The `<2.12.0` constraint forces resolution to pydantic 2.11.x, which
depends on pydantic-core 2.33.x. That version has no pre-built wheels
for Python 3.14 and cannot compile from source (PyO3 0.24.1 / jiter
0.9.0 use CPython C APIs removed in 3.14).

pydantic >=2.13 depends on pydantic-core >=2.46 which ships cp314
wheels. Homebrew already packages mcpm 2.14.0 against pydantic 2.13.3
without issues.
Copilot AI review requested due to automatic review settings May 7, 2026 18:21
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0f8995ae-25d8-4ceb-8a87-e433b0cec860

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

A single dependency constraint update that widens Pydantic support from versions <2.12.0 to <3.0, allowing compatibility with newer Pydantic releases while maintaining the minimum version requirement at >=2.5.1.

Changes

Pydantic Dependency Update

Layer / File(s) Summary
Dependency Constraint Update
pyproject.toml
Pydantic version constraint is widened from >=2.5.1,<2.12.0 to >=2.5.1,<3.0 to support newer minor and patch releases up to major version 3.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • pathintegral-institute/mcpm.sh#272: Both PRs modify the same pydantic dependency constraint in pyproject.toml; PR #272 pins it to <2.12.0 while this PR widens it to <3.0.

Suggested labels

Review effort 1/5

Suggested reviewers

  • GabrielDrapor

Poem

🐰 A hop toward tomorrow's grace,
Pydantic's bounds now find new space,
From 2.12's wall, we leap ahead,
To 3.0's horizon, softly led!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: relaxing the pydantic upper bound to support Python 3.14, which matches the core modification in pyproject.toml.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Relax pydantic upper bound to support Python 3.14

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Relax pydantic upper bound constraint to <3.0
• Enable installation on Python 3.14 with pydantic-core wheels
• Resolve build failures from removed CPython C APIs
• Align with Homebrew's mcpm 2.14.0 packaging
Diagram
flowchart LR
  A["pydantic constraint<br/>2.5.1,&lt;2.12.0"] -->|"resolves to"| B["pydantic 2.11.x<br/>+ pydantic-core 2.33.x"]
  B -->|"no cp314 wheels<br/>build fails"| C["❌ Python 3.14<br/>installation fails"]
  D["pydantic constraint<br/>2.5.1,&lt;3.0"] -->|"resolves to"| E["pydantic 2.13+<br/>+ pydantic-core 2.46+"]
  E -->|"has cp314 wheels"| F["✅ Python 3.14<br/>installation works"]
Loading

Grey Divider

File Changes

1. pyproject.toml Dependencies +1/-1

Relax pydantic upper bound constraint

• Updated pydantic dependency constraint from >=2.5.1,<2.12.0 to >=2.5.1,<3.0
• Allows resolution to pydantic 2.13+ which includes pydantic-core 2.46+ with Python 3.14 wheels
• Resolves build failures caused by removed CPython C APIs in Python 3.14

pyproject.toml


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. uv.lock still pins pydantic ✓ Resolved 🐞 Bug ☼ Reliability
Description
pyproject.toml now allows pydantic<3.0, but uv.lock still requires pydantic<2.12.0 and pins
pydantic==2.11.7 / pydantic-core==2.33.2. Since CI runs uv sync, environments using the
lockfile will continue to install the old pydantic stack (and won’t benefit from the Python 3.14
fix).
Code

pyproject.toml[27]

+    "pydantic>=2.5.1,<3.0",
Evidence
The PR changes the pydantic constraint only in pyproject.toml, but the committed uv.lock still
contains the old specifier and resolved versions; CI uses uv sync, which relies on uv.lock for
dependency resolution.

pyproject.toml[22-31]
uv.lock[945-965]
uv.lock[1250-1274]
.github/workflows/test.yml[26-42]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The dependency constraint was updated in `pyproject.toml`, but `uv.lock` still reflects the previous pydantic constraint and pins older pydantic/pydantic-core versions. Any workflow using `uv sync` will keep using the stale lock content.
### Issue Context
CI executes `uv sync --group dev`, so the lockfile must be updated to match the new dependency range.
### Fix Focus Areas
- pyproject.toml[22-31]
- uv.lock[945-965]
- uv.lock[1250-1274]
- .github/workflows/test.yml[26-42]
### What to do
1. Run `uv lock` (or the repo’s standard lock regeneration command) after the `pyproject.toml` change.
2. Ensure the resulting `uv.lock` updates the `requires-dist` entry for pydantic to `>=2.5.1,<3.0` and refreshes the resolved `pydantic` / `pydantic-core` versions accordingly.
3. Commit the updated `uv.lock` in this PR.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

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 updates mcpm’s pydantic version constraint to allow newer Pydantic 2.x releases, unblocking installation on Python 3.14 by enabling resolution to pydantic-core versions that ship prebuilt cp314 wheels.

Changes:

  • Relax pydantic upper bound from <2.12.0 to <3.0 in pyproject.toml.

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

Comment thread pyproject.toml
Comment on lines 24 to 28
"rich>=12.0.0",
"rich-click>=1.8.0",
"requests>=2.28.0",
"pydantic>=2.5.1,<2.12.0",
"pydantic>=2.5.1,<3.0",
"mcp>=1.8.0",
Comment thread pyproject.toml
Run `uv lock --upgrade-package pydantic --upgrade-package pydantic-core`
to resolve pydantic 2.13.4 and pydantic-core 2.46.4, which ship
pre-built wheels for Python 3.14.
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