Skip to content

[4/8] Define Python SDK public API surface#21896

Merged
aibrahim-oai merged 3 commits into
mainfrom
codex/python-sdk-public-root-api
May 11, 2026
Merged

[4/8] Define Python SDK public API surface#21896
aibrahim-oai merged 3 commits into
mainfrom
codex/python-sdk-public-root-api

Conversation

@aibrahim-oai

@aibrahim-oai aibrahim-oai commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Why

The SDK package root should be the ergonomic public client API, not a dump of every generated app-server schema type. Generated models still need a supported import path, but callers should be able to tell which names are high-level SDK entrypoints and which names are protocol value models.

What

  • Define a curated root __all__ for clients, handles, input helpers, retry helpers, config, and public errors.
  • Add a types module as the supported home for generated app-server response, event, enum, and helper models.
  • Update docs and examples to import protocol/value models from the type module.
  • Add tests that lock root exports, type-module exports, star-import behavior, and example import hygiene.

Stack

  1. [1/8] Pin Python SDK runtime dependency #21891 [1/8] Pin Python SDK runtime dependency
  2. [2/8] Generate Python SDK types from pinned runtime #21893 [2/8] Generate Python SDK types from pinned runtime
  3. [3/8] Run Python SDK tests in CI #21895 [3/8] Run Python SDK tests in CI
  4. This PR [4/8] Define Python SDK public API surface
  5. [5/8] Rename Python SDK package to openai-codex #21905 [5/8] Rename Python SDK package to openai-codex
  6. [6/8] Add high-level Python SDK approval mode #21910 [6/8] Add high-level Python SDK approval mode
  7. [7/8] Add Python SDK app-server integration harness #22014 [7/8] Add Python SDK app-server integration harness
  8. [8/8] Add Python SDK Ruff formatting #22021 [8/8] Add Python SDK Ruff formatting

Verification

  • Added public API signature tests for root exports, types exports, and example imports.

@aibrahim-oai

aibrahim-oai commented May 9, 2026

Copy link
Copy Markdown
Collaborator Author

@aibrahim-oai aibrahim-oai changed the title [4/4] Narrow Python SDK root exports [4/4] Define Python SDK public API surface May 9, 2026
@aibrahim-oai aibrahim-oai changed the title [4/4] Define Python SDK public API surface [4/4] Define Python SDK public package surface May 9, 2026
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-public-root-api branch from 78c0d5c to 9306e60 Compare May 9, 2026 08:43
@aibrahim-oai aibrahim-oai changed the title [4/4] Define Python SDK public package surface [4/5] Define Python SDK public API surface May 9, 2026
@aibrahim-oai aibrahim-oai changed the title [4/5] Define Python SDK public API surface [4/6] Define Python SDK public API surface May 9, 2026
@aibrahim-oai aibrahim-oai changed the title [4/6] Define Python SDK public API surface [4/7] Define Python SDK public API surface May 10, 2026
@aibrahim-oai aibrahim-oai changed the title [4/7] Define Python SDK public API surface [4/8] Define Python SDK public API surface May 10, 2026
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-ci branch from 8b8e868 to e29f628 Compare May 11, 2026 21:29
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-public-root-api branch from 9306e60 to f238ced Compare May 11, 2026 21:30
aibrahim-oai added a commit that referenced this pull request May 11, 2026
## Why

The Python SDK depends on the app-server runtime package for the bundled
`codex` binary and schema source of truth. That relationship should be
explicit in package metadata instead of inferred from matching version
numbers, so installers, lockfiles, and reviewers can see exactly which
runtime the SDK expects.

## What

- Declare `openai-codex-cli-bin==0.131.0a4` as a Python SDK dependency.
- Update runtime setup helpers to resolve the runtime version from the
declared dependency pin.
- Refresh the SDK lockfile for the pinned runtime wheel.
- Update package/runtime tests and docs that describe where the runtime
version comes from.

## Stack

1. This PR `[1/8]` Pin Python SDK runtime dependency
2. #21893 `[2/8]` Generate Python SDK types from pinned runtime
3. #21895 `[3/8]` Run Python SDK tests in CI
4. #21896 `[4/8]` Define Python SDK public API surface
5. #21905 `[5/8]` Rename Python SDK package to `openai-codex`
6. #21910 `[6/8]` Add high-level Python SDK approval mode
7. #22014 `[7/8]` Add Python SDK app-server integration harness
8. #22021 `[8/8]` Add Python SDK Ruff formatting

## Verification

- Added coverage for the SDK runtime dependency pin and runtime
distribution naming.

---------

Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-ci branch from e29f628 to 3c12a5f Compare May 11, 2026 21:49
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-public-root-api branch from f238ced to cc8582f Compare May 11, 2026 21:49
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-ci branch from 3c12a5f to 74d9f69 Compare May 11, 2026 21:51
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-public-root-api branch from cc8582f to 2b65982 Compare May 11, 2026 21:51
aibrahim-oai added a commit that referenced this pull request May 11, 2026
## Why

Once the SDK declares its runtime package, generated Python artifacts
should come from that pinned runtime rather than whatever app-server
schema happens to be in the current checkout. That keeps the generated
API and model surface aligned with the runtime users install.

## What

- Teach `scripts/update_sdk_artifacts.py generate-types` to invoke the
pinned runtime package for schema generation.
- Regenerate `v2_all.py`, `notification_registry.py`, and generated
public wrapper methods from that schema.
- Add freshness coverage so regenerating from the pinned runtime must
leave checked-in artifacts unchanged.

## Stack

1. #21891 `[1/8]` Pin Python SDK runtime dependency
2. This PR `[2/8]` Generate Python SDK types from pinned runtime
3. #21895 `[3/8]` Run Python SDK tests in CI
4. #21896 `[4/8]` Define Python SDK public API surface
5. #21905 `[5/8]` Rename Python SDK package to `openai-codex`
6. #21910 `[6/8]` Add high-level Python SDK approval mode
7. #22014 `[7/8]` Add Python SDK app-server integration harness
8. #22021 `[8/8]` Add Python SDK Ruff formatting

## Verification

- Added `test_generated_files_are_up_to_date` for pinned-runtime
generation drift.
- Added generator-structure tests for schema annotation and notification
metadata generation.

---------

Co-authored-by: Codex <noreply@openai.com>
aibrahim-oai added a commit that referenced this pull request May 11, 2026
## Why

The Python SDK stack now depends on packaging metadata, pinned runtime
wheels, generated artifacts, async behavior, and stream interleaving.
Those checks need to run in CI so future changes cannot bypass the SDK
test suite.

## What

- Add a dedicated `python-sdk` job to `.github/workflows/sdk.yml`.
- Run the job in `python:3.12-alpine` so dependency resolution exercises
the pinned musl runtime wheel.
- Keep the Python SDK test job parallel to the existing SDK job instead
of serializing the full workflow.

## Stack

1. #21891 `[1/8]` Pin Python SDK runtime dependency
2. #21893 `[2/8]` Generate Python SDK types from pinned runtime
3. This PR `[3/8]` Run Python SDK tests in CI
4. #21896 `[4/8]` Define Python SDK public API surface
5. #21905 `[5/8]` Rename Python SDK package to `openai-codex`
6. #21910 `[6/8]` Add high-level Python SDK approval mode
7. #22014 `[7/8]` Add Python SDK app-server integration harness
8. #22021 `[8/8]` Add Python SDK Ruff formatting

## Verification

- The added workflow job installs the SDK with `uv sync --extra dev
--frozen` and runs the Python SDK pytest suite.

---------

Co-authored-by: Codex <noreply@openai.com>
Base automatically changed from codex/python-sdk-ci to main May 11, 2026 21:53
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-public-root-api branch from 2b65982 to 3a0ab40 Compare May 11, 2026 21:55
aibrahim-oai and others added 3 commits May 12, 2026 00:56
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@aibrahim-oai aibrahim-oai force-pushed the codex/python-sdk-public-root-api branch from 3a0ab40 to ed297fc Compare May 11, 2026 21:56
@aibrahim-oai aibrahim-oai merged commit b4bc024 into main May 11, 2026
15 checks passed
@aibrahim-oai aibrahim-oai deleted the codex/python-sdk-public-root-api branch May 11, 2026 21:57
@github-actions github-actions Bot locked and limited conversation to collaborators May 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant