mirror of
https://github.com/openai/codex.git
synced 2026-10-19 16:17:49 +00:00
Format Python scripts across the repository (#42109)
## Why The root Python formatting pass only covered `scripts/`, leaving Python utilities elsewhere in the repository outside `just fmt` and `just fmt-check`. ## What changed - Run the scripts Ruff formatter from the repository root. - Exclude `sdk/python`, which has its own formatter pass, and `codex-rs/vendor`. - Apply Ruff formatting to the newly covered Python files and update the formatter coverage test. GitOrigin-RevId: 73ac82b8bb9c713d589724f6c4f926399febb513
This commit is contained in:
@@ -88,8 +88,11 @@ PACKAGE_TARGET_FILTERS: dict[str, str] = {
|
||||
|
||||
PACKAGE_CHOICES = tuple(PACKAGE_NATIVE_COMPONENTS)
|
||||
|
||||
|
||||
def parse_args() -> argparse.Namespace:
|
||||
parser = argparse.ArgumentParser(description="Build or stage the Codex CLI npm package.")
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Build or stage the Codex CLI npm package."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--package",
|
||||
choices=PACKAGE_CHOICES,
|
||||
@@ -102,9 +105,7 @@ def parse_args() -> argparse.Namespace:
|
||||
)
|
||||
parser.add_argument(
|
||||
"--release-version",
|
||||
help=(
|
||||
"Version to stage for npm release."
|
||||
),
|
||||
help=("Version to stage for npm release."),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--staging-dir",
|
||||
@@ -141,7 +142,9 @@ def main() -> int:
|
||||
release_version = args.release_version
|
||||
if release_version:
|
||||
if version and version != release_version:
|
||||
raise RuntimeError("--version and --release-version must match when both are provided.")
|
||||
raise RuntimeError(
|
||||
"--version and --release-version must match when both are provided."
|
||||
)
|
||||
version = release_version
|
||||
|
||||
if not version:
|
||||
@@ -272,7 +275,9 @@ def stage_sources(staging_dir: Path, version: str, package: str) -> None:
|
||||
elif package == "codex-responses-api-proxy":
|
||||
bin_dir = staging_dir / "bin"
|
||||
bin_dir.mkdir(parents=True, exist_ok=True)
|
||||
launcher_src = RESPONSES_API_PROXY_NPM_ROOT / "bin" / "codex-responses-api-proxy.js"
|
||||
launcher_src = (
|
||||
RESPONSES_API_PROXY_NPM_ROOT / "bin" / "codex-responses-api-proxy.js"
|
||||
)
|
||||
shutil.copy2(launcher_src, bin_dir / "codex-responses-api-proxy.js")
|
||||
|
||||
readme_src = RESPONSES_API_PROXY_NPM_ROOT / "README.md"
|
||||
@@ -405,7 +410,10 @@ def copy_native_binaries(
|
||||
missing_targets = sorted(target_filter - copied_targets)
|
||||
if missing_targets:
|
||||
missing_list = ", ".join(missing_targets)
|
||||
raise RuntimeError(f"Missing target directories in vendor source: {missing_list}")
|
||||
raise RuntimeError(
|
||||
f"Missing target directories in vendor source: {missing_list}"
|
||||
)
|
||||
|
||||
|
||||
def run_npm_pack(staging_dir: Path, output_path: Path) -> Path:
|
||||
output_path = output_path.resolve()
|
||||
|
||||
Reference in New Issue
Block a user