mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
build(rust): move workspace to repository root
This commit is contained in:
parent
9bbb869b13
commit
86bccda71c
9 changed files with 38 additions and 29 deletions
|
|
@ -51,7 +51,7 @@ build/
|
|||
**/node_modules
|
||||
ui/litellm-dashboard/.next
|
||||
ui/litellm-dashboard/out
|
||||
litellm-rust/target/
|
||||
target/
|
||||
litellm/rust_bridge/_native*.so
|
||||
*.log
|
||||
.env
|
||||
|
|
|
|||
4
.github/actions/cache-cargo-build/action.yml
vendored
4
.github/actions/cache-cargo-build/action.yml
vendored
|
|
@ -24,7 +24,7 @@ runs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
litellm-rust/target
|
||||
key: ${{ runner.os }}-maturin-dev-${{ hashFiles('litellm-rust/Cargo.lock') }}
|
||||
target
|
||||
key: ${{ runner.os }}-maturin-dev-${{ hashFiles('Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maturin-dev-
|
||||
|
|
|
|||
14
.github/workflows/test-rust.yml
vendored
14
.github/workflows/test-rust.yml
vendored
|
|
@ -21,6 +21,9 @@ on:
|
|||
- "pyproject.toml"
|
||||
- "uv.lock"
|
||||
- "rust-toolchain.toml"
|
||||
- "rustfmt.toml"
|
||||
- "Cargo.toml"
|
||||
- "Cargo.lock"
|
||||
- ".github/actions/setup-uv-with-retries/**"
|
||||
- ".github/scripts/smoke_test_native_wheel.py"
|
||||
- ".github/scripts/verify_linux_native_wheel.py"
|
||||
|
|
@ -51,6 +54,9 @@ on:
|
|||
- "pyproject.toml"
|
||||
- "uv.lock"
|
||||
- "rust-toolchain.toml"
|
||||
- "rustfmt.toml"
|
||||
- "Cargo.toml"
|
||||
- "Cargo.lock"
|
||||
- ".github/actions/setup-uv-with-retries/**"
|
||||
- ".github/scripts/smoke_test_native_wheel.py"
|
||||
- ".github/scripts/verify_linux_native_wheel.py"
|
||||
|
|
@ -88,8 +94,8 @@ jobs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
litellm-rust/target
|
||||
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('rust-toolchain.toml', '.cargo/**', 'litellm-rust/Cargo.lock') }}
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('rust-toolchain.toml', '.cargo/**', 'Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-${{ github.job }}-
|
||||
|
||||
|
|
@ -123,8 +129,8 @@ jobs:
|
|||
path: |
|
||||
~/.cargo/registry
|
||||
~/.cargo/git
|
||||
litellm-rust/target
|
||||
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('rust-toolchain.toml', '.cargo/**', 'litellm-rust/Cargo.lock') }}
|
||||
target
|
||||
key: ${{ runner.os }}-cargo-${{ github.job }}-${{ hashFiles('rust-toolchain.toml', '.cargo/**', 'Cargo.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cargo-${{ github.job }}-
|
||||
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -18,7 +18,7 @@ __pycache__/
|
|||
# Rust bridge build artifacts (compiled, platform-specific; regenerated by maturin/cargo)
|
||||
litellm/rust_bridge/_native*.so
|
||||
litellm/rust_bridge/_native*.pyd
|
||||
litellm-rust/target/
|
||||
/target/
|
||||
|
||||
# Python package build output
|
||||
dist/
|
||||
|
|
|
|||
0
litellm-rust/Cargo.lock → Cargo.lock
generated
0
litellm-rust/Cargo.lock → Cargo.lock
generated
|
|
@ -1,17 +1,16 @@
|
|||
[workspace]
|
||||
members = [
|
||||
"crates/core",
|
||||
"crates/token-counter",
|
||||
"crates/config",
|
||||
"crates/ai-gateway",
|
||||
"crates/python-interop",
|
||||
"crates/python-bridge",
|
||||
"litellm-rust/crates/core",
|
||||
"litellm-rust/crates/token-counter",
|
||||
"litellm-rust/crates/config",
|
||||
"litellm-rust/crates/ai-gateway",
|
||||
"litellm-rust/crates/python-interop",
|
||||
"litellm-rust/crates/python-bridge",
|
||||
]
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
edition = "2024"
|
||||
rust-version = "1.88"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/BerriAI/litellm"
|
||||
|
||||
|
|
@ -19,11 +18,11 @@ repository = "https://github.com/BerriAI/litellm"
|
|||
bytes = "1"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = { version = "0.3", default-features = false, features = ["registry", "std"] }
|
||||
litellm-core = { path = "crates/core" }
|
||||
litellm-token-counter = { path = "crates/token-counter" }
|
||||
litellm-config = { path = "crates/config" }
|
||||
litellm-ai-gateway = { path = "crates/ai-gateway", default-features = false }
|
||||
litellm-python-interop = { path = "crates/python-interop" }
|
||||
litellm-core = { path = "litellm-rust/crates/core" }
|
||||
litellm-token-counter = { path = "litellm-rust/crates/token-counter" }
|
||||
litellm-config = { path = "litellm-rust/crates/config" }
|
||||
litellm-ai-gateway = { path = "litellm-rust/crates/ai-gateway", default-features = false }
|
||||
litellm-python-interop = { path = "litellm-rust/crates/python-interop" }
|
||||
axum = "0.7"
|
||||
pyo3 = "0.29.2"
|
||||
pyo3-async-runtimes = { version = "0.29.0", features = ["tokio-runtime"] }
|
||||
|
|
@ -2,8 +2,7 @@
|
|||
#
|
||||
# Build context is the **repo root** so we can install `litellm` from this repo's
|
||||
# source (the gateway loads its model_list via litellm.proxy.read_model_list,
|
||||
# which is not in any PyPI release yet) AND build the rust workspace under
|
||||
# litellm-rust/.
|
||||
# which is not in any PyPI release yet) AND build the Rust workspace.
|
||||
#
|
||||
# docker build -f litellm-rust/crates/ai-gateway/Dockerfile -t litellm-ai-gateway .
|
||||
#
|
||||
|
|
@ -21,8 +20,8 @@ ENV PYO3_PYTHON=python3.11
|
|||
# rustup reads rust-toolchain.toml from any parent of the working directory, so
|
||||
# copying it in is what keeps every cargo call below on the repo's pinned
|
||||
# channel rather than on whatever the base image happens to ship.
|
||||
COPY rust-toolchain.toml /build/rust-toolchain.toml
|
||||
WORKDIR /build/litellm-rust
|
||||
COPY rust-toolchain.toml Cargo.toml Cargo.lock /build/
|
||||
WORKDIR /build
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
python3 python3-dev python3-pip pkg-config libssl-dev clang \
|
||||
|
|
@ -30,9 +29,9 @@ RUN apt-get update \
|
|||
&& cargo install cargo-chef --locked --version 0.1.77
|
||||
|
||||
# ---- Planner ----------------------------------------------------------------
|
||||
# Produce the dependency recipe from the rust workspace manifests + Cargo.lock.
|
||||
# Produce the dependency recipe from the Rust workspace manifests + Cargo.lock.
|
||||
FROM chef AS planner
|
||||
COPY litellm-rust/ .
|
||||
COPY litellm-rust/ /build/litellm-rust/
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
# ---- Builder ----------------------------------------------------------------
|
||||
|
|
@ -45,7 +44,7 @@ RUN cargo chef cook --locked --release \
|
|||
--recipe-path recipe.json
|
||||
# Now copy the real sources and build the gateway binary. Deps are already cooked
|
||||
# above, so this step only recompiles the gateway crate.
|
||||
COPY litellm-rust/ .
|
||||
COPY litellm-rust/ /build/litellm-rust/
|
||||
RUN cargo build --locked --release -p litellm-ai-gateway --bin litellm-ai-gateway --features server,python-config
|
||||
|
||||
# The root pyproject builds with maturin against litellm-rust/crates/python-bridge,
|
||||
|
|
@ -87,7 +86,7 @@ RUN wheel="$(ls /tmp/wheels/litellm-*.whl)" \
|
|||
|
||||
# The compiled gateway binary (pure-Rust realtime hot path; Python is load-time
|
||||
# only).
|
||||
COPY --from=builder /build/litellm-rust/target/release/litellm-ai-gateway /usr/local/bin/litellm-ai-gateway
|
||||
COPY --from=builder /build/target/release/litellm-ai-gateway /usr/local/bin/litellm-ai-gateway
|
||||
|
||||
# Default config.yaml. A real deploy can override this (e.g. mount a Render
|
||||
# secret file at the same path) — never bake secrets into the image.
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@
|
|||
#
|
||||
# Strategy: ignore everything, then re-include only what the build needs:
|
||||
# - litellm/ (pip install . needs the full package + proxy reader)
|
||||
# - litellm-rust/ (the rust workspace; Cargo.lock + crate sources)
|
||||
# - litellm-rust/ (the Rust crate sources)
|
||||
# - enterprise/ (litellm/proxy/enterprise symlinks into it; maturin walks it)
|
||||
# - litellm-proxy-extras/ (built into a wheel alongside enterprise/ for litellm[proxy])
|
||||
# - pyproject.toml / README.md / LICENSE (packaging metadata for the wheel build)
|
||||
# - Cargo.toml / Cargo.lock (the Rust workspace and dependency lock)
|
||||
# - rust-toolchain.toml (the pinned channel every cargo call in the build uses)
|
||||
*
|
||||
|
||||
|
|
@ -21,6 +22,8 @@
|
|||
!enterprise/
|
||||
!litellm-proxy-extras/
|
||||
!pyproject.toml
|
||||
!Cargo.toml
|
||||
!Cargo.lock
|
||||
!rust-toolchain.toml
|
||||
!README.md
|
||||
!LICENSE
|
||||
|
|
|
|||
2
rustfmt.toml
Normal file
2
rustfmt.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
edition = "2024"
|
||||
style_edition = "2024"
|
||||
Loading…
Add table
Reference in a new issue