chore: consolidate isort, flake8, pycln and absolufy-imports into ruff#707
Merged
Merged
Conversation
Replace four lint pre-commit hooks with a single ruff hook configured in pyproject.toml. Equivalent rule coverage: E/F/W (flake8), I (isort), F401 (pycln), TID252 + ban-relative-imports (absolufy-imports, archived upstream July 2024). black and mypy are unchanged. ruff check passes with zero findings on the current codebase, so this is a config-only change with no source churn. The Makefile flake8 target becomes ruff, and linecheck is dropped as E501 (line-length 99) now covers it.
Collaborator
|
@joshmarkovic Yes, if you want we can also move out to ruff format, but please wait for 1.10.1 final release state to avoid problems with current parallel work, we also can migrate from mypi to ty by astral, mypi is having some dependency issues with newer versions. |
Contributor
Author
Awesome! I'll create issues for |
This was referenced Jun 15, 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
This PR consolidates four of the five Python lint/format tools in our pre-commit config —
absolufy-imports,pycln,isort, andflake8— into a single Ruff hook configured inpyproject.toml. black and mypy are unchanged.It is a config-only change:
ruff checkpasses with zero findings on the current codebase (verified against master at 10df88a, ruff 0.15.17), so no Python source is touched and there is no churn to review beyond the three config files.ruffhas been in our dev dependency group since the PEP 621 packaging migration (9b8b82a) but was never wired up — this PR puts it to use.Why
absolufy-importsis unmaintained. The repo was archived on July 3, 2024 and its README states: "This tool has been superseded by Ruff. Please use that instead."9.0.0a3), which is fragile..pre-commit-config.yamlbecome one[tool.ruff]block inpyproject.toml.Rule mapping
--max-line-length=99)E,F,Wwithline-length = 99--profile black --line-length 99)Iwithknown-first-party = ["dbt"]--all)F401(included inF)TID252withban-relative-imports = "all"make linecheck(grep for lines ≥100 chars)E501(included inE)I verified each rule family actually fires by probing with a deliberately bad file (unsorted imports, unused import, relative import, 126-char line) — all flagged as expected.
Makefile changes:
make flake8→make ruff;make lint/make testupdated accordingly;make linecheckremoved as redundant with E501.Notes and trade-offs
ruff formatis deliberately out of scope. It would reformat 11 of 79 files (cosmetic differences from black). Keeping black means this PR causes zero source churn. Happy to discuss the formatter swap separately if there's interest..pre-commit-config.yamland the Makefile. The conflicts are trivial; happy to rebase whichever lands second.Checklist
ruff check dbt testspasses with zero findings (config-only change).pre-commit-config.yamlvalidates (pre-commit validate-config+ yamllint)