mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
build: rename gateway distribution to litellm-proxy
This commit is contained in:
parent
8e38acd11d
commit
c7e58d8085
10 changed files with 55 additions and 36 deletions
8
.github/workflows/test-unit.yml
vendored
8
.github/workflows/test-unit.yml
vendored
|
|
@ -42,7 +42,7 @@ jobs:
|
|||
id: rust-bridge-key
|
||||
if: steps.changes.outputs.decision != 'skip'
|
||||
env:
|
||||
RUST_BRIDGE_CACHE_KEY: ${{ runner.os }}-rust-bridge-editable-${{ hashFiles('litellm-rust/Cargo.lock', 'litellm-rust/Cargo.toml', 'litellm-rust/crates/**', 'model_prices_and_context_window.json', 'pyproject.toml', 'packaging/litellm-gateway/pyproject.toml') }}
|
||||
RUST_BRIDGE_CACHE_KEY: ${{ runner.os }}-rust-bridge-editable-${{ hashFiles('litellm-rust/Cargo.lock', 'litellm-rust/Cargo.toml', 'litellm-rust/crates/**', 'model_prices_and_context_window.json', 'pyproject.toml', 'packaging/litellm-proxy/pyproject.toml') }}
|
||||
run: echo "key=$RUST_BRIDGE_CACHE_KEY" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Python
|
||||
|
|
@ -98,7 +98,7 @@ jobs:
|
|||
- name: Build the gateway wheel once for test shards
|
||||
if: steps.changes.outputs.decision != 'skip' && steps.rust-bridge-cache.outputs.cache-hit != 'true'
|
||||
timeout-minutes: 15
|
||||
working-directory: packaging/litellm-gateway
|
||||
working-directory: packaging/litellm-proxy
|
||||
env:
|
||||
RUSTC_WRAPPER: sccache
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
|
|
@ -1032,7 +1032,7 @@ jobs:
|
|||
if [ -z "$RUST_BRIDGE_ARTIFACT" ]; then
|
||||
.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml --extra extra_proxy --extra proxy-runtime --extra utils
|
||||
else
|
||||
.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml --extra extra_proxy --extra proxy-runtime --extra utils --no-install-project --no-install-package litellm-gateway
|
||||
.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml --extra extra_proxy --extra proxy-runtime --extra utils --no-install-project --no-install-package litellm-proxy
|
||||
uv pip install --no-deps --python .venv/bin/python rust-bridge-dist/*.whl
|
||||
cp rust-bridge-dist/litellm/rust_bridge/_native.abi3.so litellm/rust_bridge/_native.abi3.so
|
||||
uv run --no-sync python -c "import importlib.metadata; import litellm.rust_bridge._native; print(importlib.metadata.version('litellm'))"
|
||||
|
|
@ -1482,7 +1482,7 @@ jobs:
|
|||
if [ -z "$RUST_BRIDGE_ARTIFACT" ]; then
|
||||
.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml --extra extra_proxy --extra proxy-runtime --extra utils
|
||||
else
|
||||
.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml --extra extra_proxy --extra proxy-runtime --extra utils --no-install-project --no-install-package litellm-gateway
|
||||
.github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router --extra saml --extra extra_proxy --extra proxy-runtime --no-install-project --no-install-package litellm-proxy
|
||||
uv pip install --no-deps --python .venv/bin/python rust-bridge-dist/*.whl
|
||||
cp rust-bridge-dist/litellm/rust_bridge/_native.abi3.so litellm/rust_bridge/_native.abi3.so
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ ENV UV_PROJECT_ENVIRONMENT=/app/.venv \
|
|||
COPY pyproject.toml uv.lock ./
|
||||
COPY enterprise/pyproject.toml enterprise/
|
||||
COPY litellm-proxy-extras/pyproject.toml litellm-proxy-extras/
|
||||
COPY packaging/litellm-gateway/pyproject.toml packaging/litellm-gateway/
|
||||
COPY packaging/litellm-proxy/pyproject.toml packaging/litellm-proxy/
|
||||
|
||||
# Install third-party dependencies (cached unless pyproject.toml/uv.lock change)
|
||||
RUN uv sync --frozen --no-install-project --no-install-workspace --no-default-groups --no-editable \
|
||||
|
|
@ -102,8 +102,8 @@ COPY --from=ui-builder /ui/out/. litellm/proxy/_experimental/out/
|
|||
RUN sed -i 's/\r$//' docker/build_admin_ui.sh && chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh
|
||||
|
||||
# Install project and workspace packages (fast - deps already cached)
|
||||
RUN uv build --package litellm-gateway --wheel --out-dir /wheels
|
||||
RUN uv sync --frozen --no-install-package litellm-gateway --no-default-groups --no-editable \
|
||||
RUN uv build --package litellm-proxy --wheel --out-dir /wheels
|
||||
RUN uv sync --frozen --no-install-package litellm-proxy --no-default-groups --no-editable \
|
||||
--extra proxy \
|
||||
--extra proxy-runtime \
|
||||
--group admin-mcp \
|
||||
|
|
@ -113,7 +113,7 @@ RUN uv sync --frozen --no-install-package litellm-gateway --no-default-groups --
|
|||
--extra bedrock-realtime \
|
||||
--python python3.13
|
||||
|
||||
RUN uv pip install --python /app/.venv/bin/python --no-deps /wheels/litellm_gateway-*.whl
|
||||
RUN uv pip install --python /app/.venv/bin/python --no-deps /wheels/litellm_proxy-*.whl
|
||||
|
||||
RUN HOME=/opt/prisma XDG_CACHE_HOME=/opt/prisma/.cache PRISMA_BINARY_CACHE_DIR=/opt/prisma/binaries \
|
||||
npm_config_cache=/root/.npm \
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ ENV UV_PROJECT_ENVIRONMENT=/app/.venv \
|
|||
COPY pyproject.toml uv.lock ./
|
||||
COPY enterprise/pyproject.toml enterprise/
|
||||
COPY litellm-proxy-extras/pyproject.toml litellm-proxy-extras/
|
||||
COPY packaging/litellm-gateway/pyproject.toml packaging/litellm-gateway/
|
||||
COPY packaging/litellm-proxy/pyproject.toml packaging/litellm-proxy/
|
||||
|
||||
# Install third-party dependencies (cached unless pyproject.toml/uv.lock change)
|
||||
RUN uv sync --frozen --no-install-project --no-install-workspace --no-default-groups --no-editable \
|
||||
|
|
@ -100,8 +100,8 @@ COPY --from=ui-builder /ui/out/. litellm/proxy/_experimental/out/
|
|||
RUN sed -i 's/\r$//' docker/build_admin_ui.sh && chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh
|
||||
|
||||
# Install project and workspace packages (fast - deps already cached)
|
||||
RUN uv build --package litellm-gateway --wheel --out-dir /wheels
|
||||
RUN uv sync --frozen --no-install-package litellm-gateway --no-default-groups --no-editable \
|
||||
RUN uv build --package litellm-proxy --wheel --out-dir /wheels
|
||||
RUN uv sync --frozen --no-install-package litellm-proxy --no-default-groups --no-editable \
|
||||
--extra proxy \
|
||||
--extra proxy-runtime \
|
||||
--group admin-mcp \
|
||||
|
|
@ -111,7 +111,7 @@ RUN uv sync --frozen --no-install-package litellm-gateway --no-default-groups --
|
|||
--extra bedrock-realtime \
|
||||
--python python3.13
|
||||
|
||||
RUN uv pip install --python /app/.venv/bin/python --no-deps /wheels/litellm_gateway-*.whl
|
||||
RUN uv pip install --python /app/.venv/bin/python --no-deps /wheels/litellm_proxy-*.whl
|
||||
|
||||
RUN HOME=/opt/prisma XDG_CACHE_HOME=/opt/prisma/.cache PRISMA_BINARY_CACHE_DIR=/opt/prisma/binaries \
|
||||
npm_config_cache=/root/.npm \
|
||||
|
|
|
|||
|
|
@ -41,14 +41,14 @@ COPY pyproject.toml README.md rust-toolchain.toml ./
|
|||
COPY .cargo ./.cargo
|
||||
COPY litellm-rust ./litellm-rust
|
||||
COPY model_prices_and_context_window.json ./
|
||||
COPY packaging/litellm-gateway/pyproject.toml packaging/litellm-gateway/
|
||||
COPY packaging/litellm-proxy/pyproject.toml packaging/litellm-proxy/
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
mkdir -p litellm/rust_bridge /wheels && \
|
||||
touch litellm/__init__.py litellm/rust_bridge/__init__.py && \
|
||||
uvx --python python3.13 --from maturin==1.15.0 --with puccinialin==0.1.14 \
|
||||
python -c "import maturin; maturin.build_wheel('/wheels')" && \
|
||||
cd packaging/litellm-gateway && \
|
||||
cd packaging/litellm-proxy && \
|
||||
uvx --python python3.13 --from maturin==1.15.0 --with puccinialin==0.1.14 \
|
||||
python -c "import maturin; maturin.build_wheel('/wheels')"
|
||||
|
||||
|
|
@ -89,7 +89,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
||||
--mount=type=bind,source=enterprise/pyproject.toml,target=enterprise/pyproject.toml \
|
||||
--mount=type=bind,source=litellm-proxy-extras/pyproject.toml,target=litellm-proxy-extras/pyproject.toml \
|
||||
--mount=type=bind,source=packaging/litellm-gateway/pyproject.toml,target=packaging/litellm-gateway/pyproject.toml \
|
||||
--mount=type=bind,source=packaging/litellm-proxy/pyproject.toml,target=packaging/litellm-proxy/pyproject.toml \
|
||||
uv sync --frozen --no-install-project --no-install-workspace --no-default-groups --no-editable \
|
||||
--extra proxy \
|
||||
--extra proxy-runtime \
|
||||
|
|
@ -103,7 +103,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||
COPY . .
|
||||
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --frozen --no-install-project --no-install-package litellm-gateway --no-default-groups --no-editable \
|
||||
uv sync --frozen --no-install-project --no-install-package litellm-proxy --no-default-groups --no-editable \
|
||||
--extra proxy \
|
||||
--extra proxy-runtime \
|
||||
--group admin-mcp \
|
||||
|
|
@ -113,7 +113,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
|||
--python python3.13
|
||||
|
||||
RUN --mount=type=bind,from=rust-native,source=/wheels,target=/wheels \
|
||||
uv pip install --python /app/.venv/bin/python --no-deps /wheels/litellm-*.whl /wheels/litellm_gateway-*.whl
|
||||
uv pip install --python /app/.venv/bin/python --no-deps /wheels/litellm-*.whl /wheels/litellm_proxy-*.whl
|
||||
|
||||
# PYTHONPATH=/app makes the source tree shadow the installed package, so the
|
||||
# compiled Rust extension must live next to the source or it is never imported.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[project]
|
||||
name = "litellm-gateway"
|
||||
name = "litellm-proxy"
|
||||
version = "1.109.0"
|
||||
description = "Opt-in Rust HTTP forwarding server for the LiteLLM Python proxy"
|
||||
requires-python = ">=3.10, <3.16"
|
||||
|
|
@ -55,7 +55,7 @@ Documentation = "https://docs.litellm.ai"
|
|||
# supply-chain-pinned to a vetted, aged release.
|
||||
[project.optional-dependencies]
|
||||
proxy = [
|
||||
"litellm-gateway==1.109.0",
|
||||
"litellm-proxy==1.109.0",
|
||||
"gunicorn>=23.0.0,<24.0",
|
||||
"uvicorn>=0.33.0,<1.0",
|
||||
"granian>=2.7.4,<3.0; python_version < '3.15'",
|
||||
|
|
@ -389,12 +389,12 @@ brotli = "2026-10-22T14:01:00Z"
|
|||
pypdf = "2026-10-28T17:01:00Z"
|
||||
|
||||
[tool.uv.sources]
|
||||
litellm-gateway = { workspace = true }
|
||||
litellm-proxy = { workspace = true }
|
||||
litellm-proxy-extras = { workspace = true }
|
||||
litellm-enterprise = { workspace = true }
|
||||
|
||||
[tool.uv.workspace]
|
||||
members = ["enterprise", "litellm-proxy-extras", "packaging/litellm-gateway"]
|
||||
members = ["enterprise", "litellm-proxy-extras", "packaging/litellm-proxy"]
|
||||
|
||||
[tool.commitizen]
|
||||
version = "1.109.0"
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ def stage_core_distribution(source: Path, destination: Path, *, package: str = "
|
|||
else:
|
||||
shutil.copy2(path, destination / name)
|
||||
template: Final = (source / "packaging" / package / "pyproject.toml").read_text()
|
||||
if package == "litellm-gateway" and IN_TREE_RUST_PATH not in template:
|
||||
if package == "litellm-proxy" and IN_TREE_RUST_PATH not in template:
|
||||
raise SystemExit(f"packaging/{package}/pyproject.toml no longer points at {IN_TREE_RUST_PATH}")
|
||||
metadata: Final = template.replace(IN_TREE_RUST_PATH, "litellm-rust/")
|
||||
(destination / "pyproject.toml").write_text(metadata)
|
||||
|
|
@ -93,7 +93,7 @@ def build_core_distribution(output: Path, *, sdist_only: bool = False, package:
|
|||
|
||||
def main() -> None:
|
||||
parser: Final = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--package", choices=("litellm-core", "litellm-gateway"), default="litellm-core")
|
||||
parser.add_argument("--package", choices=("litellm-core", "litellm-proxy"), default="litellm-core")
|
||||
parser.add_argument("--out-dir", type=Path, default=ROOT / "dist/core")
|
||||
parser.add_argument(
|
||||
"--sdist-only", action="store_true", help="Build only the source archive, without compiling a wheel"
|
||||
|
|
|
|||
|
|
@ -20,12 +20,21 @@ else:
|
|||
ROOT: Final = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("package_cli_args", "package"),
|
||||
[
|
||||
(("--package", "litellm-proxy"), "litellm-proxy"),
|
||||
((), "litellm-core"),
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("sdist_only", [False, True])
|
||||
def test_build_command_selects_requested_distributions(tmp_path: Path, sdist_only: bool) -> None:
|
||||
def test_build_command_selects_requested_distributions(
|
||||
tmp_path: Path, sdist_only: bool, package_cli_args: tuple[str, ...], package: str
|
||||
) -> None:
|
||||
from scripts.build_core_distribution import main
|
||||
|
||||
output: Final = tmp_path / "dist"
|
||||
arguments: Final = ["build_core_distribution.py", "--out-dir", str(output)] + (
|
||||
arguments: Final = ["build_core_distribution.py", *package_cli_args, "--out-dir", str(output)] + (
|
||||
["--sdist-only"] if sdist_only else []
|
||||
)
|
||||
with (
|
||||
|
|
@ -42,6 +51,7 @@ def test_build_command_selects_requested_distributions(tmp_path: Path, sdist_onl
|
|||
assert command[command.index("--out-dir") + 1] == str(output)
|
||||
assert run.call_args.kwargs["check"] is True
|
||||
assert run.call_args.kwargs["cwd"] == stage.call_args.args[1]
|
||||
assert stage.call_args.kwargs["package"] == package
|
||||
assert not stage.call_args.args[1].exists()
|
||||
|
||||
|
||||
|
|
@ -53,7 +63,7 @@ def source_repository(tmp_path: Path) -> Path:
|
|||
return source
|
||||
|
||||
|
||||
@pytest.mark.parametrize("package", ["litellm-core", "litellm-gateway"])
|
||||
@pytest.mark.parametrize("package", ["litellm-core", "litellm-proxy"])
|
||||
def test_staging_stamps_release_version_without_modifying_sources(
|
||||
tmp_path: Path, source_repository: Path, package: str
|
||||
) -> None:
|
||||
|
|
@ -70,7 +80,16 @@ def test_staging_stamps_release_version_without_modifying_sources(
|
|||
original: Final = manifest.read_bytes()
|
||||
stage: Final = tmp_path / "stage"
|
||||
stage_core_distribution(source, stage, package=package)
|
||||
assert tomllib.loads((stage / "pyproject.toml").read_text())["project"]["version"] == "9.8.7rc1"
|
||||
staged_project: Final = tomllib.loads((stage / "pyproject.toml").read_text())
|
||||
assert staged_project["project"]["name"] == package
|
||||
assert staged_project["project"]["version"] == "9.8.7rc1"
|
||||
if package == "litellm-proxy":
|
||||
assert staged_project["tool"]["maturin"]["targets"] == [{"name": "litellm-gateway", "kind": "bin"}]
|
||||
assert not (stage / "litellm").exists()
|
||||
assert all(
|
||||
(stage / name).exists()
|
||||
for name in ("litellm-rust", ".cargo", "rust-toolchain.toml", "model_prices_and_context_window.json")
|
||||
)
|
||||
assert manifest.read_bytes() == original
|
||||
assert (source / "pyproject.toml").read_text() == '[project]\nname = "litellm"\nversion = "9.8.7rc1"\n'
|
||||
expected: Final = tuple(name for name in SOURCES if package == "litellm-core" or name != "litellm")
|
||||
|
|
@ -84,15 +103,15 @@ def test_gateway_staging_refuses_manifest_without_in_tree_rust_path(tmp_path: Pa
|
|||
for name in SOURCES:
|
||||
(source / name).write_text(f"shared {name}")
|
||||
(source / "pyproject.toml").write_text('[project]\nname = "litellm"\nversion = "9.8.7"\n')
|
||||
manifest: Final = source / "packaging" / "litellm-gateway" / "pyproject.toml"
|
||||
manifest: Final = source / "packaging" / "litellm-proxy" / "pyproject.toml"
|
||||
manifest.parent.mkdir(parents=True)
|
||||
manifest.write_text(
|
||||
(ROOT / "packaging" / "litellm-gateway" / "pyproject.toml")
|
||||
(ROOT / "packaging" / "litellm-proxy" / "pyproject.toml")
|
||||
.read_text()
|
||||
.replace("../../litellm-rust/", "../../rust/")
|
||||
)
|
||||
with pytest.raises(SystemExit, match="no longer points at"):
|
||||
stage_core_distribution(source, tmp_path / "stage", package="litellm-gateway")
|
||||
stage_core_distribution(source, tmp_path / "stage", package="litellm-proxy")
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ importlib-metadata: >=6.8.0 # Apache 2.0 License
|
|||
tokenizers: >=0.20.2 # Apache 2.0 License
|
||||
jinja2: >=3.1.4 # BSD 3-Clause License
|
||||
litellm-proxy-extras: >=0.1.1 # MIT License
|
||||
litellm-gateway: >=1.109.0 # MIT, verified in repository LICENSE for litellm-rust and packaging/litellm-gateway
|
||||
litellm-proxy: >=1.109.0 # MIT, verified in repository LICENSE for litellm-rust and packaging/litellm-proxy
|
||||
litellm-enterprise: >=0.1.1 # LiteLLM Enterprise License
|
||||
a2a-sdk: >=0.3.22 # Apache 2.0 license
|
||||
anyio: >=4.5.0 # Unknown license
|
||||
|
|
|
|||
10
uv.lock
generated
10
uv.lock
generated
|
|
@ -22,7 +22,7 @@ pypdf = "2026-10-28T17:01:00Z"
|
|||
members = [
|
||||
"litellm",
|
||||
"litellm-enterprise",
|
||||
"litellm-gateway",
|
||||
"litellm-proxy",
|
||||
"litellm-proxy-extras",
|
||||
]
|
||||
constraints = [
|
||||
|
|
@ -5041,7 +5041,7 @@ proxy = [
|
|||
{ name = "httpx2" },
|
||||
{ name = "inquirerpy" },
|
||||
{ name = "litellm-enterprise" },
|
||||
{ name = "litellm-gateway" },
|
||||
{ name = "litellm-proxy" },
|
||||
{ name = "litellm-proxy-extras" },
|
||||
{ name = "mcp" },
|
||||
{ name = "orjson" },
|
||||
|
|
@ -5273,7 +5273,7 @@ requires-dist = [
|
|||
{ name = "keyring", marker = "extra == 'cli'", specifier = ">=25.6.0,<26.0" },
|
||||
{ name = "langfuse", marker = "extra == 'proxy-runtime'", specifier = ">=4.7,<5.0" },
|
||||
{ name = "litellm-enterprise", marker = "extra == 'proxy'", editable = "enterprise" },
|
||||
{ name = "litellm-gateway", marker = "extra == 'proxy'", editable = "packaging/litellm-gateway" },
|
||||
{ name = "litellm-proxy", marker = "extra == 'proxy'", editable = "packaging/litellm-proxy" },
|
||||
{ name = "litellm-proxy-extras", marker = "extra == 'proxy'", editable = "litellm-proxy-extras" },
|
||||
{ name = "llm-sandbox", marker = "extra == 'proxy-runtime'", specifier = ">=0.3.39,<1.0" },
|
||||
{ name = "mangum", marker = "extra == 'proxy-runtime'", specifier = ">=0.17.0,<1.0" },
|
||||
|
|
@ -5475,9 +5475,9 @@ version = "0.1.81"
|
|||
source = { editable = "enterprise" }
|
||||
|
||||
[[package]]
|
||||
name = "litellm-gateway"
|
||||
name = "litellm-proxy"
|
||||
version = "1.109.0"
|
||||
source = { editable = "packaging/litellm-gateway" }
|
||||
source = { editable = "packaging/litellm-proxy" }
|
||||
|
||||
[[package]]
|
||||
name = "litellm-proxy-extras"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue