From ab37871a9eb664907d4bddd9ace0f43556a7cc4f Mon Sep 17 00:00:00 2001 From: yucheng Date: Thu, 24 Sep 2026 11:06:45 +0000 Subject: [PATCH] build(fips): ship the build backend shim in the sdist Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- pyproject.toml | 1 + .../test_litellm_build_backend.py | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fb177a64351..56f198eea9b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -320,6 +320,7 @@ include = [ "litellm/router_strategy/complexity_router/artifacts/*.json", "litellm/router_strategy/complexity_router/fuse_presets.json", "litellm/proxy/client/cli/commands/codex_base_instructions.md", + { path = "scripts/litellm_build_backend.py", format = "sdist" }, ] exclude = [ "litellm/proxy/enterprise", diff --git a/tests/test_litellm/test_litellm_build_backend.py b/tests/test_litellm/test_litellm_build_backend.py index b0f6cf2f73d..4a1a473cc3a 100644 --- a/tests/test_litellm/test_litellm_build_backend.py +++ b/tests/test_litellm/test_litellm_build_backend.py @@ -1,6 +1,7 @@ import os import subprocess import sys +import tarfile import zipfile from pathlib import Path from typing import Final @@ -68,3 +69,25 @@ def test_without_the_switch_the_hooks_are_maturins() -> None: ) assert result.returncode == 0, f"returncode={result.returncode} stderr={result.stderr}" assert result.stdout.strip() == "True", result.stdout + + +def test_sdist_carries_the_build_backend(tmp_path: Path) -> None: + result: Final = subprocess.run( + [ + sys.executable, + "-P", + "-c", + "import sys, litellm_build_backend as b; print(b.build_sdist(sys.argv[1]))", + str(tmp_path), + ], + cwd=REPO_ROOT, + env=_backend_env(), + capture_output=True, + text=True, + ) + assert result.returncode == 0, f"returncode={result.returncode} stderr={result.stderr}" + sdist: Final = tmp_path / result.stdout.strip().splitlines()[-1] + assert sdist.is_file(), f"sdist not produced: stdout={result.stdout} stderr={result.stderr}" + names: Final = tuple(tarfile.open(sdist).getnames()) + assert any(name.endswith("scripts/litellm_build_backend.py") for name in names), names + assert any(name.endswith("/pyproject.toml") for name in names), names