ci: add Python pytest matrix and Rust cargo test workflows (closes #97)#107
Merged
Conversation
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
Contributor
There was a problem hiding this comment.
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
pyteston a Python 3.10–3.12 matrix, plus a Rust job runningcargo test --release. - Extends the Rust job to build/install the PyO3 module via
maturin develop --releaseand runstests/python/test_native.pyagainst the built extension. - Updates the PyPI publish workflow to run
pytest tests/python(with git identity configured for fixtures) beforepython -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). | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumo
Fecha #97. Adiciona CI jobs faltantes pra Python e Rust + gating do publish-pypi.
Mudanças
.github/workflows/python-ci.ymlnovo:python-tests: pytest matrix em 3.10 / 3.11 / 3.12 compip install -e ".[dev]". Configura git identity de CI pra os fixtures de teste.rust-tests:cargo test --releasenorust/Cargo.toml, cache de target, depoismaturin develop+pytest tests/python/test_native.pypra cobrir o caminho nativo de fato..github/workflows/publish-pypi.yml:pytest tests/python -qANTES depython -m build, com a mesmagit configde CI. Release Python quebrada não chega no PyPI.Acceptance da issue
cargo test/cargo buildda Rust crate roda em CI.test_native.pyroda contra a extensão buildada (não só fallback).Validação local
git commitno 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