AT-14951: migrate from pylint/isort/black to ruff - #234
Merged
Conversation
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
marked this pull request as ready for review
July 16, 2026 18:18
elinero-amplify
approved these changes
Jul 16, 2026
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
pip install pylintstep in .github/workflows/pre-commit.yml.Reference migrations: cookiecutter-amplify-python-lambda#123, expeditor-api-v2#536.
Hand-fixed findings (ruff won't auto-fix)
as-aliased re-export.# type: ignore/# noqagot 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