Skip to content

Adopt Google Python Style, Conventional Commits, and cleanporter - #7

Merged
egparedes merged 17 commits into
mainfrom
plan-python-style-tests
Oct 7, 2026
Merged

egparedes merged 17 commits into
mainfrom
plan-python-style-tests

Conversation

@egparedes

Copy link
Copy Markdown
Contributor

Adopt Google Python Style, Conventional Commits, and cleanporter

What

Adopts the repository conventions end to end and reorganizes the test
suite to match them. Four phases, 17 commits, each green on make check:

  1. Conventional Commits — commit-msg hook
    (compilerla/conventional-pre-commit v4.4.0, the 11 standard types,
    old areas become scopes), AGENTS.md rule with the old→new mapping,
    and a PR commit-subject check in CI.
  2. Test-suite reorganization — the mixed files split by topic
    (inspectability, closures-and-helpers, error paths dissolved into
    per-module suites), the perf/fuzz/differential suites move into
    their level folders, every reference updated. Zero tests lost:
    956 → 970 collected (the layering non-blindness tests are new),
    862 → 876 passed, coverage 96% throughout.
  3. Google Python Style — ruff gains D (pydocstyle google
    convention), N, ICN, TID252 and five zero-violation guards; all 251
    relative imports switch to absolute (ban-relative-imports = "all");
    62 docstring findings fixed by hand or autofix; one import per line
    per §3.13. Single documented deviation: 100-column lines.
  4. cleanporter for §2.2 module-only imports — locked dev dependency
    (upstream v0.6.0, which carries the PEP 695 type-alias fix this work
    prompted: fix: bind PEP 695 type aliases as objects in the first-party layer cleanporter#10), fixer pre-commit hook,
    exit-code-robust make fmt, and the make lint gate with
    treat_unresolved_as_error. The tree is module-only everywhere
    except six documented inline suppressions (load-bearing re-exports
    and the optimize name collision) and the config-skipped golden test
    data.

Review guide

The commits are small and scoped; the two big mechanical ones are
style: rewrite src imports to module-only form and
style: rewrite test and script imports to module-only form
(review with git diff -M).

Verification

  • make check: 970 collected, 876 passed, 94 skipped, 96% coverage
    (gate 95%)
  • make lint: ruff + the cleanporter gate — 84 files, 0 violations,
    0 unresolved; proven to fail on injected violations
  • make fuzz (5 seeds), make backends (93 passed), make lowest,
    make smoke, make docs: green
  • Golden snapshots byte-identical throughout —
    git diff main...HEAD --stat -- tests/golden/cases is empty; no
    --update-golden was ever run
  • Behavior-neutrality of the import rewrite audited at the AST level:
    only bare→module-qualified moves, the declared *_mod alias renames,
    and the six suppressions
  • cleanporter's "import roots nest" stdout warnings on make lint are
    informational by design (inferred-root ranking), exit 0

Notes

  • The cleanporter dependency pins the upstream v0.6.0 tag; the local
    stand-in that drove development is gone.
  • Deferred follow-ups (tracked): emitter-side §2.2 compliance for
    generated code, the optimize-package cse/dce rename,
    tests/unit/test_builtins.py naming.

Wire cleanporter 0.6.0 into the locked environment, pyproject config,
pre-commit and `make fmt`; the import rewrite itself follows in the
next commits.

- pinned to the local stand-in git source at e53776c, the commit
  carrying the PEP 695 type-alias fix; the upstream 0.6.0 release is
  pending, so the source is swapped to the GitHub URL + tag once it is
  cut
- the lint gate line and treat_unresolved_as_error land together with
  the import rewrite in the following commits, so every intermediate
  commit stays green; check mode currently reports 385 CP001 / 4 CP002
  / 2 CP003 findings
- the fmt recipe runs the fixers in the exit-code-robust order: ruff
  format first and last, ruff check --fix --exit-zero in between, and
  cleanporter --fix under `-` because it exits 1 whenever anything
  remains it will not rewrite
- golden cases, marimo notebooks and tests/corpus.py are exempt: pinned
  compiler output, notebook format owned by marimo, and golden test
  data whose from-imports deliberately exercise the supported subset
@egparedes
egparedes merged commit 655436a into main Oct 7, 2026
8 checks passed
@egparedes
egparedes deleted the plan-python-style-tests branch October 7, 2026 08:23
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.

1 participant