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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
ci: harden cargo fetches during maturin builds (#31348)
ishaan-berria2d04ccdbb27
diff --git a/litellm-rust/.cargo/config.toml b/.cargo/config.tomlsimilarity index 66%rename from litellm-rust/.cargo/config.tomlrename to .cargo/config.tomlindex c7fb2592542..e6afd7ff530 100644--- a/litellm-rust/.cargo/config.toml+++ b/.cargo/config.toml@@ -1,3 +1,12 @@+[http]+# CI has seen transient crates.io failures from libcurl's HTTP/2 multiplexing+# during `maturin` metadata resolution. Disable multiplexing and retry more+# aggressively so editable `uv sync` builds are not failed by one flaky frame.+multiplexing = false++[net]+retry = 5+# PyO3 cdylib (`litellm-python-bridge`) links against the host interpreter's# symbols, which are not present at link time when building an extension module.# On macOS, tell the linker to resolve undefined `_Py*` symbols dynamically atdiff --git a/.circleci/config.yml b/.circleci/config.ymlindex d532d3106e5..337f4b5b3f3 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -190,6 +190,8 @@ jobs:working_directory: ~/projectenvironment:UV_PYTHON: "3.11"+ CARGO_HTTP_MULTIPLEXING: "false"+ CARGO_NET_RETRY: "5"steps:- checkout- run:@@ -243,7 +245,17 @@ jobs:if (-not (Select-String -Path $PROFILE -SimpleMatch $cargoBin -Quiet)) {Add-Content -Path $PROFILE -Value "`$env:Path = `"$cargoBin;`$env:Path`""}- uv sync --frozen --group dev --python 3.11+ for ($attempt = 1; $attempt -le 5; $attempt++) {+ Write-Host "uv sync attempt $attempt/5"+ uv sync --frozen --group dev --python 3.11+ if ($LASTEXITCODE -eq 0) {+ break+ }+ if ($attempt -eq 5) {+ exit $LASTEXITCODE+ }+ Start-Sleep -Seconds 15+ }- run:name: Run Windows-specific testcommand: |@@ -255,6 +267,7 @@ jobs:command: |$env:Path = "$HOME\.cargo\bin;$HOME\.local\bin;$env:Path"cargo --version+ Get-ChildItem -Path "litellm\rust_bridge" -Filter "_native*" -File -ErrorAction SilentlyContinue | Remove-Item -Forceuv build --wheel --out-dir distuv run --no-sync python tests/windows_tests/check_windows_wheel_install.pydiff --git a/.github/scripts/uv_sync_with_retries.sh b/.github/scripts/uv_sync_with_retries.shnew file mode 100755index 00000000000..85ed75af566--- /dev/null+++ b/.github/scripts/uv_sync_with_retries.sh@@ -0,0 +1,31 @@+#!/usr/bin/env bash+set -euo pipefail++max_attempts="${UV_SYNC_MAX_ATTEMPTS:-5}"+delay_seconds="${UV_SYNC_RETRY_DELAY_SECONDS:-15}"++export CARGO_HTTP_MULTIPLEXING="${CARGO_HTTP_MULTIPLEXING:-false}"+export CARGO_NET_RETRY="${CARGO_NET_RETRY:-5}"++if [[ "$#" -eq 0 ]]; then+ echo "usage: $0 <uv sync args...>" >&2+ exit 2+fi++for attempt in $(seq 1 "${max_attempts}"); do+ echo "uv sync attempt ${attempt}/${max_attempts}"+ status=0+ if uv sync "$@"; then+ exit 0+ else+ status=$?+ fi++ if [[ "${attempt}" -eq "${max_attempts}" ]]; then+ echo "uv sync failed after ${max_attempts} attempts" >&2+ exit "${status}"+ fi++ echo "uv sync failed; retrying in ${delay_seconds}s..."+ sleep "${delay_seconds}"+donediff --git a/.github/workflows/_test-unit-base.yml b/.github/workflows/_test-unit-base.ymlindex a42b2f8f9df..25c6d4a7019 100644--- a/.github/workflows/_test-unit-base.yml+++ b/.github/workflows/_test-unit-base.yml@@ -73,7 +73,7 @@ jobs:- name: Install dependenciesrun: |- uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router+ .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router- name: Generate Prisma clientenv:diff --git a/.github/workflows/check-ui-api-types.yml b/.github/workflows/check-ui-api-types.ymlindex d8053c15683..439126aa1ee 100644--- a/.github/workflows/check-ui-api-types.yml+++ b/.github/workflows/check-ui-api-types.yml@@ -46,7 +46,7 @@ jobs:${{ runner.os }}-uv-- name: Install backend dependencies- run: uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router+ run: .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router- name: Generate Prisma clientenv:diff --git a/.github/workflows/mutation-test.yml b/.github/workflows/mutation-test.ymlindex 8094ca57467..183f12f969c 100644--- a/.github/workflows/mutation-test.yml+++ b/.github/workflows/mutation-test.yml@@ -55,7 +55,7 @@ jobs:- name: Install dependenciesrun: |- uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router+ .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router- name: Generate Prisma clientenv:diff --git a/.github/workflows/test-mcp.yml b/.github/workflows/test-mcp.ymlindex cefb77980ac..5b5290880c1 100644--- a/.github/workflows/test-mcp.yml+++ b/.github/workflows/test-mcp.yml@@ -39,7 +39,7 @@ jobs:- name: Install dependenciesrun: |uv lock --check- uv sync --frozen --group proxy-dev --extra proxy --extra semantic-router+ .github/scripts/uv_sync_with_retries.sh --frozen --group proxy-dev --extra proxy --extra semantic-router- name: Run MCP testsrun: |diff --git a/.github/workflows/test-unit-documentation.yml b/.github/workflows/test-unit-documentation.ymlindex 8ad9fb6a73b..4cef791a9b3 100644--- a/.github/workflows/test-unit-documentation.yml+++ b/.github/workflows/test-unit-documentation.yml@@ -54,7 +54,7 @@ jobs:- name: Install dependenciesrun: |- uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router+ .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router- name: Generate Prisma clientenv:diff --git a/.github/workflows/test-unit-proxy-legacy.yml b/.github/workflows/test-unit-proxy-legacy.ymlindex 922e3c2eddf..8db218cd1fc 100644--- a/.github/workflows/test-unit-proxy-legacy.yml+++ b/.github/workflows/test-unit-proxy-legacy.yml@@ -71,7 +71,7 @@ jobs:- name: Install dependenciesrun: |- uv sync --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router+ .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router- name: Generate Prisma clientenv:diff --git a/pyproject.toml b/pyproject.tomlindex 30b9a84e09a..6a6a47f540e 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -234,7 +234,7 @@ healthcheck = [][build-system]-requires = ["maturin>=1.9.4,<2"]+requires = ["maturin==1.9.4"]build-backend = "maturin"[tool.maturin]