-
Notifications
You must be signed in to change notification settings - Fork 758
Description
Motivation (Current Limitations)
Our current setup relies on black (formatting) and isort (import sorting). This leaves two key gaps:
-
Missing Linting: No automated checks for common bugs, anti-patterns, or adherence to best practices (e.g., Flake8/Pylint rules).
-
Toolchain Overhead: Managing separate dependencies and execution steps for
blackandisortadds unnecessary complexity to our CI/CD pipeline and local development loop.
Proposal (Solution)
Integrate Ruff as the single, high-performance tool for linting, import sorting, and formatting. Ruff is an extremely fast, Rust-based utility designed to consolidate the Python code quality pipeline.
Justification: Progressive Improvement
Ruff offers a compelling improvement over the current setup, delivering speed and functionality beyond simple formatting:
| Feature | Benefit | Progressive Change from Current |
|---|---|---|
| Extreme Speed | Drastically reduces CI/CD runtimes and local pre-commit check times. | Improves developer feedback cycles significantly. |
| Tool Consolidation | Replaces isort entirely and is a drop-in formatter for black. |
Simplifies dependencies and reduces toolchain maintenance. |
| Code Quality Assurance | Instantly enforces 600+ linting rules (Flake8, Pylint subsets) to catch bugs and anti-patterns. | Introduces vital quality checks that black and isort do not provide. |
Recommended Action Plan
-
Dependency Update: Add
ruffand removeisort. -
Configuration: Define
[tool.ruff]inpyproject.toml, settingline-length = 88and enabling a core set of linting rules (e.g.,["E", "F", "W", "I", "UP"]). -
Initial Fix: Run
ruff check --fix .across the codebase. -
CI/CD: Update CI scripts to use
ruff checkandruff format --check(or keepblackinitially during a transition phase).
Next Steps
If approved, I will submit a PR implementing this transition (Phase 1: Ruff for linting/sorting, replacing isort).