mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
build(fips): drop saml, bedrock-realtime and native extras from the FIPS image and add a rust bridge build switch
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a8b296c584
commit
ffeb8481e1
9 changed files with 376 additions and 27 deletions
|
|
@ -76,6 +76,7 @@ RUN --mount=type=secret,id=cgr-token \
|
|||
ENV UV_PROJECT_ENVIRONMENT=/app/.venv \
|
||||
UV_LINK_MODE=copy \
|
||||
UV_PYTHON_DOWNLOADS=0 \
|
||||
LITELLM_SKIP_RUST_BRIDGE=1 \
|
||||
PATH="/app/.venv/bin:${PATH}"
|
||||
|
||||
COPY pyproject.toml uv.lock ./
|
||||
|
|
@ -87,8 +88,10 @@ RUN uv sync --frozen --no-install-project --no-install-workspace --no-default-gr
|
|||
--extra proxy-runtime \
|
||||
--extra extra_proxy \
|
||||
--extra semantic-router \
|
||||
--extra saml \
|
||||
--extra bedrock-realtime \
|
||||
--no-install-package hf-xet \
|
||||
--no-install-package pyroscope-io \
|
||||
--no-install-package granian \
|
||||
--no-install-package pynacl \
|
||||
--python python3.13
|
||||
|
||||
COPY . .
|
||||
|
|
@ -103,10 +106,15 @@ RUN uv sync --frozen --no-default-groups --no-editable \
|
|||
--extra proxy-runtime \
|
||||
--extra extra_proxy \
|
||||
--extra semantic-router \
|
||||
--extra saml \
|
||||
--extra bedrock-realtime \
|
||||
--no-install-package hf-xet \
|
||||
--no-install-package pyroscope-io \
|
||||
--no-install-package granian \
|
||||
--no-install-package pynacl \
|
||||
--python python3.13
|
||||
|
||||
RUN test -z "$(find /app/.venv -name '_native*.so' -path '*litellm/rust_bridge*')" && \
|
||||
test -z "$(find /app/.venv -name 'hf_xet*.so' -o -name '_awscrt*.so' -o -name 'xmlsec*.so' -o -path '*/nacl/_sodium*' -o -path '*/granian/*.so' -o -path '*/pyroscope/*.so')"
|
||||
|
||||
RUN HOME=/opt/prisma XDG_CACHE_HOME=/opt/prisma/.cache PRISMA_BINARY_CACHE_DIR=/opt/prisma/binaries \
|
||||
npm_config_cache=/root/.npm \
|
||||
prisma generate --schema=./schema.prisma
|
||||
|
|
@ -131,7 +139,8 @@ ENV PATH="/app/.venv/bin:${PATH}" \
|
|||
PRISMA_BINARY_CACHE_DIR=/opt/prisma/binaries \
|
||||
PRISMA_CLI_PATH=/opt/prisma/binaries/node_modules/.bin/prisma \
|
||||
PRISMA_CLI_QUERY_ENGINE_TYPE=binary \
|
||||
PRISMA_OFFLINE_MODE=true
|
||||
PRISMA_OFFLINE_MODE=true \
|
||||
HF_HUB_DISABLE_XET=1
|
||||
|
||||
COPY --from=builder /app/.venv /app/.venv
|
||||
COPY --from=builder /app/docker /app/docker
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
/app/.venv/lib/python3.13/site-packages/81d243bd2c585b0f4821__mypyc.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/_awscrt.abi3.so
|
||||
/app/.venv/lib/python3.13/site-packages/_cffi_backend.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/_polars_runtime_32/_polars_runtime.abi3.so
|
||||
/app/.venv/lib/python3.13/site-packages/aiohttp/_http_parser.cpython-313-ARCH-linux-gnu.so
|
||||
|
|
@ -35,25 +34,14 @@
|
|||
/app/.venv/lib/python3.13/site-packages/google/_upb/_message.abi3.so
|
||||
/app/.venv/lib/python3.13/site-packages/google_crc32c.libs/libcrc32c.so.1.1.0
|
||||
/app/.venv/lib/python3.13/site-packages/google_crc32c/_crc32c.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/granian/_granian.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/grpc/_cython/cygrpc.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/hf_xet/hf_xet.abi3.so
|
||||
/app/.venv/lib/python3.13/site-packages/hiredis/hiredis.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/ijson.libs/libyajl.so.2.1.1
|
||||
/app/.venv/lib/python3.13/site-packages/ijson/backends/_yajl2.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/jiter/jiter.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/litellm/rust_bridge/_native.abi3.so
|
||||
/app/.venv/lib/python3.13/site-packages/lxml/_elementpath.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/lxml/builder.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/lxml/etree.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/lxml/html/_difflib.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/lxml/html/diff.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/lxml/objectify.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/lxml/sax.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/markupsafe/_speedups.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/ml_dtypes/_ml_dtypes_ext.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/multidict/_multidict.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/nacl/_sodium.abi3.so
|
||||
/app/.venv/lib/python3.13/site-packages/numpy.libs/libgfortran-daac5196.so.5.0.0
|
||||
/app/.venv/lib/python3.13/site-packages/numpy.libs/libscipy_openblas64_.so
|
||||
/app/.venv/lib/python3.13/site-packages/numpy/_core/_multiarray_tests.cpython-313-ARCH-linux-gnu.so
|
||||
|
|
@ -96,7 +84,6 @@
|
|||
/app/.venv/lib/python3.13/site-packages/psycopg_binary/_psycopg.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/psycopg_binary/pq.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/pydantic_core/_pydantic_core.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/pyroscope/_native__lib.cpython-39-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/regex/_regex.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/rpds/rpds.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/tiktoken/_tiktoken.cpython-313-ARCH-linux-gnu.so
|
||||
|
|
@ -105,7 +92,6 @@
|
|||
/app/.venv/lib/python3.13/site-packages/uvloop/loop.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/websockets/speedups.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/wrapt/_wrappers.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/xmlsec.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/yaml/_yaml.cpython-313-ARCH-linux-gnu.so
|
||||
/app/.venv/lib/python3.13/site-packages/yarl/_quoting_c.cpython-313-ARCH-linux-gnu.so
|
||||
/opt/prisma/.cache/prisma/master/ac9d7041ed77bcc8a8dbd2ab6616b39013829574/debian-openssl-1.1.x/query-engine
|
||||
|
|
|
|||
|
|
@ -52,13 +52,7 @@ is_waived() {
|
|||
case "$1" in
|
||||
*/cryptography/hazmat/bindings/_rust.abi3.so) ;;
|
||||
*/grpc/_cython/cygrpc*.so) ;;
|
||||
*/hf_xet/hf_xet.abi3.so) ;;
|
||||
*/_awscrt.abi3.so) ;;
|
||||
*/pyroscope/_native__lib*.so) ;;
|
||||
*/psycopg_binary.libs/libcrypto-*) ;;
|
||||
*/nacl/_sodium*.so|*/libsodium*) ;;
|
||||
*/litellm/rust_bridge/*|*/granian*) ;;
|
||||
*/xmlsec*|*xmlsec.libs*) ;;
|
||||
*/_polars_runtime_32/_polars_runtime.abi3.so) ;;
|
||||
*/ddtrace/internal/native/_native*.so) ;;
|
||||
/opt/prisma/*query-engine*|/opt/prisma/*schema-engine*) ;;
|
||||
|
|
|
|||
|
|
@ -216,6 +216,8 @@ dev = [
|
|||
"responses==0.26.0",
|
||||
"respx==0.22.0",
|
||||
"ruff==0.15.3",
|
||||
"hatchling==1.32.0",
|
||||
"maturin==1.15.0",
|
||||
"types-requests==2.32.4.20260107",
|
||||
"types-setuptools==75.8.0.20250225",
|
||||
"types-redis==4.6.0.20241004",
|
||||
|
|
@ -301,8 +303,9 @@ benchmarks = [
|
|||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["maturin==1.15.0"]
|
||||
build-backend = "maturin"
|
||||
requires = ["maturin==1.15.0", "hatchling==1.32.0"]
|
||||
build-backend = "litellm_build_backend"
|
||||
backend-path = ["scripts"]
|
||||
|
||||
[tool.maturin]
|
||||
manifest-path = "litellm-rust/crates/python-bridge/Cargo.toml"
|
||||
|
|
@ -329,6 +332,20 @@ exclude = [
|
|||
"**/.ruff_cache/**",
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["litellm"]
|
||||
exclude = [
|
||||
"litellm/proxy/enterprise",
|
||||
"litellm/proxy/enterprise/**",
|
||||
"litellm/rust_bridge/_native*.so",
|
||||
"**/__pycache__",
|
||||
"**/__pycache__/**",
|
||||
"**/.pytest_cache",
|
||||
"**/.pytest_cache/**",
|
||||
"**/.ruff_cache",
|
||||
"**/.ruff_cache/**",
|
||||
]
|
||||
|
||||
[tool.uv]
|
||||
constraint-dependencies = [
|
||||
"tornado>=6.5.8",
|
||||
|
|
|
|||
40
scripts/litellm_build_backend.py
Normal file
40
scripts/litellm_build_backend.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
"""PEP 517 backend that builds a pure-Python wheel when LITELLM_SKIP_RUST_BRIDGE is set."""
|
||||
|
||||
import os
|
||||
from typing import Final
|
||||
|
||||
SKIP_RUST_BRIDGE: Final = os.environ.get("LITELLM_SKIP_RUST_BRIDGE", "").lower() in {"1", "true"}
|
||||
|
||||
if SKIP_RUST_BRIDGE:
|
||||
from hatchling.build import (
|
||||
build_editable,
|
||||
build_sdist,
|
||||
build_wheel,
|
||||
get_requires_for_build_editable,
|
||||
get_requires_for_build_sdist,
|
||||
get_requires_for_build_wheel,
|
||||
prepare_metadata_for_build_editable,
|
||||
prepare_metadata_for_build_wheel,
|
||||
)
|
||||
else:
|
||||
from maturin import (
|
||||
build_editable,
|
||||
build_sdist,
|
||||
build_wheel,
|
||||
get_requires_for_build_editable,
|
||||
get_requires_for_build_sdist,
|
||||
get_requires_for_build_wheel,
|
||||
prepare_metadata_for_build_editable,
|
||||
prepare_metadata_for_build_wheel,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"build_editable",
|
||||
"build_sdist",
|
||||
"build_wheel",
|
||||
"get_requires_for_build_editable",
|
||||
"get_requires_for_build_sdist",
|
||||
"get_requires_for_build_wheel",
|
||||
"prepare_metadata_for_build_editable",
|
||||
"prepare_metadata_for_build_wheel",
|
||||
]
|
||||
151
tests/integration/configuration/test_fips_install_footprint.py
Normal file
151
tests/integration/configuration/test_fips_install_footprint.py
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
"""The proxy must serve with every package the FIPS image drops absent."""
|
||||
|
||||
import json
|
||||
import os
|
||||
import signal
|
||||
from collections.abc import Iterator, Mapping
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from contextlib import contextmanager
|
||||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
import httpx
|
||||
import psutil
|
||||
import yaml
|
||||
from pydantic import JsonValue
|
||||
|
||||
from tests.integration._support.client import Gateway, eventually, object_value, string_value
|
||||
from tests.integration._support.process import OwnedProxy, group_members, owned_proxy_process
|
||||
|
||||
SITECUSTOMIZE: Final = """
|
||||
import importlib.abc
|
||||
import sys
|
||||
|
||||
_ROOTS = frozenset({"nacl", "granian", "pyroscope", "hf_xet", "awscrt", "_awscrt", "xmlsec", "lxml"})
|
||||
_EXACT = frozenset({"litellm.rust_bridge._native"})
|
||||
|
||||
|
||||
class _Blocker(importlib.abc.MetaPathFinder):
|
||||
def find_spec(self, fullname, path=None, target=None):
|
||||
if fullname in _EXACT or fullname.split(".", 1)[0] in _ROOTS:
|
||||
raise ImportError(f"FIPS footprint test blocks {fullname}")
|
||||
return None
|
||||
|
||||
|
||||
sys.meta_path.insert(0, _Blocker())
|
||||
"""
|
||||
|
||||
|
||||
@contextmanager
|
||||
def fips_proxy(gateway: Gateway, directory: Path, *, workers: int = 2) -> Iterator[OwnedProxy]:
|
||||
blockers: Final = directory / "blockers"
|
||||
blockers.mkdir()
|
||||
(blockers / "sitecustomize.py").write_text(SITECUSTOMIZE)
|
||||
config_source: Final = yaml.safe_load((Path(__file__).resolve().parents[1] / "proxy_config.yaml").read_text())
|
||||
config_source["general_settings"]["encryption_algorithm"] = "aes-256-gcm"
|
||||
config: Final = directory / "fips_config.yaml"
|
||||
config.write_text(yaml.safe_dump(config_source))
|
||||
overrides: Final = {
|
||||
"PYTHONPATH": f"{blockers}{os.pathsep}{os.environ.get('PYTHONPATH', '')}",
|
||||
}
|
||||
with owned_proxy_process(gateway, directory, overrides, config=config, workers=workers) as owned:
|
||||
yield owned
|
||||
|
||||
|
||||
def upstream_requests(gateway: Gateway) -> tuple[dict[str, JsonValue], ...]:
|
||||
response: Final = httpx.get(f"{gateway.upstream_url}/__observations", timeout=5, trust_env=False)
|
||||
response.raise_for_status()
|
||||
return tuple(object_value(value) for value in response.json()["requests"])
|
||||
|
||||
|
||||
def chat_response(
|
||||
proxy: OwnedProxy,
|
||||
model: str,
|
||||
*,
|
||||
key: str | None = None,
|
||||
body: Mapping[str, JsonValue] | None = None,
|
||||
) -> httpx.Response:
|
||||
return proxy.gateway.request(
|
||||
"POST",
|
||||
"/v1/chat/completions",
|
||||
{"model": model, "messages": [{"role": "user", "content": "fips footprint"}], **(body or {})},
|
||||
key=key,
|
||||
)
|
||||
|
||||
|
||||
def test_proxy_serves_chat_completions_with_fips_dropped_packages_absent(gateway: Gateway, tmp_path: Path) -> None:
|
||||
with fips_proxy(gateway, tmp_path) as owned, owned.gateway.scenario() as scenario:
|
||||
model: Final = scenario.model()
|
||||
upstream_requests(gateway)
|
||||
response: Final = chat_response(owned, model)
|
||||
assert response.status_code == 200, response.text
|
||||
assert string_value(response.json()["id"])
|
||||
requests: Final = upstream_requests(gateway)
|
||||
assert len(requests) == 1, requests
|
||||
assert "chat/completions" in requests[0]["path"]
|
||||
log_text: Final = owned.log.read_text()
|
||||
assert "ModuleNotFoundError" not in log_text and "Traceback" not in log_text, log_text[-2000:]
|
||||
|
||||
|
||||
def test_streaming_chat_completes_with_fips_dropped_packages_absent(gateway: Gateway, tmp_path: Path) -> None:
|
||||
with fips_proxy(gateway, tmp_path) as owned, owned.gateway.scenario() as scenario:
|
||||
model: Final = scenario.model()
|
||||
chunks: Final = []
|
||||
with owned.gateway.client.stream(
|
||||
"POST",
|
||||
"/v1/chat/completions",
|
||||
json={
|
||||
"model": model,
|
||||
"messages": [{"role": "user", "content": "fips footprint"}],
|
||||
"stream": True,
|
||||
"stream_options": {"include_usage": True},
|
||||
},
|
||||
headers={"Authorization": f"Bearer {owned.gateway.key}"},
|
||||
) as response:
|
||||
assert response.status_code == 200, response.read().decode()
|
||||
for line in response.iter_lines():
|
||||
if line.startswith("data: "):
|
||||
chunks.append(line[len("data: ") :])
|
||||
assert chunks, "stream produced no data chunks"
|
||||
assert chunks[-1] == "[DONE]", chunks
|
||||
final: Final = object_value(json.loads(chunks[-2]))
|
||||
assert final["object"] == "chat.completion.chunk" and "usage" in final, chunks[-2]
|
||||
|
||||
|
||||
def test_key_generated_on_the_owned_proxy_serves_chat(gateway: Gateway, tmp_path: Path) -> None:
|
||||
with fips_proxy(gateway, tmp_path) as owned, owned.gateway.scenario() as scenario:
|
||||
model: Final = scenario.model()
|
||||
created: Final = owned.gateway.post("/key/generate", {})
|
||||
token: Final = string_value(created["key"])
|
||||
response: Final = chat_response(owned, model, key=token)
|
||||
assert response.status_code == 200, response.text
|
||||
assert string_value(response.json()["id"])
|
||||
|
||||
|
||||
def test_surviving_worker_keeps_serving_after_one_worker_is_killed(gateway: Gateway, tmp_path: Path) -> None:
|
||||
with fips_proxy(gateway, tmp_path) as owned, owned.gateway.scenario() as scenario:
|
||||
model: Final = scenario.model()
|
||||
children: Final = tuple(
|
||||
process for process in group_members(owned.process.pid) if process.pid != owned.process.pid
|
||||
)
|
||||
assert len(children) >= 2, [process.pid for process in group_members(owned.process.pid)]
|
||||
victim: Final = children[0]
|
||||
victim.send_signal(signal.SIGKILL)
|
||||
|
||||
def victim_dead() -> bool:
|
||||
try:
|
||||
return victim.status() in {psutil.STATUS_ZOMBIE, psutil.STATUS_DEAD} or not victim.is_running()
|
||||
except psutil.NoSuchProcess:
|
||||
return True
|
||||
|
||||
eventually(victim_dead, lambda dead: dead, seconds=10)
|
||||
with ThreadPoolExecutor(max_workers=20) as pool:
|
||||
responses: Final = tuple(pool.map(lambda _: chat_response(owned, model), range(20)))
|
||||
assert all(response.status_code == 200 for response in responses), [
|
||||
(response.status_code, response.text) for response in responses
|
||||
]
|
||||
eventually(
|
||||
lambda: owned.gateway.client.get("/health/readiness").status_code,
|
||||
lambda status: status == 200,
|
||||
seconds=30,
|
||||
)
|
||||
|
|
@ -7,6 +7,7 @@ import os
|
|||
import re
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import types
|
||||
import uuid
|
||||
|
|
@ -15143,3 +15144,32 @@ async def test_initialize_jwt_auth_leaves_the_declared_jwtauth_mapping_unresolve
|
|||
|
||||
assert declared["team_id_jwt_field"] == "os.environ/JWT_TEAM_FIELD"
|
||||
assert proxy_server_module.jwt_handler.litellm_jwtauth.team_id_jwt_field == "resolved-team-field"
|
||||
|
||||
|
||||
def test_proxy_server_imports_with_optional_native_packages_absent() -> None:
|
||||
blocked: Final = (
|
||||
"nacl",
|
||||
"granian",
|
||||
"pyroscope",
|
||||
"hf_xet",
|
||||
"awscrt",
|
||||
"xmlsec",
|
||||
"litellm.rust_bridge._native",
|
||||
)
|
||||
result: Final = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-c",
|
||||
"import sys\n"
|
||||
+ "\n".join(f"sys.modules[{name!r}] = None" for name in blocked)
|
||||
+ "\nimport litellm.proxy.proxy_server\n"
|
||||
+ "from litellm.rust_bridge import native_bridge_available\n"
|
||||
+ "assert native_bridge_available() is False\n"
|
||||
+ 'print("ok")',
|
||||
],
|
||||
cwd=Path(__file__).resolve().parents[3],
|
||||
env=dict(os.environ),
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
assert result.returncode == 0 and "ok" in result.stdout, f"returncode={result.returncode} stderr={result.stderr}"
|
||||
|
|
|
|||
68
tests/test_litellm/test_litellm_build_backend.py
Normal file
68
tests/test_litellm/test_litellm_build_backend.py
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from typing import Final
|
||||
|
||||
REPO_ROOT: Final = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def _backend_env(**overrides: str) -> dict[str, str]:
|
||||
env: Final = dict(os.environ)
|
||||
env["PYTHONPATH"] = f"{REPO_ROOT / 'scripts'}{os.pathsep}{env.get('PYTHONPATH', '')}"
|
||||
env.pop("LITELLM_SKIP_RUST_BRIDGE", None)
|
||||
env.update(overrides)
|
||||
return env
|
||||
|
||||
|
||||
def test_skip_rust_bridge_builds_a_pure_python_wheel(tmp_path: Path) -> None:
|
||||
result: Final = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-c",
|
||||
"import sys, litellm_build_backend as b; print(b.build_wheel(sys.argv[1]))",
|
||||
str(tmp_path),
|
||||
],
|
||||
cwd=REPO_ROOT,
|
||||
env=_backend_env(LITELLM_SKIP_RUST_BRIDGE="1"),
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
assert result.returncode == 0, f"returncode={result.returncode} stderr={result.stderr}"
|
||||
wheel: Final = tmp_path / result.stdout.strip()
|
||||
assert wheel.is_file(), f"wheel not produced: stdout={result.stdout} stderr={result.stderr}"
|
||||
names: Final = tuple(zipfile.ZipFile(wheel).namelist())
|
||||
assert not any(
|
||||
name.startswith("litellm/rust_bridge/_native") and (name.endswith(".so") or name.endswith(".pyd"))
|
||||
for name in names
|
||||
), names
|
||||
for expected in (
|
||||
"litellm/proxy/proxy_server.py",
|
||||
"litellm/rust_bridge/loader.py",
|
||||
"litellm/rust_bridge/_native.pyi",
|
||||
"litellm/proxy/_experimental/out/index.html",
|
||||
"litellm/router_strategy/complexity_router/fuse_presets.json",
|
||||
"litellm/model_prices_and_context_window_backup.json",
|
||||
"litellm/proxy/client/cli/commands/codex_base_instructions.md",
|
||||
):
|
||||
assert expected in names, f"{expected} missing from wheel"
|
||||
assert not any(name.startswith("litellm/proxy/enterprise/") or "__pycache__" in name for name in names), names
|
||||
|
||||
|
||||
def test_without_the_switch_the_hooks_are_maturins() -> None:
|
||||
result: Final = subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
"-c",
|
||||
"import litellm_build_backend as b, maturin; "
|
||||
"print(b.build_wheel is maturin.build_wheel and b.build_sdist is maturin.build_sdist "
|
||||
"and b.build_editable is maturin.build_editable)",
|
||||
],
|
||||
cwd=REPO_ROOT,
|
||||
env=_backend_env(),
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
assert result.returncode == 0, f"returncode={result.returncode} stderr={result.stderr}"
|
||||
assert result.stdout.strip() == "True", result.stdout
|
||||
54
uv.lock
generated
54
uv.lock
generated
|
|
@ -3141,6 +3141,23 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/7e/22/e85faf23bd72a92d1921e37d674ca56eb298a3c8be31fdecef0ff2b3aaac/h2-4.4.1-py3-none-any.whl", hash = "sha256:0e25f1462b23c9cb82d9eb02e28bc706dac2a68cb457c6a0d74d63c8a2a5d0e6", size = 62636, upload-time = "2026-08-03T11:44:59.164Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hatchling"
|
||||
version = "1.32.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "packaging" },
|
||||
{ name = "pathspec" },
|
||||
{ name = "pluggy" },
|
||||
{ name = "tomli", marker = "python_full_version < '3.11'" },
|
||||
{ name = "tomlkit" },
|
||||
{ name = "trove-classifiers" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/69/08/33331757185504aae48b8d9bd78cec03a76e3aecfb52e549d05a2347c0dd/hatchling-1.32.0.tar.gz", hash = "sha256:0bdbde4a52b06c37e3eca395f85a762bf0ef06fe374fd8ae429dc6be10230f5f", size = 57783, upload-time = "2026-08-11T05:03:44.114Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/a9/84/1798b6d85ecde0e31546004efd25c5de1b1f49250644a60cce460e12593a/hatchling-1.32.0-py3-none-any.whl", hash = "sha256:0e17c9c3b9aa7c625acc8d0f5b622f107d5049af9ecf5ada4de1aada5be7cdbc", size = 78435, upload-time = "2026-08-11T05:03:42.644Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hf-xet"
|
||||
version = "1.6.0"
|
||||
|
|
@ -4683,9 +4700,11 @@ dev = [
|
|||
{ name = "diff-cover" },
|
||||
{ name = "fakeredis" },
|
||||
{ name = "fastapi-offline" },
|
||||
{ name = "hatchling" },
|
||||
{ name = "hypothesis" },
|
||||
{ name = "keyring" },
|
||||
{ name = "langfuse" },
|
||||
{ name = "maturin" },
|
||||
{ name = "mypy" },
|
||||
{ name = "numpy", version = "1.26.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" },
|
||||
{ name = "numpy", version = "2.4.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" },
|
||||
|
|
@ -4897,9 +4916,11 @@ dev = [
|
|||
{ name = "diff-cover", specifier = "==9.7.2" },
|
||||
{ name = "fakeredis", specifier = "==2.34.1" },
|
||||
{ name = "fastapi-offline", specifier = "==1.7.6" },
|
||||
{ name = "hatchling", specifier = "==1.32.0" },
|
||||
{ name = "hypothesis", specifier = "==6.165.10" },
|
||||
{ name = "keyring", specifier = "==25.7.0" },
|
||||
{ name = "langfuse", specifier = "==2.59.7" },
|
||||
{ name = "maturin", specifier = "==1.15.0" },
|
||||
{ name = "mypy", specifier = "==1.20.1" },
|
||||
{ name = "numpy", specifier = ">=1.26.0,<3.0" },
|
||||
{ name = "openapi-core", specifier = "==0.22.0" },
|
||||
|
|
@ -5403,6 +5424,30 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/6f/87/afead29192170917537934c6aff4b008c805fff7b1ccea0c79120d96beda/matplotlib-3.10.9-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3fc0364dfbe1d07f6d15c5ebd0c5bf89e126916e5a8667dd4a7a6e84c36653d4", size = 8774002, upload-time = "2026-04-24T00:14:09.816Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "maturin"
|
||||
version = "1.15.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "tomli", marker = "python_full_version < '3.11'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b9/c8/22e5e21b2679c9bce6415ca578034ca2cc9316be0642ae21e051a2d5198c/maturin-1.15.0.tar.gz", hash = "sha256:94b26cc8e8aba61a5f2099715fe640e18c5f678e9a500408b38761263954228a", size = 385504, upload-time = "2026-08-24T12:11:22.665Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/14/69/5c01b461044eb1f45ddcce006706eb88110c793cdb11c7ae0b5e08492e94/maturin-1.15.0-py3-none-linux_armv6l.whl", hash = "sha256:6bf6dc62e22d4dcfd5a51244ff0d58975fa4979c48209fe84159617648956d82", size = 10206220, upload-time = "2026-08-24T12:10:53.327Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/1f/2b431554e11687cdb1077e0cdadcc118c53f611086b3af00c8545a67c6a5/maturin-1.15.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:cd35772633f489841132bc8e71d6fc7f842df30b9c05cd5cdf1ee1ddcb744cc7", size = 19416513, upload-time = "2026-08-24T12:10:56.126Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/51/36/e23a21cb34a648b711036b9b2fe1d4f3f4ee24f8db54215d73f1a9a3a3ec/maturin-1.15.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:c40b4eae7bf5ef1f4b1af8d623fe4105016f93578fb15b764e741d08ec3b92dd", size = 10014962, upload-time = "2026-08-24T12:10:58.486Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8c/80/33b15cb2d8f30f12c807955e8f2fd775027692904e30ec0784744ce8cd83/maturin-1.15.0-py3-none-manylinux_2_12_i686.manylinux2010_i686.musllinux_1_1_i686.whl", hash = "sha256:7eb066372f541f8eb4909c79c5d9bd0b9e8125980bdf1ec9e8aba23c6c8d6c55", size = 10196223, upload-time = "2026-08-24T12:11:00.696Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/91/b495e19e2f5c503b540452b2039115e7b2363867e8c5ad4179eb752fa92c/maturin-1.15.0-py3-none-manylinux_2_12_x86_64.manylinux2010_x86_64.musllinux_1_1_x86_64.whl", hash = "sha256:653020a63525bb224e5ab0adf02e17a2e08bc86dbea7fc1399c9a56d7529b99e", size = 10541186, upload-time = "2026-08-24T12:11:02.857Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/5d/2b/2abff58037188d852b124871b1f0d720e1c2bfb3d4f1b03d87c52cd66488/maturin-1.15.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:0ebf9767892725083138e671c34482c660317a2f3d6a29fc0e0f34e9d8c99136", size = 10083468, upload-time = "2026-08-24T12:11:05.012Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/3f/07/b7e9f8be99a6627849e81ac7b6694876bce8f50a92995fe17e3cf2610f0a/maturin-1.15.0-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.musllinux_1_1_armv7l.whl", hash = "sha256:7ab7eebffd7b8debca2265985de4eaeb332141276d24b9560b5ad484d4b3add1", size = 10047786, upload-time = "2026-08-24T12:11:07.042Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/ca/ab/167e3cb7accee11b507dbe53e0e87aeccb376d44ae66284c96ee4df3a9fd/maturin-1.15.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.musllinux_1_1_ppc64le.whl", hash = "sha256:126e12e618b4db42f68c779a56d41f82a390145ba36ac3f621d057eb34f5ad9d", size = 13315332, upload-time = "2026-08-24T12:11:09.433Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/14/4d/801379f646cbc6b00998e5289b0630a886be3a4ee4c75b6bc9b87478a7f1/maturin-1.15.0-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4f9d33e6c3f9615c8caceecbbbd440f8eb25a3ddeb687077682cd5eca2e9ae15", size = 10807183, upload-time = "2026-08-24T12:11:11.73Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/89/27/2e612e1cbd1580e9e94d4722c227b5180dca27b32b955a34b79918aa1292/maturin-1.15.0-py3-none-manylinux_2_31_riscv64.musllinux_1_1_riscv64.whl", hash = "sha256:bf29beddd0c6708f112db51d5275fc28b28b9e9c9c5faae387eaef662918b176", size = 10413274, upload-time = "2026-08-24T12:11:14.04Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/70/d8/202a7b4d75a51f20f84ec9ce3b7345b12b822207072164e2b1c6ef665125/maturin-1.15.0-py3-none-win32.whl", hash = "sha256:da649988be98e87e009e51b1bf0d301b6a301bc0cecbdd60d40d8ba60748d1ca", size = 8928744, upload-time = "2026-08-24T12:11:16.269Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/40/dc/4e90da594986ba78dd3bc8a5921ecdcdb11085b22b02a412caab3b225601/maturin-1.15.0-py3-none-win_amd64.whl", hash = "sha256:552c2be4afd43fe8d5c9f3ec8d4c4756d973b8dcbe94c14084390301f50243e1", size = 10335085, upload-time = "2026-08-24T12:11:18.326Z" },
|
||||
{ url = "https://files.pythonhosted.org/packages/8b/10/15d4314edf130955edf2dc237aa393a8a7c10f2b9b57b89fa2f61f915659/maturin-1.15.0-py3-none-win_arm64.whl", hash = "sha256:c7dc0c66c78d3debdd9c5aa807e861fbcbf07f3505d34b125df74c03986b0f48", size = 9713795, upload-time = "2026-08-24T12:11:20.83Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mccabe"
|
||||
version = "0.7.0"
|
||||
|
|
@ -9911,6 +9956,15 @@ wheels = [
|
|||
{ url = "https://files.pythonhosted.org/packages/ce/13/53c2ab6ac27804769314554a062e0651a44db2360be47e21cf0a29d202ee/traceloop_sdk-0.33.12-py3-none-any.whl", hash = "sha256:d47a474afbf4a68ff38a702dbaca7b17d2d4f0b0e14dc2f1560b6bdd3859ac75", size = 25932, upload-time = "2024-11-13T20:29:25.174Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "trove-classifiers"
|
||||
version = "2026.6.1.19"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/c2/e3/7ca82ee24c82d344584abd5b8637b3bd056f2900226e8d82fc22f1184b92/trove_classifiers-2026.6.1.19.tar.gz", hash = "sha256:c5132b4b61a829d11cfbd2d72e97f20a45ed6edb95e45c5efdeb5e00836b2745", size = 17059, upload-time = "2026-06-01T19:41:34.649Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/a4/81502f486f01db95bc8320646a8a12511f5e556cb63d5e224d91816605c4/trove_classifiers-2026.6.1.19-py3-none-any.whl", hash = "sha256:ab4c4ec93cc4a4e7815fa759906e05e6bb3f2fbd92ea0f897288c6a43efd15b3", size = 14211, upload-time = "2026-06-01T19:41:33.434Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "truststore"
|
||||
version = "0.10.4"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue