diff --git a/scripts/check_wheel_contents.py b/scripts/check_wheel_contents.py index 72a438f80..3b585b2bf 100644 --- a/scripts/check_wheel_contents.py +++ b/scripts/check_wheel_contents.py @@ -38,6 +38,7 @@ EXPECTED_MODEL_SHA256 = { ), } MAX_BASE_WHEEL_BYTES = 4 * 1024 * 1024 +MAX_BASE_PLATFORM_WHEEL_BYTES = 6 * 1024 * 1024 MAX_CORE_WHEEL_BYTES = 30 * 1024 * 1024 CORE_REQUIRED_SDIST_MEMBERS = { "core/Cargo.lock", @@ -100,6 +101,9 @@ def _onnx_members(path: Path) -> list[str]: def check_base_wheel(path: Path, max_bytes: int) -> list[str]: errors: list[str] = [] + if not path.name.endswith("-any.whl"): + # platform base wheels bundle the notarized parakeet helper binary + max_bytes = max(max_bytes, MAX_BASE_PLATFORM_WHEEL_BYTES) size = path.stat().st_size if size > max_bytes: errors.append(f"{path.name}: base wheel is {size} bytes; max is {max_bytes}") diff --git a/tests/test_check_wheel_contents.py b/tests/test_check_wheel_contents.py index c97db35a8..f0ac6e935 100644 --- a/tests/test_check_wheel_contents.py +++ b/tests/test_check_wheel_contents.py @@ -136,6 +136,28 @@ def test_base_wheel_validator_rejects_tests_path_segment(tmp_path: Path) -> None ) +def test_base_wheel_platform_cap_allows_bundled_helper(tmp_path: Path) -> None: + within = tmp_path / "solstone-1.2.3-py3-none-macosx_14_0_arm64.whl" + with zipfile.ZipFile(within, "w") as wheel: + _write_member( + wheel, + "solstone-1.2.3.data/scripts/helper", + b"x" * (5 * 1024 * 1024), + ) + within_errors = checker.check_base_wheel(within, checker.MAX_BASE_WHEEL_BYTES) + assert not [error for error in within_errors if "base wheel is" in error] + + oversized = tmp_path / "solstone_big-1.2.3-py3-none-macosx_14_0_arm64.whl" + with zipfile.ZipFile(oversized, "w") as wheel: + _write_member( + wheel, + "solstone_big-1.2.3.data/scripts/helper", + b"x" * (7 * 1024 * 1024), + ) + oversized_errors = checker.check_base_wheel(oversized, checker.MAX_BASE_WHEEL_BYTES) + assert any("base wheel is" in error for error in oversized_errors) + + def _add_tar_member(archive: tarfile.TarFile, name: str) -> None: content = b"x" info = tarfile.TarInfo(name)