Check root Python script formatting in CI (#25165)

## Why

Python files under `scripts/` were not covered by the repository
formatting recipe or the CI formatting job, so formatting drift could
merge unnoticed.

## What

- Add a dedicated `scripts/pyproject.toml` and `scripts/uv.lock` so
root-script formatting uses a locked Ruff version.
- Extend `just fmt` to format root Python scripts and add
`fmt-scripts-check` for CI.
- Run `just fmt-scripts-check` from `.github/workflows/ci.yml`,
installing `uv` through SHA-pinned `astral-sh/setup-uv` while retaining
the `uv` `0.11.3` pin.
- Apply Ruff formatting to the root Python scripts, including
`scripts/just-shell.py`, and extend
`sdk/python/tests/test_artifact_workflow_and_binaries.py` to cover the
root formatting recipe.
- Update `AGENTS.md` so agents run `just fmt` after code changes
anywhere in the repository.

## Validation

- Extended the existing Python SDK workflow test to assert that `just
fmt` includes root Python scripts.
This commit is contained in:
Adam Perry @ OpenAI
2026-06-01 18:50:23 +00:00
committed by GitHub
parent c3cdf3c007
commit 281b416c44
17 changed files with 183 additions and 52 deletions
+17 -4
View File
@@ -44,13 +44,23 @@ def _event_response_done() -> dict[str, Any]:
def _event_response_completed(response_id: str) -> dict[str, Any]:
return {"type": "response.completed", "response": {"id": response_id, "usage": _default_usage()}}
return {
"type": "response.completed",
"response": {"id": response_id, "usage": _default_usage()},
}
def _event_function_call(call_id: str, name: str, arguments_json: str) -> dict[str, Any]:
def _event_function_call(
call_id: str, name: str, arguments_json: str
) -> dict[str, Any]:
return {
"type": "response.output_item.done",
"item": {"type": "function_call", "call_id": call_id, "name": name, "arguments": arguments_json},
"item": {
"type": "function_call",
"call_id": call_id,
"name": name,
"arguments": arguments_json,
},
}
@@ -75,6 +85,7 @@ def _print_request(prefix: str, payload: Any) -> None:
sys.stdout.write(f"{prefix} {_utc_iso()}\n{pretty}\n")
sys.stdout.flush()
async def _handle_connection(
websocket: Any,
*,
@@ -91,7 +102,9 @@ async def _handle_connection(
path_no_qs = path.split("?", 1)[0] if path != "(unknown)" else path
if path_no_qs != "(unknown)" and path_no_qs != expected_path:
sys.stdout.write(f"[conn] {_utc_iso()} rejecting unexpected path (expected {expected_path})\n")
sys.stdout.write(
f"[conn] {_utc_iso()} rejecting unexpected path (expected {expected_path})\n"
)
sys.stdout.flush()
await websocket.close(code=1008, reason="unexpected websocket path")
return