AT-14951: migrate from pylint/isort/black to ruff - #34
Merged
Conversation
Swap isort, black, and pylint in .pre-commit-config.yaml for a single astral-sh/ruff-pre-commit hook (ruff-check --fix, ruff-format), per AT-14951 (astrotools-owned apps migrating off the three-tool lint stack). One tool instead of three separately-versioned ones, same formatting behavior as black plus isort's import-sort rules folded in. - pyproject.toml: new [tool.ruff] block, line-length=120 (from this repo's pylintrc max-line-length, not black's unset/88 default) and target-version="py311" (from default_language_version/tox envlist). - Removed pylintrc; left inline `# pylint: disable=...` comments alone since their rule codes have no equivalent in the minimal E/W/F/I select set. - Hand-fixed one ruff-check finding pylint's --fix didn't cover: F401 in oktaawscli/__init__.py (`from .version import __version__`) needed an explicit re-export alias (`as __version__`) since it's a deliberate public re-export, not a mistaken unused import. - Updated CONTRIBUTING.md's pylint-specific PR-acceptance instructions to point at `pre-commit run --all-files` instead. - Left .travis.yml alone: it's dead Travis-era CI (python 3.6.5, badges point at the upstream author's travis-ci.org project); live CI is .github/workflows/pr_check.yml (pre-commit + tox), unaffected. - Bumped version to 0.4.17 and logged the change in CHANGELOG.md per this repo's CONTRIBUTING.md convention. Verified: `pre-commit run --all-files` clean (ruff-check, ruff-format, mypy all pass) and `tox` (30 unit tests) passes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Revert the 0.4.17 version bump and CHANGELOG entry from the previous commit. The verified pilot (expeditor-api-v2 PR #536) and the batch of already-merged repos don't touch version/changelog files for this migration — it's a pure lint-tool swap with zero behavior change, and this package's own CHANGELOG shows version bumps here trigger an automated CodeArtifact publish, which isn't warranted for a tooling- only diff. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
aoskotsky-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
isort(8.0.1),black(26.3.1), andpylint(v4.0.5, local hook) in.pre-commit-config.yamlfor a singleastral-sh/ruff-pre-commithook atv0.15.21(ruff-check --fix+ruff-format) — one tool instead of three separately-versioned ones.mypyis untouched.pyproject.tomlwith[tool.ruff]:line-length = 120(from this repo'spylintrcmax-line-length, not black's unset/88 default),target-version = "py311"(fromdefault_language_version.pythonand thetox.inienvlist), and[tool.ruff.lint] select = ["E", "W", "F", "I"](pycodestyle + pyflakes + import-sort, matching the minimal set the migration template uses — no broader rule opt-in).pylintrc. Left inline# pylint: disable=E1120comments inoktaawscli/okta_awscli.pyalone — that rule code has no equivalent in the new minimal select set, so it's inert, not broken.CONTRIBUTING.md's PR-acceptance instructions, which previously told contributors to runpylint --errors-only oktaawscli; now points atpre-commit run --all-files..travis.ymlalone — it's dead Travis-era CI (Python 3.6.5, and the README's build badges point at the upstream author'stravis-ci.org/jmhale/...project, which no longer exists). Live CI is.github/workflows/pr_check.yml(pre-commit + tox), unaffected by this migration.Hand-fixed findings (ruff-check --fix didn't cover)
oktaawscli/__init__.py:from .version import __version__was flagged as an unused import. This is a deliberate public re-export (oktaawscli.__version__), not a mistake, so fixed with ruff's own suggested explicit re-export form:from .version import __version__ as __version__.type(x) == y) findings in this repo.E501— like pycodestyle's — exempts unsplittable single-token overflows (URLs with no whitespace), so these are correctly not flagged; no rewrap needed.# type: ignore/# noqadetach trap: the repo's one such comment (oktaawscli/okta_auth_config.py:10) sits on a line the reflow didn't touch;mypypasses cleanly.Note on scope
An initial pass also bumped
oktaawscli/version.pyto 0.4.17 and added aCHANGELOG.mdentry, following this repo's ownCONTRIBUTING.mdconvention ("increment the version... document your changes in CHANGELOG"). This was reverted in a follow-up commit after checking the reference pilot migration (amplify-education/expeditor-api-v2#536) — it doesn't touch version/changelog files either, and this repo's own CHANGELOG documents that version bumps here are wired to an automated CodeArtifact publish. A pure lint-tool swap with no behavior change shouldn't trigger a release, so the migration was kept purely mechanical, consistent with the pilot and the already-merged batch.Reference template PRs:
cookiecutter-amplify-python#18,cookiecutter-amplify-python-lambdaokta-awscli#123.Test plan
pre-commit run --all-files— clean (ruff-check, ruff-format, mypy, and all other existing hooks pass)tox(python -m unittest discover -s tests -v -b) — 30/30 tests pass.pyfiles by hand to confirm all changes are 88→120 line-length reflow / import-sort churn with no logic changes (multi-context-managerwithstatements were reformatted into parenthesized form, which ruff-format supports fortarget-version = py311+)🤖 Generated with Claude Code