Base: codex-main originale (prima del fork aKode)
This commit is contained in:
9
sdk/python-runtime/README.md
Normal file
9
sdk/python-runtime/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Codex CLI Runtime for Python SDK
|
||||
|
||||
Platform-specific runtime package consumed by the published `openai-codex`.
|
||||
|
||||
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.
|
||||
30
sdk/python-runtime/hatch_build.py
Normal file
30
sdk/python-runtime/hatch_build.py
Normal 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}"
|
||||
57
sdk/python-runtime/pyproject.toml
Normal file
57
sdk/python-runtime/pyproject.toml
Normal file
@@ -0,0 +1,57 @@
|
||||
[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 = [
|
||||
"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/codex-package.json",
|
||||
"src/codex_cli_bin/bin/**",
|
||||
"src/codex_cli_bin/codex-resources/**",
|
||||
"src/codex_cli_bin/codex-path/**",
|
||||
]
|
||||
|
||||
[tool.hatch.build.targets.wheel.hooks.custom]
|
||||
|
||||
[tool.hatch.build.targets.sdist]
|
||||
|
||||
[tool.hatch.build.targets.sdist.hooks.custom]
|
||||
|
||||
[tool.uv]
|
||||
exclude-newer = "7 days"
|
||||
index-strategy = "first-index"
|
||||
|
||||
[tool.uv.pip]
|
||||
exclude-newer = "7 days"
|
||||
index-strategy = "first-index"
|
||||
38
sdk/python-runtime/src/codex_cli_bin/__init__.py
Normal file
38
sdk/python-runtime/src/codex_cli_bin/__init__.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
PACKAGE_NAME = "openai-codex-cli-bin"
|
||||
PACKAGE_METADATA_FILENAME = "codex-package.json"
|
||||
|
||||
|
||||
def bundled_package_dir() -> Path:
|
||||
path = Path(__file__).resolve().parent
|
||||
metadata_path = path / PACKAGE_METADATA_FILENAME
|
||||
if not metadata_path.is_file():
|
||||
raise FileNotFoundError(
|
||||
f"{PACKAGE_NAME} is installed but missing its package metadata at {metadata_path}"
|
||||
)
|
||||
return path
|
||||
|
||||
|
||||
def bundled_codex_path() -> Path:
|
||||
exe = "codex.exe" if os.name == "nt" else "codex"
|
||||
path = bundled_package_dir() / "bin" / exe
|
||||
if not path.is_file():
|
||||
raise FileNotFoundError(
|
||||
f"{PACKAGE_NAME} is installed but missing its packaged codex binary at {path}"
|
||||
)
|
||||
return path
|
||||
|
||||
|
||||
def bundled_path_dir() -> Path | None:
|
||||
path = bundled_package_dir() / "codex-path"
|
||||
return path if path.is_dir() else None
|
||||
|
||||
|
||||
__all__ = [
|
||||
"PACKAGE_NAME",
|
||||
"bundled_codex_path",
|
||||
"bundled_package_dir",
|
||||
"bundled_path_dir",
|
||||
]
|
||||
12
sdk/python-runtime/uv.lock
generated
Normal file
12
sdk/python-runtime/uv.lock
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
version = 1
|
||||
revision = 3
|
||||
requires-python = ">=3.10"
|
||||
|
||||
[options]
|
||||
exclude-newer = "2026-04-16T16:29:01.518541933Z"
|
||||
exclude-newer-span = "P7D"
|
||||
|
||||
[[package]]
|
||||
name = "openai-codex-cli-bin"
|
||||
version = "0.0.0.dev0"
|
||||
source = { editable = "." }
|
||||
Reference in New Issue
Block a user