Add Python linting & type-checking tooling (ruff + mypy/django-stubs), slim pylint, apply safe auto-fixes#1587
Open
davmlaw wants to merge 1 commit into
Open
Add Python linting & type-checking tooling (ruff + mypy/django-stubs), slim pylint, apply safe auto-fixes#1587davmlaw wants to merge 1 commit into
davmlaw wants to merge 1 commit into
Conversation
…uto-fixes #1586 Tooling: - ruff.toml: fast lint/format, coexists with pylint. Excludes PEP604 union rewrites (UP007/UP045) and __init__ import sorting (I001) - both cause runtime breakage via eager-eval annotations / circular-import order. - mypy.ini + django-stubs/drf-stubs: gradual typing, per-app strictness ratchet. - Slim config/pylint3.rc to inference E-checks + pylint_django. - format_code.sh: autopep8 -> ruff check --fix. - requirements: add ruff, mypy, django-stubs, drf-stubs, pylint, pylint-django. Apply ruff safe auto-fixes across 640 files: unused imports, import sorting (excl. __init__), whitespace, list/dict generics, redundant parens.
Contributor
Author
|
DML review - there are some changes made that remove imports that were wrapped |
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.
🤖 Written by Claude
Addresses #1586.
Tooling
django-stubs+djangorestframework-stubs—mypy.ini, gradual config with a per-app strictness ratchet (startsnpdb).ruff.toml, fast linter + formatter coexisting with pylint (owns style/imports/modernization).config/pylint3.rckeeps only inference-heavyE-checks +pylint_django; ruff owns the rest.format_code.sh—autopep8→ruff check --fix.ruff,mypy,django-stubs,djangorestframework-stubs,pylint,pylint-django(recompiled viauv pip compile).Safe auto-fixes (640 files)
Mechanical, semantically-inert only: unused-import removal, import sorting, whitespace,
List/Dict→list/dict, redundant parens.Deliberately excluded — caused runtime breakage
UP007/UP045): eager-evaluate and raiseTypeErrorat import on shadowed/latent-bad annotations (e.g. a dataclass field nameddatetime). Re-enable per-file afterfrom __future__ import annotations.__init__.pyimport sorting (I001): reorders deliberately-ordered imports, breaking circular-dependency management (hit insync/models/__init__.py).Verification
python manage.py check: clean.manage.py test --keepdb): 956 tests, 1 failure + 2 errors + 7 skipped — all 3 are pre-existing (annotation-data/environment dependent), confirmed identical on cleanmaster. None caused by this change.Reviewer notes
This is mostly mechanical churn (imports/whitespace). The substantive files to review are
ruff.toml,mypy.ini,config/pylint3.rc,scripts/linting/format_code.sh, andrequirements.in.🤖 Generated with Claude Code