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]

test(build): keep wheel checks outside package

Yujong Lee90eadac40927
diff --git a/litellm/rust_bridge/smoke_test_native_wheel.py b/.github/scripts/smoke_test_native_wheel.py
similarity index 100%
rename from litellm/rust_bridge/smoke_test_native_wheel.py
rename to .github/scripts/smoke_test_native_wheel.py
diff --git a/litellm/rust_bridge/verify_linux_native_wheel.py b/.github/scripts/verify_linux_native_wheel.py
similarity index 100%
rename from litellm/rust_bridge/verify_linux_native_wheel.py
rename to .github/scripts/verify_linux_native_wheel.py
diff --git a/.github/workflows/test-rust.yml b/.github/workflows/test-rust.yml
index 271c73733a3..aada0fcf239 100644
--- a/.github/workflows/test-rust.yml
+++ b/.github/workflows/test-rust.yml
@@ -7,8 +7,8 @@ on:
- ".cargo/**"
- "pyproject.toml"
- "rust-toolchain.toml"
- - "litellm/rust_bridge/smoke_test_native_wheel.py"
- - "litellm/rust_bridge/verify_linux_native_wheel.py"
+ - ".github/scripts/smoke_test_native_wheel.py"
+ - ".github/scripts/verify_linux_native_wheel.py"
- ".github/workflows/test-rust.yml"
pull_request:
branches:
@@ -21,8 +21,8 @@ on:
- ".cargo/**"
- "pyproject.toml"
- "rust-toolchain.toml"
- - "litellm/rust_bridge/smoke_test_native_wheel.py"
- - "litellm/rust_bridge/verify_linux_native_wheel.py"
+ - ".github/scripts/smoke_test_native_wheel.py"
+ - ".github/scripts/verify_linux_native_wheel.py"
- ".github/workflows/test-rust.yml"
permissions:
@@ -115,9 +115,9 @@ jobs:
--config-setting "maturin.build-args=--features panic-test,extension-module"
- name: Smoke-test native panic unwinding
- run: python litellm/rust_bridge/smoke_test_native_wheel.py panic-dist/*.whl
+ run: python .github/scripts/smoke_test_native_wheel.py panic-dist/*.whl
- name: Verify stripped native extension
env:
RELEASE_WHEEL_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
- run: python litellm/rust_bridge/verify_linux_native_wheel.py dist/*.whl
+ run: python .github/scripts/verify_linux_native_wheel.py dist/*.whl
diff --git a/tests/test_litellm/rust_bridge/test_verify_linux_native_wheel.py b/tests/test_litellm/rust_bridge/test_verify_linux_native_wheel.py
index 8d0082dddc1..e449d4392d8 100644
--- a/tests/test_litellm/rust_bridge/test_verify_linux_native_wheel.py
+++ b/tests/test_litellm/rust_bridge/test_verify_linux_native_wheel.py
@@ -1,16 +1,48 @@
from __future__ import annotations
+import importlib.util
import subprocess
+import sys
import zipfile
+from collections.abc import Callable, Mapping, Sequence
from pathlib import Path
from types import MappingProxyType, ModuleType
-from typing import Final
+from typing import Final, Protocol, cast
import pytest
-from litellm.rust_bridge import verify_linux_native_wheel as verifier
-_MODULE_PATH: Final = Path(verifier.__file__)
+class _CommandRunner(Protocol):
+ def __call__(
+ self,
+ command: tuple[str, ...],
+ *,
+ check: bool,
+ capture_output: bool,
+ text: bool,
+ ) -> subprocess.CompletedProcess[str]: ...
+
+
+class _VerifierModule(Protocol):
+ main: Callable[
+ [
+ Sequence[str] | None,
+ Mapping[str, str] | None,
+ Callable[[Path], ModuleType | None],
+ _CommandRunner,
+ ],
+ int,
+ ]
+
+
+_REPO_ROOT: Final = Path(__file__).resolve().parents[3]
+_MODULE_PATH: Final = _REPO_ROOT / ".github" / "scripts" / "verify_linux_native_wheel.py"
+_SPEC: Final = importlib.util.spec_from_file_location("verify_linux_native_wheel", _MODULE_PATH)
+assert _SPEC is not None and _SPEC.loader is not None
+_LOADED_VERIFIER: Final = importlib.util.module_from_spec(_SPEC)
+sys.modules[_SPEC.name] = _LOADED_VERIFIER
+_SPEC.loader.exec_module(_LOADED_VERIFIER)
+verifier: Final = cast(_VerifierModule, _LOADED_VERIFIER)
_EXPECTED_TAG: Final = "cp310-abi3-linux_x86_64"
_NATIVE_MEMBER: Final = "litellm/rust_bridge/_native.abi3.so"