perf(build): strip native wheel symbols

This commit is contained in:
Yujong Lee 2026-08-29 17:31:11 -07:00
parent b8f21abc8a
commit 59c86f8380
3 changed files with 14 additions and 5 deletions

View file

@ -269,6 +269,7 @@ manifest-path = "litellm-rust/crates/python-bridge/Cargo.toml"
module-name = "litellm.rust_bridge._native"
python-source = "."
bindings = "pyo3"
strip = true
include = ["litellm/proxy/_experimental/out/**"]
exclude = [
"litellm/proxy/enterprise",

View file

@ -94,18 +94,18 @@ def file_bytes(root: Path) -> int:
return sum(path.stat().st_size for path in root.rglob("*") if path.is_file() and not path.is_symlink())
def git_metadata(source: Path) -> dict[str, object]:
if not source.is_dir():
def git_metadata(source: Path, executable: str | None = shutil.which("git")) -> dict[str, object]:
if not source.is_dir() or executable is None:
return {"path": str(source), "commit": None, "dirty": None}
head: Final = subprocess.run(
("git", "-C", str(source), "rev-parse", "HEAD"),
(executable, "-C", str(source), "rev-parse", "HEAD"),
capture_output=True,
text=True,
)
if head.returncode:
return {"path": str(source), "commit": None, "dirty": None}
status: Final = subprocess.run(
("git", "-C", str(source), "status", "--porcelain"),
(executable, "-C", str(source), "status", "--porcelain"),
capture_output=True,
text=True,
check=True,

View file

@ -11,7 +11,7 @@ from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Final
from bench_sdk import file_bytes, lock_text, snapshot, wheel_info
from bench_sdk import file_bytes, git_metadata, lock_text, snapshot, wheel_info
from bench_sdk_runtime import PROBE, probe, provider, runtime_environment, summary
FAKE_SDK: Final = """
@ -67,6 +67,14 @@ def make_target(directory: Path, code: str = FAKE_SDK) -> Path:
class BenchmarkTests(unittest.TestCase):
def test_git_metadata_tolerates_missing_git(self) -> None:
with tempfile.TemporaryDirectory() as temporary:
root: Final = Path(temporary)
self.assertEqual(
git_metadata(root, executable=None),
{"path": str(root), "commit": None, "dirty": None},
)
def test_parallel_runs_use_distinct_environments_and_outputs(self) -> None:
with tempfile.TemporaryDirectory() as temporary:
root: Final = Path(temporary)