Skip to content

Commit 326e31a

Browse files
authored
[codex] Refine Python SDK user-facing docs (openai#22941)
## Summary - Remove maintainer and release-process wording from the Python SDK README and docs. - Rewrite SDK-facing comments/docstrings so they read as standalone product documentation. - Add a real app-server integration smoke that follows the public quickstart-style `Codex() -> thread_start() -> run()` path. ## Integration coverage - Add `test_real_quickstart_style_flow_smoke` in the real app-server integration suite. ## Validation - Local tests were not run per repo guidance. CI should validate this branch once the PR is online.
1 parent 9025550 commit 326e31a

6 files changed

Lines changed: 38 additions & 68 deletions

File tree

sdk/python/README.md

Lines changed: 3 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ source .venv/bin/activate
1717
```
1818

1919
Published SDK builds pin an exact `openai-codex-cli-bin` runtime dependency
20-
with the same version as the SDK. For local repo development, either pass
21-
`AppServerConfig(codex_bin=...)` to point at a local build explicitly, or use
22-
the repo examples/notebook bootstrap which installs the pinned runtime package
23-
automatically.
20+
with the same version as the SDK. Pass `AppServerConfig(codex_bin=...)` only
21+
when you intentionally want to run against a specific local app-server binary.
2422

2523
## Quickstart
2624

@@ -55,49 +53,12 @@ python examples/01_quickstart_constructor/sync.py
5553
python examples/01_quickstart_constructor/async.py
5654
```
5755

58-
## Runtime packaging
59-
60-
The repo no longer checks `codex` binaries into `sdk/python`.
56+
## Runtime
6157

6258
Published SDK builds are pinned to an exact `openai-codex-cli-bin` package
6359
version, and that runtime package carries the platform-specific binary for the
6460
target wheel. The SDK package version and runtime package version must match.
6561

66-
For local repo development, the checked-in `sdk/python-runtime` package is only
67-
a template for staged release artifacts. Editable installs should use an
68-
explicit `codex_bin` override for manual SDK usage; the repo examples and
69-
notebook bootstrap the pinned runtime package automatically.
70-
71-
## Maintainer workflow
72-
73-
```bash
74-
cd sdk/python
75-
uv sync
76-
python scripts/update_sdk_artifacts.py generate-types
77-
python scripts/update_sdk_artifacts.py \
78-
stage-sdk \
79-
/tmp/codex-python-release/openai-codex \
80-
--codex-version <codex-release-tag-or-pep440-version>
81-
python scripts/update_sdk_artifacts.py \
82-
stage-runtime \
83-
/tmp/codex-python-release/openai-codex-cli-bin \
84-
/path/to/codex \
85-
--codex-version <codex-release-tag-or-pep440-version>
86-
```
87-
88-
Pass `--platform-tag ...` to `stage-runtime` when the wheel should be tagged for
89-
a Rust target that differs from the Python build host. The intended one-off
90-
matrix is `macosx_11_0_arm64`, `macosx_10_9_x86_64`,
91-
`musllinux_1_1_aarch64`, `musllinux_1_1_x86_64`, `win_arm64`, and
92-
`win_amd64`.
93-
94-
This supports the CI release flow:
95-
96-
- run `generate-types` before packaging
97-
- stage `openai-codex` once with an exact `openai-codex-cli-bin==...` dependency
98-
- stage `openai-codex-cli-bin` on each supported platform runner with the same pinned runtime version
99-
- build and publish `openai-codex-cli-bin` as platform wheels only through PyPI trusted publishing; do not publish an sdist
100-
10162
## Compatibility and versioning
10263

10364
- Package: `openai-codex`

sdk/python/docs/faq.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,29 +59,6 @@ Common causes:
5959
- local auth/session is missing
6060
- incompatible/old app-server
6161

62-
Maintainers stage releases by building the SDK once and the runtime once per
63-
platform with the same pinned runtime version. Publish `openai-codex-cli-bin`
64-
as platform wheels only; do not publish an sdist:
65-
66-
```bash
67-
cd sdk/python
68-
python scripts/update_sdk_artifacts.py generate-types
69-
python scripts/update_sdk_artifacts.py \
70-
stage-sdk \
71-
/tmp/codex-python-release/openai-codex \
72-
--codex-version <codex-release-tag-or-pep440-version>
73-
python scripts/update_sdk_artifacts.py \
74-
stage-runtime \
75-
/tmp/codex-python-release/openai-codex-cli-bin \
76-
/path/to/codex \
77-
--codex-version <codex-release-tag-or-pep440-version>
78-
```
79-
80-
If you are packaging a binary for a different target than the Python build
81-
host, pass `--platform-tag ...` to `stage-runtime`. The intended one-off matrix
82-
is `macosx_11_0_arm64`, `macosx_10_9_x86_64`, `musllinux_1_1_aarch64`,
83-
`musllinux_1_1_x86_64`, `win_arm64`, and `win_amd64`.
84-
8562
## Why does a turn "hang"?
8663

8764
A turn is complete only when `turn/completed` arrives for that turn ID.

sdk/python/docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is the fastest path from install to a multi-turn thread using the public SDK surface.
44

5-
The SDK is experimental. Treat the API, bundled runtime strategy, and packaging details as unstable until the first public release.
5+
The SDK is experimental, so the public API and runtime requirements may keep evolving before the first public release.
66

77
## 1) Install
88

sdk/python/src/openai_codex/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _approval_mode_override_settings(
113113

114114

115115
class Codex:
116-
"""Minimal typed SDK surface for app-server v2."""
116+
"""Typed Python client for app-server v2 workflows."""
117117

118118
def __init__(self, config: AppServerConfig | None = None) -> None:
119119
self._client = AppServerClient(config=config)

sdk/python/src/openai_codex/types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Public generated app-server model exports for type annotations and matching."""
1+
"""Public app-server model exports for type annotations and matching."""
22

33
from __future__ import annotations
44

sdk/python/tests/test_real_app_server_integration.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,38 @@ def test_real_thread_run_convenience_smoke(runtime_env: PreparedRuntimeEnv) -> N
295295
assert isinstance(data["has_usage"], bool)
296296

297297

298+
def test_real_quickstart_style_flow_smoke(runtime_env: PreparedRuntimeEnv) -> None:
299+
data = _run_json_python(
300+
runtime_env,
301+
textwrap.dedent(
302+
"""
303+
import json
304+
from openai_codex import Codex
305+
306+
with Codex() as codex:
307+
thread = codex.thread_start()
308+
result = thread.run("Say hello in one sentence.")
309+
print(json.dumps({
310+
"thread_id": thread.id,
311+
"final_response": result.final_response,
312+
"items_count": len(result.items),
313+
}))
314+
"""
315+
),
316+
)
317+
318+
assert {
319+
"thread_id_is_text": isinstance(data["thread_id"], str) and bool(data["thread_id"].strip()),
320+
"final_response_is_text": isinstance(data["final_response"], str)
321+
and bool(data["final_response"].strip()),
322+
"items_count_is_int": isinstance(data["items_count"], int),
323+
} == {
324+
"thread_id_is_text": True,
325+
"final_response_is_text": True,
326+
"items_count_is_int": True,
327+
}
328+
329+
298330
def test_real_async_thread_turn_usage_and_ids_smoke(
299331
runtime_env: PreparedRuntimeEnv,
300332
) -> None:

0 commit comments

Comments
 (0)