build: restore maturin backend to bundle the Rust bridge in the wheel - #32097
Conversation
Re-apply the maturin build backend (reverting #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.
Greptile SummaryThis PR restores
Confidence Score: 4/5Safe to merge once the companion release-pipeline change has landed; merging in isolation risks publishing a wheel without the native-module gate. The pyproject.toml change itself is mechanically correct — the Cargo.toml exists, pyo3 bindings are appropriate, and the exclude globs are at least as strict as the ones they replace. The only real concern is the stated sequencing dependency: the release pipeline must be updated to build manylinux maturin wheels and validate their contents before this backend flip goes live. If that pipeline change is already merged, this PR is straightforwardly safe. If not, the first release after this merges could emit an unvalidated wheel. pyproject.toml — verify the companion pipeline change is merged before this lands
|
| Filename | Overview |
|---|---|
| pyproject.toml | Switches the build backend from uv_build==0.11.8 to maturin==1.9.4, adds [tool.maturin] config pointing at the Rust bridge crate, and removes the [tool.uv.build-backend] section; the referenced Cargo.toml exists and the loader.py graceful-fallback path is unaffected |
Reviews (1): Last reviewed commit: "build: restore maturin backend to bundle..." | Re-trigger Greptile
| requires = ["maturin==1.9.4"] | ||
| build-backend = "maturin" |
There was a problem hiding this comment.
Merge ordering dependency not enforced
The PR description explicitly states that the companion release-pipeline change (which builds the Admin UI from source and gates the wheel on containing the native module) must land before this PR. If this pyproject.toml flip merges first, the existing pipeline will attempt a maturin build but lack the validation logic, meaning a malformed or UI-less wheel could be published to PyPI before the gate is in place. Consider blocking this PR in the merge queue until the pipeline PR is confirmed merged, or adding a CI step here that fails if the pipeline does not already support maturin wheels.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
The only real concern is the stated sequencing dependency: the release pipeline must be updated to build manylinux maturin wheels and validate their contents before this backend flip goes live. If that pipeline change is already merged, this PR is straightforwardly safe. If not, the first release after this merges could emit an unvalidated wheel.
Is this a valid concern?
I see the in-tandem project releaser pr and it seems ready
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewDelays 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
Local build with
maturin==1.9.4(the pin the release pipeline uses) against Python 3.13, confirming the wheel carries both the native Rust module and the committed Admin UI bundle:Type
🚄 Infrastructure
Changes
Re-applies the maturin build backend (reversing #31470, which had temporarily restored the pure-Python
uv_buildbackend). maturin packages the Rust bridge (litellm.rust_bridge._native) into the wheel;litellm/rust_bridge/loader.pyalready falls back gracefully when the native module is absent, so pure-Python installs are unaffectedThe earlier revert was needed because the release pipeline emitted a bare
cp312linux_x86_64wheel that PyPI rejects. That is resolved on the pipeline side: it now branches on the build backend and, for maturin, builds propermanylinux_2_28wheels (x86_64 + aarch64) and validates each wheel carries the native module, so maturin wheels are PyPI-acceptable again. Thematurin==1.9.4pin here matches the pin the manylinux build path installsThe
[tool.maturin] include = ["litellm/proxy/_experimental/out/**"]line is sdist coverage for the Admin UI bundle. maturin'sincludeoverrides.gitignorefor the sdist but not for the wheel, so it is not wheel protection;litellm/proxy/_experimental/out/stays committed and un-ignored, which is what puts the bundle into the wheel (maturin's python-source walk) and the sdist. No.gitignorechanges and no bundle-cleanup are part of this PRCoordination: this pairs with the release-pipeline change that builds the Admin UI from source and adds an offline gate on the built wheel/sdist for the bundle. That change should land first so the pipeline can build and verify a maturin UI wheel before this flips the backend to maturin