Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

[Fix] Fix test failures and Docker build from pinned dependency upgrade

Yuneng Jiang7b277d36cd71
diff --git a/docker/build_from_pip/Dockerfile.build_from_pip b/docker/build_from_pip/Dockerfile.build_from_pip
index 6ac5f970670..f26b993cce5 100644
--- a/docker/build_from_pip/Dockerfile.build_from_pip
+++ b/docker/build_from_pip/Dockerfile.build_from_pip
@@ -1,16 +1,14 @@
-FROM python:3.13-alpine@sha256:bb1f2fdb1065c85468775c9d680dcd344f6442a2d1181ef7916b60a623f11d40
+FROM python:3.13-slim@sha256:739e7213785e88c0f702dcdc12c0973afcbd606dbf021a589cab77d6b00b579d
WORKDIR /app
ENV HOME=/home/litellm
ENV PATH="${HOME}/venv/bin:$PATH"
-# Install runtime dependencies
-# Note: Using Python 3.13 for compatibility with ddtrace and other packages
-# rust and cargo are required for building ddtrace from source
-# musl-dev and libffi-dev are needed for some Python packages on Alpine
-RUN apk update && \
- apk add --no-cache gcc musl-dev libffi-dev openssl openssl-dev rust cargo
+# Install runtime dependencies needed for building native extensions
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends gcc libffi-dev && \
+ rm -rf /var/lib/apt/lists/*
RUN python -m venv ${HOME}/venv
RUN ${HOME}/venv/bin/pip install --no-cache-dir --upgrade pip==26.0.1
@@ -28,4 +26,4 @@ RUN prisma generate
EXPOSE 4000/tcp
ENTRYPOINT ["litellm"]
-CMD ["--port", "4000"]
\ No newline at end of file
+CMD ["--port", "4000"]
diff --git a/tests/test_litellm/proxy/middleware/test_in_flight_requests_middleware.py b/tests/test_litellm/proxy/middleware/test_in_flight_requests_middleware.py
index 830bca49936..07da6f6d0e6 100644
--- a/tests/test_litellm/proxy/middleware/test_in_flight_requests_middleware.py
+++ b/tests/test_litellm/proxy/middleware/test_in_flight_requests_middleware.py
@@ -92,7 +92,7 @@ def test_non_http_scopes_not_counted():
mw = InFlightRequestsMiddleware(_InnerApp())
- asyncio.get_event_loop().run_until_complete(
+ asyncio.run(
mw({"type": "lifespan"}, None, None) # type: ignore[arg-type]
)
assert get_in_flight_requests() == 0
diff --git a/tests/test_litellm/router_strategy/test_base_routing_strategy.py b/tests/test_litellm/router_strategy/test_base_routing_strategy.py
index 2ce144e9a99..02a6ce4be2a 100644
--- a/tests/test_litellm/router_strategy/test_base_routing_strategy.py
+++ b/tests/test_litellm/router_strategy/test_base_routing_strategy.py
@@ -20,7 +20,7 @@ from litellm.router_strategy.base_routing_strategy import BaseRoutingStrategy
@pytest.fixture
-def mock_dual_cache():
+async def mock_dual_cache():
dual_cache = MagicMock(spec=DualCache)
dual_cache.in_memory_cache = MagicMock()
dual_cache.redis_cache = MagicMock()
@@ -47,7 +47,7 @@ def mock_dual_cache():
@pytest.fixture
-def base_strategy(mock_dual_cache):
+async def base_strategy(mock_dual_cache):
return BaseRoutingStrategy(
dual_cache=mock_dual_cache,
should_batch_redis_writes=False,
@@ -137,7 +137,8 @@ async def test_sync_in_memory_spend_with_redis(base_strategy, mock_dual_cache):
assert len(base_strategy.in_memory_keys_to_update) == 1
-def test_cache_keys_management(base_strategy):
+async def test_cache_keys_management(base_strategy):
# Test adding and getting cache keys
base_strategy.add_to_in_memory_keys_to_update("key1")
base_strategy.add_to_in_memory_keys_to_update("key2")