test(build): keep wheel checks outside package

This commit is contained in:
Yujong Lee 2026-09-02 06:55:19 -07:00 committed by GitHub
parent 814204e21f
commit 90eadac409
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 9 deletions

View file

@ -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

View file

@ -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"