Skip to content

Commit 2532186

Browse files
committed
chore: add .githooks/pre-commit (ruff + mypy); annotate start_exec_stream return type; make lint passes
1 parent 44a381e commit 2532186

3 files changed

Lines changed: 84 additions & 1 deletion

File tree

.githooks/pre-commit

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
echo "Running ruff format --check..."
5+
uv run --group dev ruff format --check .
6+
7+
echo "Running ruff check..."
8+
uv run --group dev ruff check .
9+
10+
echo "Running mypy..."
11+
uv run --group dev mypy codex
12+
13+
echo "Pre-commit checks passed."
14+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build Native Wheels (codex-native)
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch: {}
8+
9+
permissions:
10+
contents: read
11+
id-token: write
12+
13+
jobs:
14+
build:
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
os: [ubuntu-latest, macos-14, windows-latest]
19+
python-version: ['3.13']
20+
runs-on: ${{ matrix.os }}
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Fetch upstream codex repo (public)
26+
shell: bash
27+
run: |
28+
# Adjust the repo/ref here if you want to pin to a tag or fork
29+
git clone --depth 1 https://github.com/openai/codex codex-proj
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Install maturin
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install maturin
40+
41+
- name: Build wheels with maturin
42+
env:
43+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: '1'
44+
run: |
45+
maturin build -m crates/codex_native/Cargo.toml --release --interpreter python
46+
47+
- name: Upload wheels
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
51+
path: crates/codex_native/target/wheels/*.whl
52+
53+
publish:
54+
needs: build
55+
runs-on: ubuntu-latest
56+
steps:
57+
- name: Download all wheels
58+
uses: actions/download-artifact@v4
59+
with:
60+
path: dist
61+
62+
- name: Publish to PyPI (Trusted Publishing)
63+
uses: pypa/gh-action-pypi-publish@release/v1
64+
with:
65+
packages-dir: dist
66+
skip-existing: true
67+

codex/native.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Any
2+
13
try:
24
from codex_native import run_exec_collect as _run_exec_collect
35
from codex_native import start_exec_stream as _start_exec_stream
@@ -23,7 +25,7 @@ def run_exec_collect(
2325

2426
def start_exec_stream(
2527
prompt: str, *, model: str | None = None, full_auto: bool = False, cd: str | None = None
26-
):
28+
) -> Any:
2729
"""Return a native streaming iterator over Codex events (dicts)."""
2830
if _start_exec_stream is None:
2931
raise RuntimeError(

0 commit comments

Comments
 (0)