codex-sdk-py 0.0.3__tar.gz → 0.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/PKG-INFO +18 -7
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/README.md +13 -2
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/__init__.py +1 -1
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/exec.py +2 -6
- codex_sdk_py-0.0.4/docs/typescript-python-comparison.md +166 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/pyproject.toml +5 -5
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/.github/workflows/ci.yml +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/.github/workflows/release.yml +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/.gitignore +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/codex.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/codex_options.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/events.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/items.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/output_schema_file.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/py.typed +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/thread.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/thread_options.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/codex_sdk/turn_options.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/examples/basic_streaming.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/examples/image_input.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/examples/structured_output.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/examples/structured_output_pydantic.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/tests/__init__.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/tests/conftest.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/tests/test_codex.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/tests/test_output_schema.py +0 -0
- {codex_sdk_py-0.0.3 → codex_sdk_py-0.0.4}/tests/test_types.py +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codex-sdk-py
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Python SDK for the OpenAI Codex agent
|
|
5
|
-
Project-URL: Homepage, https://github.com/nogataka/codex-sdk-
|
|
6
|
-
Project-URL: Documentation, https://github.com/nogataka/codex-sdk-
|
|
7
|
-
Project-URL: Repository, https://github.com/nogataka/codex-sdk-
|
|
8
|
-
Project-URL: Issues, https://github.com/nogataka/codex-sdk-
|
|
5
|
+
Project-URL: Homepage, https://github.com/nogataka/codex-sdk-py
|
|
6
|
+
Project-URL: Documentation, https://github.com/nogataka/codex-sdk-py#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/nogataka/codex-sdk-py
|
|
8
|
+
Project-URL: Issues, https://github.com/nogataka/codex-sdk-py/issues
|
|
9
9
|
Author-email: OpenAI <support@openai.com>
|
|
10
10
|
License-Expression: Apache-2.0
|
|
11
11
|
Keywords: agent,ai,codex,openai,sdk
|
|
@@ -34,6 +34,17 @@ Embed the Codex agent in your workflows and apps.
|
|
|
34
34
|
|
|
35
35
|
The Python SDK wraps the bundled `codex` binary. It spawns the CLI and exchanges JSONL events over stdin/stdout.
|
|
36
36
|
|
|
37
|
+
## TypeScript版との互換性
|
|
38
|
+
|
|
39
|
+
このPython SDKは [TypeScript版 Codex SDK](https://github.com/openai/codex/tree/main/sdk/typescript) を1対1でポーティングしており、**全ての機能・データ構造・動作が同一**です。
|
|
40
|
+
|
|
41
|
+
- 全8種のイベント型(ThreadStartedEvent, TurnCompletedEvent など)
|
|
42
|
+
- 全8種のアイテム型(AgentMessageItem, CommandExecutionItem など)
|
|
43
|
+
- 全4種のEnum(ApprovalMode, SandboxMode, ModelReasoningEffort, WebSearchMode)
|
|
44
|
+
- CLI引数の構築ロジック、環境変数の処理、TOML設定シリアライズ
|
|
45
|
+
|
|
46
|
+
詳細な比較は [docs/typescript-python-comparison.md](docs/typescript-python-comparison.md) を参照してください。
|
|
47
|
+
|
|
37
48
|
## Installation
|
|
38
49
|
|
|
39
50
|
```bash
|
|
@@ -353,8 +364,8 @@ class WebSearchMode(StrEnum):
|
|
|
353
364
|
|
|
354
365
|
```bash
|
|
355
366
|
# Clone the repository
|
|
356
|
-
git clone https://github.com/
|
|
357
|
-
cd codex
|
|
367
|
+
git clone https://github.com/nogataka/codex-sdk-py.git
|
|
368
|
+
cd codex-sdk-py
|
|
358
369
|
|
|
359
370
|
# Install development dependencies
|
|
360
371
|
pip install -e ".[dev]"
|
|
@@ -4,6 +4,17 @@ Embed the Codex agent in your workflows and apps.
|
|
|
4
4
|
|
|
5
5
|
The Python SDK wraps the bundled `codex` binary. It spawns the CLI and exchanges JSONL events over stdin/stdout.
|
|
6
6
|
|
|
7
|
+
## TypeScript版との互換性
|
|
8
|
+
|
|
9
|
+
このPython SDKは [TypeScript版 Codex SDK](https://github.com/openai/codex/tree/main/sdk/typescript) を1対1でポーティングしており、**全ての機能・データ構造・動作が同一**です。
|
|
10
|
+
|
|
11
|
+
- 全8種のイベント型(ThreadStartedEvent, TurnCompletedEvent など)
|
|
12
|
+
- 全8種のアイテム型(AgentMessageItem, CommandExecutionItem など)
|
|
13
|
+
- 全4種のEnum(ApprovalMode, SandboxMode, ModelReasoningEffort, WebSearchMode)
|
|
14
|
+
- CLI引数の構築ロジック、環境変数の処理、TOML設定シリアライズ
|
|
15
|
+
|
|
16
|
+
詳細な比較は [docs/typescript-python-comparison.md](docs/typescript-python-comparison.md) を参照してください。
|
|
17
|
+
|
|
7
18
|
## Installation
|
|
8
19
|
|
|
9
20
|
```bash
|
|
@@ -323,8 +334,8 @@ class WebSearchMode(StrEnum):
|
|
|
323
334
|
|
|
324
335
|
```bash
|
|
325
336
|
# Clone the repository
|
|
326
|
-
git clone https://github.com/
|
|
327
|
-
cd codex
|
|
337
|
+
git clone https://github.com/nogataka/codex-sdk-py.git
|
|
338
|
+
cd codex-sdk-py
|
|
328
339
|
|
|
329
340
|
# Install development dependencies
|
|
330
341
|
pip install -e ".[dev]"
|
|
@@ -381,7 +381,7 @@ def _find_codex_path() -> str:
|
|
|
381
381
|
if not target_triple:
|
|
382
382
|
raise RuntimeError(f"Unsupported platform: {system} ({machine})")
|
|
383
383
|
|
|
384
|
-
#
|
|
384
|
+
# Return bundled binary path (matches TypeScript behavior)
|
|
385
385
|
script_dir = Path(__file__).parent
|
|
386
386
|
vendor_root = script_dir / "vendor"
|
|
387
387
|
arch_root = vendor_root / target_triple
|
|
@@ -389,8 +389,4 @@ def _find_codex_path() -> str:
|
|
|
389
389
|
binary_name = "codex.exe" if sys.platform == "win32" else "codex"
|
|
390
390
|
binary_path = arch_root / "codex" / binary_name
|
|
391
391
|
|
|
392
|
-
|
|
393
|
-
return str(binary_path)
|
|
394
|
-
|
|
395
|
-
# Fall back to PATH
|
|
396
|
-
return "codex"
|
|
392
|
+
return str(binary_path)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# TypeScript SDK vs Python SDK 仕様比較
|
|
2
|
+
|
|
3
|
+
このドキュメントでは、[TypeScript版 Codex SDK](https://github.com/openai/codex/tree/main/sdk/typescript) と Python版 Codex SDK の仕様が完全に一致していることを示します。
|
|
4
|
+
|
|
5
|
+
## 概要
|
|
6
|
+
|
|
7
|
+
Python版 SDK は TypeScript版 SDK を1対1でポーティングしており、**全ての機能・データ構造・動作が同一**です。
|
|
8
|
+
|
|
9
|
+
## ファイル対応表
|
|
10
|
+
|
|
11
|
+
| TypeScript | Python | 説明 |
|
|
12
|
+
|------------|--------|------|
|
|
13
|
+
| `src/index.ts` | `codex_sdk/__init__.py` | エクスポート定義 |
|
|
14
|
+
| `src/codex.ts` | `codex_sdk/codex.py` | Codex クラス |
|
|
15
|
+
| `src/thread.ts` | `codex_sdk/thread.py` | Thread クラス |
|
|
16
|
+
| `src/exec.ts` | `codex_sdk/exec.py` | CodexExec クラス |
|
|
17
|
+
| `src/events.ts` | `codex_sdk/events.py` | イベント型定義 |
|
|
18
|
+
| `src/items.ts` | `codex_sdk/items.py` | アイテム型定義 |
|
|
19
|
+
| `src/codexOptions.ts` | `codex_sdk/codex_options.py` | CodexOptions |
|
|
20
|
+
| `src/threadOptions.ts` | `codex_sdk/thread_options.py` | ThreadOptions |
|
|
21
|
+
| `src/turnOptions.ts` | `codex_sdk/turn_options.py` | TurnOptions |
|
|
22
|
+
| `src/outputSchemaFile.ts` | `codex_sdk/output_schema_file.py` | スキーマファイル処理 |
|
|
23
|
+
|
|
24
|
+
## 詳細比較
|
|
25
|
+
|
|
26
|
+
### 1. Codex クラス
|
|
27
|
+
|
|
28
|
+
| 機能 | TypeScript | Python | 状態 |
|
|
29
|
+
|------|------------|--------|------|
|
|
30
|
+
| コンストラクタ | `new Codex(options?)` | `Codex(options?)` | ✅ 一致 |
|
|
31
|
+
| スレッド開始 | `startThread(options?)` | `start_thread(options?)` | ✅ 一致 |
|
|
32
|
+
| スレッド再開 | `resumeThread(id, options?)` | `resume_thread(thread_id, options?)` | ✅ 一致 |
|
|
33
|
+
|
|
34
|
+
### 2. Thread クラス
|
|
35
|
+
|
|
36
|
+
| 機能 | TypeScript | Python | 状態 |
|
|
37
|
+
|------|------------|--------|------|
|
|
38
|
+
| ID取得 | `thread.id` | `thread.id` | ✅ 一致 |
|
|
39
|
+
| 実行 | `run(input, turnOptions?)` | `run(input_data, turn_options?)` | ✅ 一致 |
|
|
40
|
+
| ストリーミング実行 | `runStreamed(input, turnOptions?)` | `run_streamed(input_data, turn_options?)` | ✅ 一致 |
|
|
41
|
+
|
|
42
|
+
### 3. 入力型 (Input Types)
|
|
43
|
+
|
|
44
|
+
| 型 | TypeScript | Python | 状態 |
|
|
45
|
+
|----|------------|--------|------|
|
|
46
|
+
| テキスト入力 | `{ type: "text", text: string }` | `TextUserInput` | ✅ 一致 |
|
|
47
|
+
| 画像入力 | `{ type: "local_image", path: string }` | `ImageUserInput` | ✅ 一致 |
|
|
48
|
+
| 入力Union | `string \| UserInput[]` | `str \| list[UserInput]` | ✅ 一致 |
|
|
49
|
+
|
|
50
|
+
### 4. イベント型 (Event Types) - 全8種
|
|
51
|
+
|
|
52
|
+
| イベント | type値 | 状態 |
|
|
53
|
+
|----------|--------|------|
|
|
54
|
+
| ThreadStartedEvent | `"thread.started"` | ✅ 一致 |
|
|
55
|
+
| TurnStartedEvent | `"turn.started"` | ✅ 一致 |
|
|
56
|
+
| TurnCompletedEvent | `"turn.completed"` | ✅ 一致 |
|
|
57
|
+
| TurnFailedEvent | `"turn.failed"` | ✅ 一致 |
|
|
58
|
+
| ItemStartedEvent | `"item.started"` | ✅ 一致 |
|
|
59
|
+
| ItemUpdatedEvent | `"item.updated"` | ✅ 一致 |
|
|
60
|
+
| ItemCompletedEvent | `"item.completed"` | ✅ 一致 |
|
|
61
|
+
| ThreadErrorEvent | `"error"` | ✅ 一致 |
|
|
62
|
+
|
|
63
|
+
### 5. アイテム型 (Item Types) - 全8種
|
|
64
|
+
|
|
65
|
+
| アイテム | type値 | 状態 |
|
|
66
|
+
|----------|--------|------|
|
|
67
|
+
| AgentMessageItem | `"agent_message"` | ✅ 一致 |
|
|
68
|
+
| ReasoningItem | `"reasoning"` | ✅ 一致 |
|
|
69
|
+
| CommandExecutionItem | `"command_execution"` | ✅ 一致 |
|
|
70
|
+
| FileChangeItem | `"file_change"` | ✅ 一致 |
|
|
71
|
+
| McpToolCallItem | `"mcp_tool_call"` | ✅ 一致 |
|
|
72
|
+
| WebSearchItem | `"web_search"` | ✅ 一致 |
|
|
73
|
+
| TodoListItem | `"todo_list"` | ✅ 一致 |
|
|
74
|
+
| ErrorItem | `"error"` | ✅ 一致 |
|
|
75
|
+
|
|
76
|
+
### 6. Enum値 - 全4種
|
|
77
|
+
|
|
78
|
+
#### ApprovalMode
|
|
79
|
+
| TypeScript | Python | 値 |
|
|
80
|
+
|------------|--------|-----|
|
|
81
|
+
| `"never"` | `ApprovalMode.NEVER` | `"never"` |
|
|
82
|
+
| `"on-request"` | `ApprovalMode.ON_REQUEST` | `"on-request"` |
|
|
83
|
+
| `"on-failure"` | `ApprovalMode.ON_FAILURE` | `"on-failure"` |
|
|
84
|
+
| `"untrusted"` | `ApprovalMode.UNTRUSTED` | `"untrusted"` |
|
|
85
|
+
|
|
86
|
+
#### SandboxMode
|
|
87
|
+
| TypeScript | Python | 値 |
|
|
88
|
+
|------------|--------|-----|
|
|
89
|
+
| `"read-only"` | `SandboxMode.READ_ONLY` | `"read-only"` |
|
|
90
|
+
| `"workspace-write"` | `SandboxMode.WORKSPACE_WRITE` | `"workspace-write"` |
|
|
91
|
+
| `"danger-full-access"` | `SandboxMode.DANGER_FULL_ACCESS` | `"danger-full-access"` |
|
|
92
|
+
|
|
93
|
+
#### ModelReasoningEffort
|
|
94
|
+
| TypeScript | Python | 値 |
|
|
95
|
+
|------------|--------|-----|
|
|
96
|
+
| `"minimal"` | `ModelReasoningEffort.MINIMAL` | `"minimal"` |
|
|
97
|
+
| `"low"` | `ModelReasoningEffort.LOW` | `"low"` |
|
|
98
|
+
| `"medium"` | `ModelReasoningEffort.MEDIUM` | `"medium"` |
|
|
99
|
+
| `"high"` | `ModelReasoningEffort.HIGH` | `"high"` |
|
|
100
|
+
| `"xhigh"` | `ModelReasoningEffort.XHIGH` | `"xhigh"` |
|
|
101
|
+
|
|
102
|
+
#### WebSearchMode
|
|
103
|
+
| TypeScript | Python | 値 |
|
|
104
|
+
|------------|--------|-----|
|
|
105
|
+
| `"disabled"` | `WebSearchMode.DISABLED` | `"disabled"` |
|
|
106
|
+
| `"cached"` | `WebSearchMode.CACHED` | `"cached"` |
|
|
107
|
+
| `"live"` | `WebSearchMode.LIVE` | `"live"` |
|
|
108
|
+
|
|
109
|
+
### 7. CLI引数の構築
|
|
110
|
+
|
|
111
|
+
両SDKは同一のコマンドライン引数を構築します:
|
|
112
|
+
|
|
113
|
+
| 引数 | 状態 |
|
|
114
|
+
|------|------|
|
|
115
|
+
| `exec --experimental-json` | ✅ 一致 |
|
|
116
|
+
| `--model` | ✅ 一致 |
|
|
117
|
+
| `--sandbox` | ✅ 一致 |
|
|
118
|
+
| `--cd` | ✅ 一致 |
|
|
119
|
+
| `--add-dir` | ✅ 一致 |
|
|
120
|
+
| `--skip-git-repo-check` | ✅ 一致 |
|
|
121
|
+
| `--output-schema` | ✅ 一致 |
|
|
122
|
+
| `--config model_reasoning_effort="..."` | ✅ 一致 |
|
|
123
|
+
| `--config sandbox_workspace_write.network_access=...` | ✅ 一致 |
|
|
124
|
+
| `--config web_search="..."` | ✅ 一致 |
|
|
125
|
+
| `--config approval_policy="..."` | ✅ 一致 |
|
|
126
|
+
| `--image` | ✅ 一致 |
|
|
127
|
+
| `resume <thread_id>` | ✅ 一致 |
|
|
128
|
+
|
|
129
|
+
### 8. 環境変数
|
|
130
|
+
|
|
131
|
+
| 変数 | 状態 |
|
|
132
|
+
|------|------|
|
|
133
|
+
| `CODEX_INTERNAL_ORIGINATOR_OVERRIDE` | ✅ 一致 (値のみ異なる: `codex_sdk_ts` vs `codex_sdk_py`) |
|
|
134
|
+
| `OPENAI_BASE_URL` | ✅ 一致 |
|
|
135
|
+
| `CODEX_API_KEY` | ✅ 一致 |
|
|
136
|
+
|
|
137
|
+
### 9. TOML設定シリアライズ
|
|
138
|
+
|
|
139
|
+
設定オブジェクトのTOMLシリアライズロジックは完全に一致:
|
|
140
|
+
- ネストされたオブジェクトのドットパス展開
|
|
141
|
+
- 文字列、数値、真偽値、配列のTOMLリテラル変換
|
|
142
|
+
- キーのクォート処理
|
|
143
|
+
|
|
144
|
+
### 10. 出力スキーマファイル処理
|
|
145
|
+
|
|
146
|
+
| 機能 | 状態 |
|
|
147
|
+
|------|------|
|
|
148
|
+
| 一時ディレクトリ作成 | ✅ 一致 |
|
|
149
|
+
| JSONスキーマ書き込み | ✅ 一致 |
|
|
150
|
+
| クリーンアップ処理 | ✅ 一致 |
|
|
151
|
+
|
|
152
|
+
## 言語固有の差異(動作に影響なし)
|
|
153
|
+
|
|
154
|
+
以下は各言語の慣例に従った差異であり、機能的な違いはありません:
|
|
155
|
+
|
|
156
|
+
| 項目 | TypeScript | Python | 理由 |
|
|
157
|
+
|------|------------|--------|------|
|
|
158
|
+
| 命名規則 | `camelCase` | `snake_case` | 言語の慣例 |
|
|
159
|
+
| キャンセル機構 | `AbortSignal` | `asyncio.Event` | プラットフォーム標準 |
|
|
160
|
+
| エラー型 | `Error` | `RuntimeError` / `ValueError` | 言語標準 |
|
|
161
|
+
| Enum実装 | 文字列リテラルUnion | `StrEnum` | 型システムの違い |
|
|
162
|
+
|
|
163
|
+
## 結論
|
|
164
|
+
|
|
165
|
+
Python版 Codex SDK は TypeScript版と**完全に同一の仕様**を実装しています。
|
|
166
|
+
どちらのSDKを使用しても、同じ入力に対して同じ出力が得られます。
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codex-sdk-py"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.4"
|
|
8
8
|
description = "Python SDK for the OpenAI Codex agent"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "Apache-2.0"
|
|
@@ -37,10 +37,10 @@ dev = [
|
|
|
37
37
|
]
|
|
38
38
|
|
|
39
39
|
[project.urls]
|
|
40
|
-
Homepage = "https://github.com/nogataka/codex-sdk-
|
|
41
|
-
Documentation = "https://github.com/nogataka/codex-sdk-
|
|
42
|
-
Repository = "https://github.com/nogataka/codex-sdk-
|
|
43
|
-
Issues = "https://github.com/nogataka/codex-sdk-
|
|
40
|
+
Homepage = "https://github.com/nogataka/codex-sdk-py"
|
|
41
|
+
Documentation = "https://github.com/nogataka/codex-sdk-py#readme"
|
|
42
|
+
Repository = "https://github.com/nogataka/codex-sdk-py"
|
|
43
|
+
Issues = "https://github.com/nogataka/codex-sdk-py/issues"
|
|
44
44
|
|
|
45
45
|
[tool.hatch.build.targets.wheel]
|
|
46
46
|
packages = ["codex_sdk"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|