Skip to content

workflows: add build-litellm.yml for riscv64 manywheel builds - #299

Merged
luhenry merged 3 commits into
mainfrom
litellm
Aug 24, 2026
Merged

workflows: add build-litellm.yml for riscv64 manywheel builds#299
luhenry merged 3 commits into
mainfrom
litellm

Conversation

@luhenry

@luhenry luhenry commented Aug 21, 2026

Copy link
Copy Markdown
Member

What

Adds .github/workflows/build-litellm.yml to build litellm 1.97.0 riscv64 wheels and publish them to pypi.riseproject.dev.

Why litellm is special

As of the 1.9x line, litellm is no longer pure-Python: its build backend is maturin and it ships a PyO3/Rust extension (litellm.rust_bridge._native, crate at litellm-rust/crates/python-bridge). The pyo3 crate enables abi3-py310, so upstream publishes exactly one cp310-abi3 wheel per arch (loadable on CPython 3.10–3.14) and no free-threaded wheel.

Build shape (sdist → bdist)

  • python_sdist (ubuntu-latest): builds the sdist itself from the upstream v1.97.0 checkout (never the prebuilt PyPI sdist). The sdist is self-contained and arch-independent — it bundles the committed litellm-rust/Cargo.lock (pinned crates, no floating resolve; upstream's own test-rust.yml builds --locked) and the prebuilt Next.js admin UI under litellm/proxy/_experimental/out/** — so the riscv64 bdist needs no npm/codegen.
  • build_wheels (ubuntu-24.04-riscv): a single cibuildwheel run selecting cp312/cp313/cp314. It compiles the Rust once (→ cp310-abi3 wheel), reuses that wheel for the other interpreters (find_compatible_wheel → "Skipping build step…"), and still runs the test phase on each — one wheel out, load-tested on three CPythons. cp314t is excluded (no upstream free-threaded wheel; fastuuid and other riscv64 runtime deps have no cp314t wheels yet). Rust toolchain installed via rustup in CIBW_BEFORE_ALL_LINUX; musllinux skipped (rustup ships no riscv64 musl host toolchain).
  • publish: the shared publish-wheels action (dry-runs off PR branches).

Testing

The bridge loader (litellm/rust_bridge/loader.py) swallows ImportError and returns None, so import litellm alone would pass even with a broken/missing _native. The smoke test therefore exercises the compiled extension directly: asserts native_bridge_available() is True and calls the zero-arg native _native.gil_stats().

Local validation done

  • yaml.safe_load + actionlint clean (only the expected ubuntu-24.04-riscv unknown-label warning).
  • Built the abi3 wheel locally on aarch64; confirmed the cp310-abi3 .so loads on CPython 3.12 and the exact CIBW_TEST_COMMAND runs green with the full runtime-dep chain installed.
  • Verified the full 13-dep runtime closure resolves to riscv64 wheels under --only-binary for cp312/cp313/cp314 (public PyPI + RISE registry).
  • Confirmed the crypto backend is riscv64-portable: aws-lc-sys 0.43.0 (pinned in Cargo.lock) ships a prebuilt riscv64gc_unknown_linux_gnu_crypto.rs binding at its tag, and ring 0.17.14 builds for riscv64.

🤖 Generated with Claude Code

litellm is no longer pure-Python: since the 1.9x line it builds via maturin and
ships a PyO3/Rust extension (litellm.rust_bridge._native). The pyo3 crate enables
abi3-py310, so upstream publishes a single cp310-abi3 wheel per arch (loadable on
CPython 3.10-3.14) and no free-threaded wheel.

Build shape (sdist -> bdist):
- python_sdist (ubuntu-latest): build the sdist ourselves from the upstream
  v1.97.0 checkout. It is self-contained and arch-independent - bundles the
  committed litellm-rust/Cargo.lock (pinned crates, no floating resolve) and the
  prebuilt Next.js admin UI under litellm/proxy/_experimental/out/** - so the
  riscv64 bdist needs no npm/codegen.
- build_wheels (ubuntu-24.04-riscv): one cibuildwheel run selecting
  cp312/cp313/cp314. It compiles the Rust once (-> cp310-abi3 wheel), reuses that
  wheel for the other interpreters (find_compatible_wheel "Skipping build step"),
  and still runs the test phase on each - one wheel out, load-tested on three
  CPythons. cp314t is excluded (no upstream free-threaded wheel; fastuuid and
  other riscv64 runtime deps have no cp314t wheels). Rust toolchain via rustup in
  CIBW_BEFORE_ALL_LINUX; musllinux skipped (no riscv64 musl host toolchain).
- Smoke test exercises the compiled extension directly: the bridge loader
  swallows ImportError and returns None, so it asserts native_bridge_available()
  and calls _native.gil_stats() rather than relying on `import litellm` alone.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@luhenry
luhenry requested review from justeph and threexc August 21, 2026 09:06
@luhenry

luhenry commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

@threexc @justeph could I please get a review? Thanks!

Comment thread .github/workflows/build-litellm.yml
Comment thread .github/workflows/build-litellm.yml Outdated
Comment thread .github/workflows/build-litellm.yml Outdated
Comment thread .github/workflows/build-litellm.yml Outdated
Comment thread .github/workflows/build-litellm.yml Outdated
Comment thread .github/workflows/build-litellm.yml Outdated
Comment thread .github/workflows/build-litellm.yml Outdated
Comment thread .github/workflows/build-litellm.yml Outdated
Comment thread .github/workflows/build-litellm.yml Outdated
Git tag has features=["extension-module"] (no abi3); upstream adds
abi3-py310 only at release time. Building from source produced 3
per-interpreter wheels + 3x Rust compile. Set abi3-py312 on the sdist so
maturin emits one cp312-abi3 wheel, deduped across cp312/313/314.

- use pypa/cibuildwheel action with sdist as package-dir; drop manual
  tar + uv install
- drop MANYLINUX_RISCV64_IMAGE override (cibuildwheel pins by digest)
- CIBW_BUILD "cp312 cp313 cp314" + CIBW_SKIP musllinux
- drop UV_* env and CIBW_BUILD_VERBOSITY

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread .github/workflows/build-litellm.yml Outdated
Co-authored-by: Julien Stephan <jstephan@baylibre.com>
@luhenry

luhenry commented Aug 24, 2026

Copy link
Copy Markdown
Member Author

@justeph I updated based on your review and it's green, all good to go?

@justeph justeph left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

thank you for fixing everything. LGTM

@luhenry
luhenry merged commit 486e6f1 into main Aug 24, 2026
6 checks passed
@luhenry
luhenry deleted the litellm branch August 24, 2026 09:55
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