Skip to content

ci: add Python pytest matrix and Rust cargo test workflows (closes #97)#107

Merged
wesleysimplicio merged 2 commits into
mainfrom
claude/issue-97-python-rust-ci
Jun 2, 2026
Merged

ci: add Python pytest matrix and Rust cargo test workflows (closes #97)#107
wesleysimplicio merged 2 commits into
mainfrom
claude/issue-97-python-rust-ci

Conversation

@wesleysimplicio
Copy link
Copy Markdown
Owner

Resumo

Fecha #97. Adiciona CI jobs faltantes pra Python e Rust + gating do publish-pypi.

Mudanças

  • .github/workflows/python-ci.yml novo:
    • python-tests: pytest matrix em 3.10 / 3.11 / 3.12 com pip install -e ".[dev]". Configura git identity de CI pra os fixtures de teste.
    • rust-tests: cargo test --release no rust/Cargo.toml, cache de target, depois maturin develop + pytest tests/python/test_native.py pra cobrir o caminho nativo de fato.
  • .github/workflows/publish-pypi.yml:
    • Passa a rodar pytest tests/python -q ANTES de python -m build, com a mesma git config de CI. Release Python quebrada não chega no PyPI.

Acceptance da issue

  • Failing Python test bloqueia PR merge.
  • Failing Python test bloqueia publish PyPI.
  • cargo test/cargo build da Rust crate roda em CI.
  • Matriz Python 3.10–3.12.
  • test_native.py roda contra a extensão buildada (não só fallback).

Validação local

Item Resultado
Workflow YAML válido
pytest local (12 tests) ✅ (uma falha de git commit no fixture é causada por signing server do container — não reproduz em GH Actions runners)

Refs #97.

https://claude.ai/code/session_01JdmemqddwFnvbceWyuDE8m


Generated by Claude Code

claude added 2 commits June 2, 2026 13:18
Closes #97.

The repo ships a full Python mapper (canonical PyPI package) and an optional
Rust acceleration crate, but CI only ran Node. The 29 Python tests and 3
PyO3 parity tests were never executed on push/PR, and publish-pypi.yml could
ship a broken wheel because it did not run pytest before building.

Add `.github/workflows/python-ci.yml` with two jobs:

- `python-tests` — pytest across the Python 3.10 / 3.11 / 3.12 matrix on
  Ubuntu, against `pip install -e ".[dev]"`. Sets a CI git identity so the
  test_cli fixture commits work without per-developer git config.
- `rust-tests` — `cargo test --release` against `rust/Cargo.toml`, then
  `maturin develop` + `pytest tests/python/test_native.py` so the native
  acceleration shim is exercised end-to-end (not just the pure-Python
  fallback).

Wire the publish-pypi workflow to run pytest before `python -m build`, so a
broken Python release can no longer ship to PyPI.

https://claude.ai/code/session_01JdmemqddwFnvbceWyuDE8m
The first run of #107 surfaced two issues:

1. `pip install -e ".[dev]"` warned `does not provide the extra 'dev'` because
   the dev extra ships in #105, which has not landed yet, so pytest was never
   installed and the matrix failed with `No module named pytest`.
2. `maturin develop` aborted with "Couldn't find a virtualenv" because the
   GitHub-hosted Python environment is not a venv.

Fix:
- Replace `.[dev]` with explicit `pip install pytest` (and `-e .`) in
  python-ci.yml and the publish-pypi.yml pre-publish step. The dev extra is a
  contributor convenience; CI does not need it.
- Wrap the maturin step in a fresh `python -m venv .venv` + `source activate`
  so maturin has somewhere to install the editable extension.

https://claude.ai/code/session_01JdmemqddwFnvbceWyuDE8m
@wesleysimplicio wesleysimplicio marked this pull request as ready for review June 2, 2026 13:27
Copilot AI review requested due to automatic review settings June 2, 2026 13:27
@wesleysimplicio wesleysimplicio merged commit d73a3fc into main Jun 2, 2026
34 checks passed
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing CI coverage for the repository’s Python package (pytest) and optional Rust acceleration crate (cargo + maturin), and prevents publishing broken Python releases by running tests before building/uploading to PyPI.

Changes:

  • Introduces a new GitHub Actions workflow running pytest on a Python 3.10–3.12 matrix, plus a Rust job running cargo test --release.
  • Extends the Rust job to build/install the PyO3 module via maturin develop --release and runs tests/python/test_native.py against the built extension.
  • Updates the PyPI publish workflow to run pytest tests/python (with git identity configured for fixtures) before python -m build.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/python-ci.yml New workflow adding Python pytest matrix + Rust cargo tests and a native-extension parity test via maturin.
.github/workflows/publish-pypi.yml Gates publishing by running Python tests before building and uploading distributions.

@@ -0,0 +1,92 @@
# Python + Rust CI — pytest matrix for the Python package + cargo test
# (and a maturin build smoke check) for the optional Rust acceleration crate.
# Complements scaffold-self-check.yml (Node) and python-lint.yml (ruff).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants