Verify dependency hashes when running Python repository tools (#62346)

## Why

Using `uv run --frozen` keeps dependency resolution fixed but does not require
installed packages to match the hashes in `uv.lock`.

## What changed

Run Ruff for the Python SDK and repository scripts, and regenerate Python SDK
types during repository schema refreshes, through a shared runner. It exports
the selected locked dependencies, installs them into a temporary virtual
environment with `uv pip sync --require-hashes`, and runs the tool without
resyncing the environment.

## Testing

Update tests to check the formatter invocations and verify that only repository
schema refreshes invoke Python type generation through the runner.

GitOrigin-RevId: 4e84da5d227eb99c24efb9a1cc7647af82105536
This commit is contained in:
colby-oai
2026-11-18 19:21:39 +00:00
committed by copyberry
parent 42cf4edfcd
commit 0e011c0092
5 changed files with 69 additions and 15 deletions
@@ -2,8 +2,9 @@
import argparse
import os
from pathlib import Path
import subprocess
import sys
from pathlib import Path
def main() -> None:
@@ -63,11 +64,10 @@ def main() -> None:
sdk_root = workspace_root.parent / "sdk" / "python"
subprocess.run(
[
"uv",
"run",
sys.executable,
str(workspace_root / "scripts" / "run_locked_python_tool.py"),
"--project",
str(sdk_root),
"--frozen",
"--only-group",
"test",
"python",