Skip to content

build(rust): bump pyo3 and pyo3-async-runtimes to 0.29 - #33122

Closed
mckornfield wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
mckornfield:update-pyo3-for-py314/mck
Closed

build(rust): bump pyo3 and pyo3-async-runtimes to 0.29#33122
mckornfield wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
mckornfield:update-pyo3-for-py314/mck

Conversation

@mckornfield

@mckornfield mckornfield commented Jul 13, 2026

Copy link
Copy Markdown

Relevant issues

Closes #33116

Linear ticket

N/A

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

pyo3 0.23.5 only supported Python up to 3.13, blocking installation on Python 3.14 with a compile-time error. Update to 0.29.0 (current release), which adds native Python 3.14 support.

pyo3 0.29 renamed two APIs: Python::with_gil -> Python::attach and py.allow_threads -> py.detach (driven by Python 3.13+ free-threaded mode making 'GIL' a misnomer). Update the two call sites accordingly.

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

@mckornfield
mckornfield requested a review from a team July 13, 2026 21:20
@CLAassistant

CLAassistant commented Jul 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…-python

pyo3 0.23.5 only supported Python up to 3.13, blocking installation on
Python 3.14 with a compile-time error. Update to 0.29.0 (current
release), which adds native Python 3.14 support.

pyo3 0.29 renamed two APIs: Python::with_gil -> Python::attach and
py.allow_threads -> py.detach (driven by Python 3.13+ free-threaded
mode making 'GIL' a misnomer). Update the two call sites accordingly.

Drop the <3.14 upper bound from requires-python; no reason to block
future Python versions preemptively. The per-package markers gating
redisvl, semantic-router, etc. on python_version < '3.14' are separate
issues with those individual packages and left unchanged.

Closes BerriAI#33116
@mckornfield
mckornfield force-pushed the update-pyo3-for-py314/mck branch from bbf649e to e10a3fb Compare July 13, 2026 21:23
@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR upgrades pyo3 and pyo3-async-runtimes from 0.23.x to 0.29.0 to gain native Python 3.14 support, applies the two required API renames (Python::with_gilPython::attach, py.allow_threadspy.detach), and drops the <3.14 upper bound from requires-python.

  • The Rust-side changes (all three crate files) correctly apply the pyo3 0.28+ renames; no other breaking API changes from the 0.23→0.29 migration affect this codebase.
  • The pyproject.toml also removes the python_version < '3.14' guards from pypdf and openapi-core (dev), which is consistent with the stated goal, but the redisvl entry additionally bumps its minimum floor from 0.4.1 to 0.23.0 without any mention in the PR description — existing users on Python 3.10–3.13 relying on older redisvl releases would be forced to upgrade.

Confidence Score: 4/5

Safe to merge after verifying the redisvl minimum version change is intentional or reverting it to 0.4.1.

All Rust changes are mechanical and correct — the two pyo3 renames are the only call-site updates required for the 0.23→0.29 migration and are applied consistently across every usage. The Python packaging side is mostly fine, but the redisvl entry quietly bumps its floor from 0.4.1 to 0.23.0 without mention in the PR description; this could force a significant upgrade on existing Python 3.10–3.13 users who rely on any redisvl version between those two points.

pyproject.toml — specifically the redisvl minimum version change at line 92.

Important Files Changed

Filename Overview
litellm-rust/Cargo.toml Bumps pyo3 from 0.23.5 to 0.29.0 and pyo3-async-runtimes from 0.23.0 to 0.29.0; versions are aligned correctly.
litellm-rust/crates/ai-gateway/src/python/config.rs Renames Python::with_gil to Python::attach (pyo3 0.28+ API) and updates module-level comment; correct.
litellm-rust/crates/python-bridge/src/gil.rs Renames py.allow_threads to py.detach (pyo3 0.28+ API) and updates doc comment; correct.
litellm-rust/crates/python-bridge/src/lib.rs Renames Python::with_gil to Python::attach inside async future closure; correct.
pyproject.toml Removes requires-python upper bound, removes python_version guards from pypdf/openapi-core, and modifies redisvl entry — both removing the python_version guard and bumping the minimum from 0.4.1 to 0.23.0, which is undocumented in the PR description and could break existing installations.

Comments Outside Diff (1)

  1. pyproject.toml, line 92 (link)

    P1 The redisvl minimum version is quietly bumped from 0.4.1 to 0.23.0 — a jump of roughly 19 minor releases — while the PR description explicitly states these per-package markers are "left unchanged." Users on Python 3.10–3.13 who have redisvl anywhere between 0.4.1 and 0.22.x installed will see their environment broken on the next pip install --upgrade litellm[extra_proxy]. If the intent is only to add Python 3.14 support, the python_version guard can simply be removed while keeping the existing floor.

Reviews (1): Last reviewed commit: "build(rust): bump pyo3 and pyo3-async-ru..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing mckornfield:update-pyo3-for-py314/mck (e10a3fb) with litellm_internal_staging (0c376d8)

Open in CodSpeed

@mckornfield mckornfield changed the title build(rust): bump pyo3 and pyo3-async-runtimes to 0.29, remove <3.14 build(rust): bump pyo3 and pyo3-async-runtimes to 0.29 Jul 13, 2026
@mckornfield

Copy link
Copy Markdown
Author

already done in #33798

@mckornfield
mckornfield deleted the update-pyo3-for-py314/mck branch July 27, 2026 18:54
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.

[Bug]: Python 3.14 install fails because litellm-rust uses PyO3 0.23.5

2 participants