Skip to content

Replace flake8/isort with ruff, add uv supply-chain safety#312

Open
rtibblesbot wants to merge 3 commits intolearningequality:release-v0.9.xfrom
rtibblesbot:issue-311-e91a09
Open

Replace flake8/isort with ruff, add uv supply-chain safety#312
rtibblesbot wants to merge 3 commits intolearningequality:release-v0.9.xfrom
rtibblesbot:issue-311-e91a09

Conversation

@rtibblesbot
Copy link
Copy Markdown
Contributor

@rtibblesbot rtibblesbot commented Apr 2, 2026

Summary

Replace flake8/reorder-python-imports with ruff for linting and formatting, add uv exclude-newer for supply chain safety, and add dependabot cooldown. Follows the same approach as learningequality/kolibri#14457 for ecosystem consistency.

The large diff is expected — ruff format touched ~100 files since no formatter was previously configured, and ruff's isort reordered imports differently than the old reorder-python-imports tool. No runtime behavior changes; config files only.

TODO

  • Have tests been written for the new code?
    • N/A — config-only migration, existing tests pass
  • Has documentation been written/updated?
    • N/A — no developer docs reference the old tools
  • New dependencies (if any) added to requirements file
    • N/A — ruff runs via pre-commit, not a project dependency

Reviewer guidance

  • pyproject.toml — verify ruff rule selection (E/W/F/I/T10/T20/C90) maps correctly from the old flake8 config
  • .pre-commit-config.yaml — verify old hooks (flake8, debug-statements, reorder-python-imports) are fully removed and ruff + uv-lock hooks are added
  • Python source changes are entirely auto-generated by ruff format and ruff check --fix — no manual edits

Issues addressed

Closes #311

AI usage

Implementation and PR by Claude Code. Verified via pre-commit hooks passing on all files and full test suite passing.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

@rtibblesbot rtibblesbot marked this pull request as ready for review April 2, 2026 07:29
pyproject.toml Outdated
max-line-length = 160
max-complexity = 10
[tool.ruff]
line-length = 160
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets drop the line length down to 100. While it was 160 before, I think most of the code adhered to 100. So changing this to 100 should eliminate a lot of the code formatting changes here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — dropped to 100 and added E501 to the lint ignore list (109 lines in the codebase exceed 100 chars but can't be auto-wrapped by ruff, e.g. long strings and comments). The Python diff shrank from ~3420 to ~2850 changed lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — dropped to 100 and added E501 to the lint ignore list (109 lines in the codebase exceed 100 chars but can't be auto-wrapped by ruff, e.g. long strings and comments). The Python diff shrank from ~3420 to ~2850 changed lines.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — dropped to 100 and added E501 to the lint ignore list (109 lines in the codebase exceed 100 chars but can't be auto-wrapped by ruff, e.g. long strings and comments). The Python diff shrank from ~3420 to ~2850 changed lines.

rtibblesbot and others added 3 commits April 6, 2026 18:04
Replace flake8, reorder-python-imports, and debug-statements pre-commit
hooks with ruff for unified linting, formatting, and import sorting.
Migrate configuration from [tool.flake8] and [tool.isort] to [tool.ruff]
in pyproject.toml (line-length 100, E501 ignored). Apply all ruff
auto-fixes: import reordering, unused import removal, and formatting
normalization across the codebase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pin uv dependency resolution to a 7-day lookback window to avoid
pulling in newly published packages that may be compromised.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Throttle dependabot PRs to reduce noise from frequent minor version
bumps across all package ecosystems.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Tooling updates with supply chain delays

2 participants