Skip to content

fix(build): restore pure-Python uv_build backend to unblock PyPI publish - #31470

Merged
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_yj_restore_pure_python_wheel
Jun 26, 2026
Merged

fix(build): restore pure-Python uv_build backend to unblock PyPI publish#31470
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_yj_restore_pure_python_wheel

Conversation

@yuneng-berri

Copy link
Copy Markdown
Collaborator

Relevant issues

PyPI publish failure on the 1.91.0.dev2 release: the litellm wheel was rejected by PyPI with 400 Bad Request - Binary wheel 'litellm-1.91.0.dev2-cp312-cp312-linux_x86_64.whl' has an unsupported platform tag 'linux_x86_64'.

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests — N/A, this is a build-system revert; verified by building the wheel (see Proof of Fix).
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review and received a Confidence Score of at least 4/5

Type

🐛 Bug Fix
🚄 Infrastructure

Changes

Problem. #31267 switched the build backend from uv_build to maturin to bundle the Rust OCR bridge into the litellm wheel, making litellm a compiled package. When the release builds with python -m build on a stock runner (no manylinux container), maturin defaults to --compatibility off and emits a cp312-cp312-linux_x86_64 wheel. PyPI only accepts manylinux* Linux wheels, so the upload fails and the publish is blocked.

Fix. Revert [build-system] to the pure-Python uv_build backend and restore [tool.uv.build-backend]. The release again produces a universal litellm-<ver>-py3-none-any.whl that installs on every OS / arch / Python version.

The Rust bridge remains optionallitellm/rust_bridge/loader.py already degrades gracefully when the native module is missing (try/except ImportError), so runtime behavior is unchanged; the compiled _native module is simply not bundled in the wheel. Bundling Rust into the published wheel requires a full multi-platform wheel matrix (manylinux + macOS + Windows × x86_64 + aarch64 × supported Pythons) in the release pipeline, which can be pursued separately if/when we want the native path shipped on PyPI.

Proof of Fix

Built locally with uv build --wheel:

  • Before (maturin): litellm-1.91.0.dev2-cp312-cp312-linux_x86_64.whl → rejected by PyPI (unsupported platform tag)
  • After (this PR): litellm-1.91.0-py3-none-any.whlRoot-Is-Purelib: true, Tag: py3-none-any

The pure-Python litellm/rust_bridge/ package (__init__.py, loader.py) is still included in the wheel; no .so / _native extension is present, confirming the graceful pure-Python path.

Out of scope (follow-ups)

#31267 switched the build backend to maturin to bundle the Rust OCR
bridge into the litellm wheel. On the release runner, maturin builds
with `--compatibility off` and emits a `cp312-cp312-linux_x86_64`
wheel. PyPI only accepts `manylinux*` Linux wheels, so the upload is
rejected with `400 Bad Request - unsupported platform tag
'linux_x86_64'`, which blocked the 1.91.0.dev2 publish.

Revert `[build-system]` to the pure-Python `uv_build` backend and
restore `[tool.uv.build-backend]` so the release once again produces a
universal `litellm-<ver>-py3-none-any.whl` that installs on every
OS / arch / Python.

The Rust bridge stays optional: `litellm/rust_bridge/loader.py` already
falls back gracefully when `_native` is absent (`try/except
ImportError`), so runtime behavior is unchanged - the native module is
simply not bundled. Rust acceleration can ship as a separate
platform-specific package later.
@yuneng-berri
yuneng-berri requested a review from a team June 26, 2026 19:44
@greptile-apps

greptile-apps Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR reverts the [build-system] in pyproject.toml from maturin back to uv_build, restoring the pure-Python wheel (py3-none-any) that PyPI accepts. The Rust bridge code remains in the repo but is not compiled into the wheel; litellm/rust_bridge/loader.py already degrades gracefully when the native extension is absent.

  • Replaces maturin==1.9.4 with uv_build==0.11.8 and removes the now-unused [tool.maturin] stanza.
  • Restores [tool.uv.build-backend] with module-root = "" and the same file-exclusion list (pycache, pytest/ruff caches, enterprise directory).

Confidence Score: 5/5

Single-file build config change that restores the prior pure-Python wheel; no runtime logic is modified and the author has verified the wheel tag locally.

The change is a targeted revert of one build-system stanza, the proof-of-fix (py3-none-any wheel tag) is documented in the PR, and the graceful-fallback path for the Rust bridge already existed. The only minor asymmetry is the absence of the litellm/proxy/enterprise/** glob in the new source-exclude, but uv_build excludes whole directory trees when the parent path is listed, so the enterprise directory is still effectively excluded.

No files require special attention.

Important Files Changed

Filename Overview
pyproject.toml Reverts build backend from maturin to uv_build, restoring pure-Python wheel generation; source-exclude list mirrors the old maturin exclude list (minus the redundant litellm/proxy/enterprise/** glob, which is harmless as uv_build excludes whole directory trees by default)

Reviews (1): Last reviewed commit: "fix(build): restore pure-Python uv_build..." | Re-trigger Greptile

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri mateo-berri 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.

LGTM; thanks!

@yuneng-berri
yuneng-berri merged commit 5a395ef into litellm_internal_staging Jun 26, 2026
123 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_yj_restore_pure_python_wheel branch June 26, 2026 21:03
deepmindru-afk pushed a commit to deepmindru-afk/litellm that referenced this pull request Jul 4, 2026
Re-apply the maturin build backend (reverting BerriAI#31470, which had temporarily
restored the pure-Python uv_build backend). maturin packages the Rust bridge
(litellm.rust_bridge._native) into the wheel; the loader already falls back
gracefully when the native module is absent, so pure-Python installs are
unaffected.

The earlier revert was needed because the release pipeline emitted a bare
cp312 linux_x86_64 wheel that PyPI rejects. That is resolved on the pipeline
side: it now branches on the build backend and, for maturin, builds proper
manylinux_2_28 wheels (x86_64 + aarch64) and validates each wheel carries the
native module.

The [tool.maturin] include for litellm/proxy/_experimental/out/** is sdist
coverage for the Admin UI bundle. maturin's include overrides .gitignore for
the sdist but not the wheel; the committed bundle stays tracked and un-ignored,
so it flows into both the wheel (maturin's source walk) and the sdist as-is.

Coordinates with the release pipeline change that builds the Admin UI from
source and gates the built wheel/sdist on the bundle being present; that should
land first so the pipeline can build and verify a maturin UI wheel.
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.

3 participants