ci(python): add Python bindings CI with ruff and pytest#212
Merged
Conversation
Add .github/workflows/python.yml that runs on PRs touching Python bindings or core crate. Tests across Python 3.9/3.12/3.13 via maturin develop + pytest. Separate build-wheel job verifies packaging with twine check. Gate job (Python Check) for branch protection. Add crates/bashkit-python/tests/test_bashkit.py covering: - BashTool construction (default + custom params) - Sync and async execution - State persistence (variables, files) - ExecResult properties, to_dict, repr, str - Reset behavior - LLM metadata methods (description, help, schemas) - create_langchain_tool_spec https://claude.ai/code/session_019xLsk6rbRNC9GWEiEGfZna
Add ruff config to pyproject.toml (target py39, line-length 120, rules E/F/W/I/UP). Add lint job to python.yml using uvx ruff via astral-sh/setup-uv. Fix all existing lint issues: unused imports, Optional[X] -> X | None, Type -> type, line-length violations. Reformat all Python files. https://claude.ai/code/session_019xLsk6rbRNC9GWEiEGfZna
- AGENTS.md: add Python section (ruff, pytest, CI), add step 14 to pre-PR checklist for ruff on Python changes - specs/013-python-package.md: add tests/ to layout, add CI and Linting sections, update Local Development with ruff/pytest commands - justfile: add python-lint recipe https://claude.ai/code/session_019xLsk6rbRNC9GWEiEGfZna
maturin develop requires a virtualenv which isn't present in the GitHub Actions runner. Switch to build wheel + pip install approach matching publish-python.yml pattern. https://claude.ai/code/session_019xLsk6rbRNC9GWEiEGfZna
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.
Summary
.github/workflows/python.yml— CI for Python bindings on PRs/pushes to mainastral-sh/setup-uv(fast, no Rust build)maturin develop+pytestacross Python 3.9, 3.12, 3.13maturin build+twine check, uploads artifactcrates/bashkit-python/,crates/bashkit/,Cargo.toml/lockcrates/bashkit-python/tests/test_bashkit.py— 20 pytest cases covering construction, sync/async exec, state persistence, ExecResult, reset, LLM metadata, langchain specpyproject.toml(py39, line-length 120, rules E/F/W/I/UP)Optional[X]→X | None,Type→type, line-lengthjust python-lintrecipeTest plan
python.ymllint job passes (ruff check + format)python.ymltest jobs pass on Python 3.9, 3.12, 3.13python.ymlbuild-wheel job produces valid wheel