You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-5Lines changed: 76 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# codex-python
2
2
3
-
A minimal Python library scaffold using `uv` with Python 3.13+.
3
+
Python interface to Codex, packaged as a single distribution (`codex-python`). Platform wheels include a native extension for in‑process execution; pure‑Python installs fall back to the CLI JSON mode.
4
4
5
5
## Quickstart
6
6
7
-
- Requires Python 3.13+.
7
+
- Requires Python 3.12+.
8
8
- Package import name: `codex`.
9
9
- Distribution name (PyPI): `codex-python`.
10
10
@@ -30,6 +30,27 @@ Options:
30
30
- Full auto: `run_exec("scaffold a cli", full_auto=True)`
31
31
- Run in another dir: `run_exec("...", cd="/path/to/project")`
32
32
33
+
Streaming JSON events (CLI; no native required):
34
+
35
+
```
36
+
from codex.protocol.runtime import stream_exec_events
37
+
38
+
for event in stream_exec_events("explain this repo", full_auto=True):
39
+
# event is a dict with shape {"id": str, "msg": {...}}
40
+
print(event)
41
+
```
42
+
43
+
The event payload matches the Pydantic models in `codex.protocol.types` (e.g., `EventMsg`).
- Pre-commit: `uvx pre-commit install && uvx pre-commit run --all-files`
76
99
100
+
### Protocol bindings (from codex-rs)
101
+
102
+
- Prereq: Rust toolchain (`cargo`) installed.
103
+
- Generate Python types from the upstream protocol with:
104
+
105
+
```
106
+
make gen-protocol
107
+
```
108
+
109
+
This will:
110
+
- emit TypeScript types under `.generated/ts/`
111
+
- convert them to Python Pydantic models + Literal unions at `codex/protocol/types.py`
112
+
113
+
### Native bindings (PyO3)
114
+
115
+
- Install path
116
+
117
+
`pip install codex-python` installs a platform wheel that includes the native extension on supported platforms (Python 3.12/3.13; CI also attempts 3.14). If a platform wheel isn’t available, pip installs a pure‑Python build and CLI JSON streaming still works.
0 commit comments