Vendor Codex and land Phase 1 Epiphany state slice

This commit is contained in:
Meta Vens 2026-04-23 23:20:16 +01:00
commit 2042687e30
3959 changed files with 953751 additions and 7 deletions

View file

@ -0,0 +1,9 @@
# Codex CLI Runtime for Python SDK
Platform-specific runtime package consumed by the published `codex-app-server-sdk`.
This package is staged during release so the SDK can pin an exact Codex CLI
version without checking platform binaries into the repo.
`openai-codex-cli-bin` is intentionally wheel-only. Do not build or publish an
sdist for this package.

View file

@ -0,0 +1,30 @@
from __future__ import annotations
import os
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
def _platform_tag() -> str:
from packaging.tags import sys_tags
return next(iter(sys_tags())).platform
class RuntimeBuildHook(BuildHookInterface):
def initialize(self, version: str, build_data: dict[str, object]) -> None:
del version
if self.target_name == "sdist":
raise RuntimeError(
"openai-codex-cli-bin is wheel-only; build and publish platform wheels only."
)
platform_tag = self.config.get("platform-tag") or os.environ.get(
"CODEX_CLI_BIN_PLATFORM_TAG"
)
if not isinstance(platform_tag, str) or not platform_tag:
platform_tag = _platform_tag()
build_data["pure_python"] = False
build_data["infer_tag"] = False
build_data["tag"] = f"py3-none-{platform_tag}"

View file

@ -0,0 +1,45 @@
[build-system]
requires = ["hatchling>=1.24.0"]
build-backend = "hatchling.build"
[project]
name = "openai-codex-cli-bin"
version = "0.0.0-dev"
description = "Pinned Codex CLI runtime for the Python SDK"
readme = "README.md"
requires-python = ">=3.10"
license = { text = "Apache-2.0" }
authors = [{ name = "OpenAI" }]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
[project.urls]
Homepage = "https://github.com/openai/codex"
Repository = "https://github.com/openai/codex"
Issues = "https://github.com/openai/codex/issues"
[tool.hatch.build]
exclude = [
".venv/**",
".pytest_cache/**",
"dist/**",
"build/**",
]
[tool.hatch.build.targets.wheel]
packages = ["src/codex_cli_bin"]
include = ["src/codex_cli_bin/bin/**"]
[tool.hatch.build.targets.wheel.hooks.custom]
[tool.hatch.build.targets.sdist]
[tool.hatch.build.targets.sdist.hooks.custom]

View file

@ -0,0 +1,19 @@
from __future__ import annotations
import os
from pathlib import Path
PACKAGE_NAME = "openai-codex-cli-bin"
def bundled_codex_path() -> Path:
exe = "codex.exe" if os.name == "nt" else "codex"
path = Path(__file__).resolve().parent / "bin" / exe
if not path.is_file():
raise FileNotFoundError(
f"{PACKAGE_NAME} is installed but missing its packaged codex binary at {path}"
)
return path
__all__ = ["PACKAGE_NAME", "bundled_codex_path"]