sdk/python: always regenerate types before staging

This commit is contained in:
sdcoffey
2026-03-13 17:04:21 -07:00
parent c9230a345d
commit 2fc0ca1ec8
5 changed files with 2 additions and 110 deletions

View File

@@ -71,12 +71,10 @@ python scripts/update_sdk_artifacts.py generate-types
python scripts/update_sdk_artifacts.py \
stage-sdk-core \
/tmp/codex-python-release/codex-app-server-sdk-core \
--skip-generate-types \
--sdk-version 1.2.3
python scripts/update_sdk_artifacts.py \
stage-sdk \
/tmp/codex-python-release/codex-app-server-sdk \
--skip-generate-types \
--sdk-version 1.2.3 \
--runtime-version 1.2.3
python scripts/update_sdk_artifacts.py \

View File

@@ -50,12 +50,10 @@ python scripts/update_sdk_artifacts.py generate-types
python scripts/update_sdk_artifacts.py \
stage-sdk-core \
/tmp/codex-python-release/codex-app-server-sdk-core \
--skip-generate-types \
--sdk-version 1.2.3
python scripts/update_sdk_artifacts.py \
stage-sdk \
/tmp/codex-python-release/codex-app-server-sdk \
--skip-generate-types \
--sdk-version 1.2.3 \
--runtime-version 1.2.3
python scripts/update_sdk_artifacts.py \

View File

@@ -981,11 +981,6 @@ def build_parser() -> argparse.ArgumentParser:
"--sdk-version",
help="Version to write into the staged core SDK package (defaults to sdk/python current version)",
)
stage_sdk_core_parser.add_argument(
"--skip-generate-types",
action="store_true",
help="Skip type generation before staging when artifacts were generated earlier in the workflow",
)
stage_sdk_parser = subparsers.add_parser(
"stage-sdk",
@@ -1005,11 +1000,6 @@ def build_parser() -> argparse.ArgumentParser:
"--sdk-version",
help="Version to write into the staged bundled SDK package (defaults to sdk/python current version)",
)
stage_sdk_parser.add_argument(
"--skip-generate-types",
action="store_true",
help="Skip type generation before staging when artifacts were generated earlier in the workflow",
)
stage_runtime_parser = subparsers.add_parser(
"stage-runtime",
@@ -1051,15 +1041,13 @@ def run_command(args: argparse.Namespace, ops: CliOps) -> None:
if args.command == "generate-types":
ops.generate_types()
elif args.command == "stage-sdk-core":
if not args.skip_generate_types:
ops.generate_types()
ops.generate_types()
ops.stage_python_core_sdk_package(
args.staging_dir,
args.sdk_version or ops.current_sdk_version(),
)
elif args.command == "stage-sdk":
if not args.skip_generate_types:
ops.generate_types()
ops.generate_types()
ops.stage_python_sdk_package(
args.staging_dir,
args.sdk_version or ops.current_sdk_version(),

View File

@@ -318,50 +318,6 @@ def test_stage_sdk_core_runs_type_generation_before_staging(tmp_path: Path) -> N
assert calls == ["generate_types", "stage_sdk_core"]
def test_stage_sdk_core_can_skip_type_generation(tmp_path: Path) -> None:
script = _load_update_script_module()
calls: list[str] = []
args = script.parse_args(
[
"stage-sdk-core",
str(tmp_path / "sdk-core-stage"),
"--skip-generate-types",
]
)
def fake_generate_types() -> None:
calls.append("generate_types")
def fake_stage_core_sdk_package(_staging_dir: Path, _sdk_version: str) -> Path:
calls.append("stage_sdk_core")
return tmp_path / "sdk-core-stage"
def fake_stage_sdk_package(
_staging_dir: Path, _sdk_version: str, _runtime_version: str
) -> Path:
raise AssertionError("bundled sdk staging should not run for stage-sdk-core")
def fake_stage_runtime_package(
_staging_dir: Path, _runtime_version: str, _runtime_binary: Path
) -> Path:
raise AssertionError("runtime staging should not run for stage-sdk-core")
def fake_current_sdk_version() -> str:
return "0.2.0"
ops = script.CliOps(
generate_types=fake_generate_types,
stage_python_core_sdk_package=fake_stage_core_sdk_package,
stage_python_sdk_package=fake_stage_sdk_package,
stage_python_runtime_package=fake_stage_runtime_package,
current_sdk_version=fake_current_sdk_version,
)
script.run_command(args, ops)
assert calls == ["stage_sdk_core"]
def test_stage_sdk_runs_type_generation_before_staging(tmp_path: Path) -> None:
script = _load_update_script_module()
calls: list[str] = []
@@ -407,52 +363,6 @@ def test_stage_sdk_runs_type_generation_before_staging(tmp_path: Path) -> None:
assert calls == ["generate_types", "stage_sdk"]
def test_stage_sdk_can_skip_type_generation(tmp_path: Path) -> None:
script = _load_update_script_module()
calls: list[str] = []
args = script.parse_args(
[
"stage-sdk",
str(tmp_path / "sdk-stage"),
"--runtime-version",
"1.2.3",
"--skip-generate-types",
]
)
def fake_generate_types() -> None:
calls.append("generate_types")
def fake_stage_core_sdk_package(_staging_dir: Path, _sdk_version: str) -> Path:
raise AssertionError("core sdk staging should not run for stage-sdk")
def fake_stage_sdk_package(
_staging_dir: Path, _sdk_version: str, _runtime_version: str
) -> Path:
calls.append("stage_sdk")
return tmp_path / "sdk-stage"
def fake_stage_runtime_package(
_staging_dir: Path, _runtime_version: str, _runtime_binary: Path
) -> Path:
raise AssertionError("runtime staging should not run for stage-sdk")
def fake_current_sdk_version() -> str:
return "0.2.0"
ops = script.CliOps(
generate_types=fake_generate_types,
stage_python_core_sdk_package=fake_stage_core_sdk_package,
stage_python_sdk_package=fake_stage_sdk_package,
stage_python_runtime_package=fake_stage_runtime_package,
current_sdk_version=fake_current_sdk_version,
)
script.run_command(args, ops)
assert calls == ["stage_sdk"]
def test_stage_runtime_stages_binary_without_type_generation(tmp_path: Path) -> None:
script = _load_update_script_module()
fake_binary = tmp_path / script.runtime_binary_name()