python-sdk: use pinned runtime package in real coverage (2026-03-12)

2026-03-12

Switch the repo-source Python SDK real coverage over to a pinned runtime-package flow backed by GitHub release artifacts instead of PATH or explicit binary overrides.

- add sdk/python/_runtime_setup.py to download the release codex archive for a requested CODEX_PYTHON_RUNTIME_VERSION, stage a temporary codex-cli-bin package, and install it into a target Python environment with cleanup
- refactor real integration tests to run repo-source SDK code against an isolated site-packages target that contains the staged codex-cli-bin runtime
- update examples and notebook bootstrap to install and use the runtime package, and stop consulting CODEX_PYTHON_SDK_CODEX_BIN or PATH
- switch the failing turn-run and model-selection examples to runtime-compatible model selection for the pinned release binary
- keep the main SDK runtime resolution model unchanged: explicit codex_bin or installed codex-cli-bin

Validation:
- python3 -m pytest sdk/python/tests
- RUN_REAL_CODEX_TESTS=1 CODEX_PYTHON_RUNTIME_VERSION=0.115.0-alpha.11 python3 -m pytest sdk/python/tests/test_real_app_server_integration.py

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Shaqayeq
2026-03-12 09:51:07 -07:00
parent fd4beb8b37
commit 3cf1306968
9 changed files with 708 additions and 120 deletions

View File

@@ -23,10 +23,13 @@ python -m pip install -e .
When running examples from this repo checkout, the SDK source uses the local
tree and does not bundle a runtime binary. The helper in `examples/_bootstrap.py`
therefore resolves `codex` from:
uses the installed `codex-cli-bin` runtime package.
- `CODEX_PYTHON_SDK_CODEX_BIN`, if set
- otherwise `codex` on `PATH`
If `codex-cli-bin` is not already installed, set `CODEX_PYTHON_RUNTIME_VERSION`
to a release version like `0.115.0-alpha.11`; the bootstrap will download the
matching GitHub release artifact, stage a temporary local `codex-cli-bin`
package, install it into your active interpreter, and clean up the temporary
files afterward.
## Run examples
@@ -38,12 +41,14 @@ python examples/<example-folder>/async.py
```
The examples bootstrap local imports from `sdk/python/src` automatically, so no
extra package build step is required beyond installing dependencies for your
active interpreter and making a `codex` binary available.
SDK wheel install is required. You only need the Python dependencies for your
active interpreter and an installed `codex-cli-bin` runtime package (either
already present or provisioned through `CODEX_PYTHON_RUNTIME_VERSION`).
## Recommended first run
```bash
export CODEX_PYTHON_RUNTIME_VERSION=0.115.0-alpha.11
python examples/01_quickstart_constructor/sync.py
python examples/01_quickstart_constructor/async.py
```