chore(lint): add ruff config and Python lint workflow (closes #101)#105
Merged
Conversation
Closes #101. Adds a ruff configuration to pyproject.toml selecting the rule set that matches the existing in-code `noqa` codes (S, BLE) plus the conventional hygiene families (E, F, W, I, B, UP). Adds a dev extra (`pip install -e .[dev]`) so contributors install ruff and pytest reproducibly. Adds a dedicated `python-lint.yml` workflow that runs `ruff check simplicio_mapper tests/python` on push and pull_request and blocks merge on violations. Applies the surgical fixes ruff surfaced on first run (import sorting, unnecessary `mode` arguments, redundant utf-8 encodings, switch to `collections.abc.Callable` / `Sequence`). The intentional `git` subprocess invocations are covered by an explicit `S603`/`S607` ignore list with a documented rationale, matching the existing `# noqa: S603` annotation on `cli.py`. A separate Python CI job covering the full pytest matrix and the Rust crate is tracked in #97; this PR delivers the lint half so the rule set itself is enforced from day one. https://claude.ai/code/session_01JdmemqddwFnvbceWyuDE8m
wesleysimplicio
pushed a commit
that referenced
this pull request
Jun 2, 2026
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 Python linting via ruff to close #101: introduces a [tool.ruff] config in pyproject.toml, a dedicated CI workflow, and applies safe auto-fixes (import sorting, redundant mode="r"/encoding="utf-8" removals, typing.Callable/Sequence → collections.abc).
Changes:
- New
.github/workflows/python-lint.ymlrunningruff checkon push/PR to main/develop. pyproject.toml: dev extras +[tool.ruff]rule selection/ignores aligned with existing# noqacodes.- Auto-fixes applied across
cli.py,mapper.py,cache.py,_native.py.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/python-lint.yml |
New CI workflow running ruff check on Python sources/tests. |
pyproject.toml |
Adds dev extra with ruff/pytest and full [tool.ruff] lint/format config. |
simplicio_mapper/cli.py |
Import sort, drop redundant "r"/encoding args, Sequence from collections.abc. |
simplicio_mapper/mapper.py |
Callable moved to collections.abc, drop redundant "r" in open. |
simplicio_mapper/cache.py |
Forward-ref string removed for __enter__, drop redundant encoding="utf-8" in .encode(). |
simplicio_mapper/_native.py |
Callable moved to collections.abc; split native import into two statements. |
Merged
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 #101. Adiciona linter Python (
ruff) + workflow CI dedicado.Mudanças
pyproject.toml— bloco[tool.ruff]com regras alinhadas aosnoqajá usados no código (S, BLE) + hygiene padrão (E, F, W, I, B, UP). Ignores justificados por linha. Extra[project.optional-dependencies] dev = ["ruff", "pytest"]..github/workflows/python-lint.yml— novo workflow rodandoruff check simplicio_mapper tests/pythonem push/PR. Bloqueia merge se violar.cli.py,mapper.py,cache.py,_native.py: import sorting, remoção demode="r"redundante,encoding="utf-8"redundante em.encode(), troca detyping.Callable/Sequenceporcollections.abc.*.S603/S607(subprocess git) já tinha noqa em uma linha e é intencional em todas as outras — adicionado aoignoreglobal do ruff com rationale documentado.Fora de escopo
Validação
ruff check simplicio_mapper tests/pythongit commitno fixture rejeitado pelo signing server — fora do escopo desta PR)npm run lintRefs #101, #97.
https://claude.ai/code/session_01JdmemqddwFnvbceWyuDE8m
Generated by Claude Code