diff --git a/pyproject.toml b/pyproject.toml index 37b00373f8a..fd0bbd100e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/scripts/bench_sdk.py b/scripts/bench_sdk.py index 8a0ed72e7e5..f80df5b5f00 100644 --- a/scripts/bench_sdk.py +++ b/scripts/bench_sdk.py @@ -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, diff --git a/scripts/test_bench_sdk.py b/scripts/test_bench_sdk.py index 64e702a964e..d838a6440b1 100644 --- a/scripts/test_bench_sdk.py +++ b/scripts/test_bench_sdk.py @@ -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)