Files
codex/sdk/python/pyproject.toml
Ahmed Ibrahim 8afccec87a Expose Python SDK history selection and per-turn options (#44084)
## Why

Python callers need control over response history loading and a way to override the service tier for one turn. These options also need runtime compatibility checks to prevent older CLIs from silently ignoring them.

## What changed

- Add `include_turns` to sync and async thread resume/fork methods. Omission preserves server defaults; `False` skips response history loading without changing model context.
- Add `turn_service_tier` and `source` to sync and async `run()` and `turn()`, and generate both methods together to keep their options aligned.
- Require CLI `0.151.0` or newer when sending the new options, with lazy schema checks for unversioned local builds.
- Pin the bundled runtime dependency to `0.153.4` and reject unsupported runtime versions during SDK packaging.

## Testing

Add coverage for option forwarding, history flag omission and inversion, runtime version checks, cached schema probing, and packaging compatibility. Extend app-server and installed SDK smoke tests to exercise the new options.

GitOrigin-RevId: 4bcc9cff687b0651e67852e7c080df7fadac6d76
2026-09-09 06:40:56 +00:00

78 lines
1.9 KiB
TOML

[build-system]
requires = ["uv_build>=0.11.19,<0.12"]
build-backend = "uv_build"
[project]
name = "openai-codex"
version = "0.0.0-dev"
description = "Python SDK for Codex"
readme = "README.md"
requires-python = ">=3.10"
license = "Apache-2.0"
authors = [{ name = "OpenAI" }]
keywords = ["codex", "sdk", "llm", "ai", "agents"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = ["pydantic>=2.12", "packaging>=26.2", "openai-codex-cli-bin==0.153.4"]
[project.urls]
Homepage = "https://github.com/openai/codex"
Repository = "https://github.com/openai/codex"
Issues = "https://github.com/openai/codex/issues"
Documentation = "https://github.com/openai/codex/tree/main/sdk/python/docs"
[dependency-groups]
format = ["ruff>=0.15.8"]
test = [
"pytest>=8.0",
"datamodel-code-generator==0.31.2",
{ include-group = "format" },
]
dev = [
{ include-group = "test" },
{ include-group = "format" },
]
[tool.codex.codegen]
schema-dir = "../../codex-rs/app-server-protocol/schema/json"
[tool.pytest.ini_options]
addopts = "-q"
testpaths = ["tests"]
[tool.ruff]
target-version = "py310"
required-version = ">=0.15.8"
line-length = 100
extend-exclude = [
"notebooks/**",
"src/openai_codex/generated/**",
]
[tool.ruff.lint]
select = ["E", "F", "I", "B", "C4"]
ignore = ["E501"]
preview = true
extend-safe-fixes = ["ALL"]
unfixable = ["F841"]
[tool.ruff.lint.per-file-ignores]
"examples/**/*.py" = ["E402"]
"tests/test_real_app_server_integration.py" = ["E402"]
[tool.ruff.lint.isort]
combine-as-imports = true
[tool.uv]
exclude-newer = "7 days"
exclude-newer-package = { openai-codex-cli-bin = "2026-09-09T06:06:45Z" }
index-strategy = "first-index"
[tool.uv.pip]
exclude-newer = "7 days"
exclude-newer-package = { openai-codex-cli-bin = "2026-09-09T06:06:45Z" }
index-strategy = "first-index"