use ruff instead of black
/ flake8
/ isort
across RAPIDS #130
Open
Description
opened on Dec 30, 2024
Description
ruff
is a fast, actively-maintained static analysis tool that implements a TON of linting rules, including those from isort
, flake8
, and 20+ flake8-*
extensions.
ref: https://docs.astral.sh/ruff/rules/#legend
ruff-format
can also perform auto-formatting of Python code, similar to black
.
Every RAPIDS repo should use ruff
, and stop using black
, isort
and flake8
.
Benefits of this work
- reduces the effort to add support for new Python versions: Update flake8 to fix false positive with Python 3.12 #101 (comment)
- expands the space of what can be caught by static analysis
- list of rules: https://docs.astral.sh/ruff/rules/#legend
- example: Enable Ruff's NumPy rules #103
- allows for more consolidation of configuration into
pyproject.toml
files, by allowing removal of.flake8
/setup.cfg
across repos - allows for linting to extend to Python code in IPython notebook files (
.ipynb
) without needing to involve additional libraries like nbQA (example: enforce ruff checks on Python code in notebooks (fixes #333) deployment#370)
Acceptance Criteria
ruff
is used in all RAPIDS reposblack
is not used directly in any RAPIDS reposflake8
is not used directly in any RAPIDS reposisort
is not used directly in any RAPIDS repos- all
ruff
configuration is stored inpyproject.toml
files
Notes
Motivating discussions:
- Enable Ruff's NumPy rules #103 (comment)
- Enable Ruff's NumPy rules #103 (comment)
- remove versioneer and setup.cfg references in docs, update rapids-dependency-file-generator cuspatial#1509 (comment)
Approach
These updates can be done in any order, since they're self-contained to individual repos.
When porting configuration to ruff
, try to match the project's existing style preferences to minimize style-related changes.
Metadata
Assignees
Labels
No labels
Activity