Skip to main content

Run the Codex CLI non-interactively from Python, backed by a Rust core.

Project description

codexcw (Python)

Run the Codex CLI non-interactively from Python, backed by a Rust core. It spawns codex exec --json, decodes the JSONL event stream, and exposes each run as iterables, callbacks, results, and typed errors.

The codex executable must be on PATH, authenticated, and new enough to support codex exec --json. Defaults are automation-friendly: read-only sandbox, approval never, ephemeral sessions, color disabled, git check skipped.

Install

pip install codexcw

Usage

from codexcw import Runner, Request

runner = Runner()
result = runner.run(Request(prompt="diga oi"))
print(result.final_message)

Streaming

from codexcw import Runner, Request

runner = Runner()
session = runner.start(Request(prompt="resuma este repo"))
for event in session.events():
    if event.type == "item.completed" and event.item.type == "agent_message":
        print(event.item.text)
result = session.wait()

Running many Codex instances

from codexcw import Runner, Request

runner = Runner()
group = runner.run_many(
    [Request(prompt="review package A"), Request(prompt="review package B")],
    max_concurrent=2,
)
for run_event in group.events():
    print(run_event.index, run_event.event.type)
results = group.wait()

Async

import asyncio
from codexcw import Request
from codexcw.aio import Runner

async def main():
    runner = Runner()
    session = await runner.start(Request(prompt="oi"))
    async for event in session.events():
        print(event.type)
    result = await session.wait()
    print(result.final_message)

asyncio.run(main())

License

CC0 1.0 Universal.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codexcw-0.1.0.tar.gz (45.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

codexcw-0.1.0-cp39-abi3-win_amd64.whl (565.7 kB view details)

Uploaded CPython 3.9+Windows x86-64

codexcw-0.1.0-cp39-abi3-musllinux_1_1_x86_64.whl (832.5 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.1+ x86-64

codexcw-0.1.0-cp39-abi3-musllinux_1_1_aarch64.whl (771.2 kB view details)

Uploaded CPython 3.9+musllinux: musl 1.1+ ARM64

codexcw-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (619.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

codexcw-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (594.0 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

codexcw-0.1.0-cp39-abi3-macosx_11_0_arm64.whl (557.3 kB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

codexcw-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl (582.5 kB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file codexcw-0.1.0.tar.gz.

File metadata

  • Download URL: codexcw-0.1.0.tar.gz
  • Upload date:
  • Size: 45.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codexcw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 698c12253924e4e8831a6edce4ae3b7a109cd76c25c85890cab19a0322275cff
MD5 12645fe2d3479b930af94794522bbfe6
BLAKE2b-256 30155bbe36e34d5c47e53bd601f3bf89fb3ef9481332a6c0984cb4e5253811c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0.tar.gz:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codexcw-0.1.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: codexcw-0.1.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 565.7 kB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codexcw-0.1.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 424d748fe149678f9450cc67b8a1704b7863f83dcc23bc9276e2a5845a3dcb92
MD5 09d0f704a6e88ea9c26e02b00016f2cb
BLAKE2b-256 0822205e925fa777e56422cb57a1634ca626912e673733fc33f90dad9b6ccb50

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0-cp39-abi3-win_amd64.whl:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codexcw-0.1.0-cp39-abi3-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for codexcw-0.1.0-cp39-abi3-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 556abe5ac5cbd54803a3331b87ed250ab9a254215245395017e587aeac77fec5
MD5 245600b93311717177017c2fd74f471a
BLAKE2b-256 96879abaf8ed88636203ccd14aad16585001c662f9281ad0ec96ba1f43354a4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0-cp39-abi3-musllinux_1_1_x86_64.whl:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codexcw-0.1.0-cp39-abi3-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for codexcw-0.1.0-cp39-abi3-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 ee5128ecc60b06420cd4ac0675211a9b8a862c69f976931dc30ed1b568b4b523
MD5 a6f44ad469c36f9e0e042c3bd46b816e
BLAKE2b-256 7e9166d105c2e6a3f29228256ce8c6682c261b37f4415549f68510a03411ad83

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0-cp39-abi3-musllinux_1_1_aarch64.whl:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codexcw-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for codexcw-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74aded402a5ba5be6448ec4db2131c6089e1e9d72443f21663cbb70b50bfdec0
MD5 feff555edd5ba1b70f4928080ba63932
BLAKE2b-256 7ac1f9e1f4344d03332429182f574b80cf0ff885785cd6b426c77879c7719ed5

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codexcw-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for codexcw-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9e333cf14d3484533ecf4438094cc5c6d7633e27f30f13f60c680a56259c6513
MD5 237084a8a27e7d259d6f99ebf5867f1f
BLAKE2b-256 2346f7e579e0b0917a27f7d32f30518c0a56aa03ddf6a28faebe00bec2cdf90b

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codexcw-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for codexcw-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1d54972fb56f1fc966466e8f0614af766a60f7e24b4a868ed34346c1639def4a
MD5 4718a38ec9f91dacd8f58d6a1ce0322e
BLAKE2b-256 3e07a30f72ae7ff9ecea6faa1318e1074994e0801dd67937774fc189b6d982fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file codexcw-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for codexcw-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2c71e2c6dceee8c7281e223cb4151979a48846240e4829ed2854d3100ac2713b
MD5 8da65650e979856b13f4174bc567c26b
BLAKE2b-256 8bedd2fa98c2d4e756f16d93ccb3ad2d17acb9ea555602f564eecb412eabd624

See more details on using hashes here.

Provenance

The following attestation bundles were made for codexcw-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: release-pypi.yml on c3-oss/codexcw

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page