Skip to content

AT-14951: migrate from pylint/isort/black to ruff - #234

Merged
jconstance-amplify merged 1 commit into
mainfrom
AT-14951-migrate_to_ruff
Jul 16, 2026
Merged

AT-14951: migrate from pylint/isort/black to ruff#234
jconstance-amplify merged 1 commit into
mainfrom
AT-14951-migrate_to_ruff

Conversation

@jconstance-amplify

Copy link
Copy Markdown
Contributor

Summary

  • Swap pylint + black pre-commit hooks for a single astral-sh/ruff-pre-commit block (ruff-check --fix + ruff-format), per AT-14951. No isort hook existed in this repo. mirrors-mypy is untouched (v1.8.0, no typed-ast issue).
  • New pyproject.toml [tool.ruff] block: line-length=110 (from pylintrc, now removed), target-version="py310" (setup.py's floor), lint select=[E,W,F,I].
  • Drop dead pylint references: test-requirements.txt pin, CLAUDE.md note, and the pip install pylint step in .github/workflows/pre-commit.yml.
  • Bumped version 0.10.25 -> 0.10.26 + CHANGELOG entry, since bin/versionCheck.sh gates PRs that touch terrawrap/, test/, bin/, or setup.* — which ruff's reformat does.

Reference migrations: cookiecutter-amplify-python-lambda#123, expeditor-api-v2#536.

Hand-fixed findings (ruff won't auto-fix)

  • terrawrap/init.py: F401 on version re-exports -> explicit as-aliased re-export.
  • E501 inside docstrings/print strings and docopt Usage/Arguments blocks -> rewrapped at clause boundaries, verified against test substring assertions and docopt's own formal_usage() tokenizer, then confirmed by running docopt against each rewrapped docstring.
  • No E721 findings; no # type: ignore/# noqa got detached.

Test plan

  • pre-commit run --all-files -- clean (ruff-check, ruff-format, mypy all pass)
  • tox -e py311-unit,py312-unit,py313-unit,py314-unit -- 143 passed on each (py310 interpreter unavailable in this environment, not run)

🤖 Generated with Claude Code

Replace the pylint + black pre-commit hooks (no isort hook was present)
with a single astral-sh/ruff-pre-commit block (ruff-check --fix +
ruff-format), matching the org's reference migrations
(cookiecutter-amplify-python-lambda#123, expeditor-api-v2#536).

- .pre-commit-config.yaml: swap psf/black + pycqa/pylint for ruff at
  v0.15.21 (matches the rev already adopted across ~15 sibling repos).
  mirrors-mypy is untouched.
- pyproject.toml: new [tool.ruff] block, line-length=110 (from
  pylintrc's max-line-length, now removed with the file) and
  target-version=py310 (setup.py's python_requires floor); [tool.ruff.lint]
  select = E/W/F/I (pyflakes + pycodestyle + import-sort, replacing isort's
  role). No broader rule sets adopted, per the ticket's scope.
- test-requirements.txt, CLAUDE.md, .github/workflows/pre-commit.yml:
  drop the now-dead pylint references (package pin, doc note, and the
  `pip install pylint` CI step).
- Hand-fixed findings ruff won't auto-fix:
  - terrawrap/__init__.py: F401 on the version re-exports — switched to
    explicit `as`-aliased re-exports (ruff's own suggested fix) instead
    of suppressing.
  - E501 inside docstrings/print strings in terrawrap/models/config_mover.py,
    bin/graph_apply, bin/visualize — rewrapped at clause boundaries; verified
    against test/unit/test_config_mover.py's substring assertions.
  - E501 inside docopt Usage/Arguments blocks in bin/graph_apply, bin/tf_apply,
    bin/tf_move — confirmed via docopt's own formal_usage() (tokenizes on
    whitespace, ignores newlines) that wrapping doesn't change the parsed
    grammar, then verified by running docopt against each file's docstring.
  - No E721 findings and no `# type: ignore`/`# noqa` got detached by
    ruff-format (mypy passes clean, unchanged).
- The ruff block carries no `files:` filter (unlike the old pylint hook's
  `files: ^(terrawrap|test)/`), so bin/ scripts are now linted too — this
  surfaced several of the E501s above. Intentional, matches the fleet.
- Bumped __version__ 0.10.25 -> 0.10.26 and added a CHANGELOG entry, per
  this repo's own versionCheck.sh gate (diffs terrawrap/, test/, bin/,
  setup.*, *.pip against origin/main) — the reformatting touches all of
  those paths.

Verified: `pre-commit run --all-files` clean (ruff-check, ruff-format,
mypy all pass). `tox -e py311-unit,py312-unit,py313-unit,py314-unit`:
143 passed on each (py310 interpreter unavailable on this machine, not run).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jconstance-amplify
jconstance-amplify marked this pull request as ready for review July 16, 2026 18:18
@jconstance-amplify
jconstance-amplify requested a review from a team as a code owner July 16, 2026 18:18
@jconstance-amplify
jconstance-amplify merged commit 1ae7205 into main Jul 16, 2026
10 of 11 checks passed
@jconstance-amplify
jconstance-amplify deleted the AT-14951-migrate_to_ruff branch July 16, 2026 18:29
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.

2 participants