Open
Description
Since I couldn't find any discussion about ruff
in existing issues, I'm opening this one to see if there's interest and to document what I've found so far.
Currently, Python linting and formatting (via make lint
and make reformat
) is done via black
, isort
, pyupgrade
and flake8
.
ruff
can be used as an (almost) drop-in replacement for most of these. The only thing not supported is custom flake8
plugins, like the one defined here.
I have a branch where I tested the migration by:
- Replacing
pyupgrade
withruff
's pyupgrade rules - Replacing
isort
withruff'
's isort rules - Replacing
black
withruff format
- Replacing
flake8
's default rules withruff check
- Replacing
flake8-pytest-style
default rules withruff
's flake8-pytest-style rules - Still running
flake8
, but only selecting the customWH
plugin mentioned above.
After migrating, running with a warm cache I get around a 10 second improvement in both make
commands, and make reformat
is now almost instant:
Before (black+pyupgrade+isort+flake8):
make reformat 0.08s user 0.04s system 1% cpu 10.757 total
make lint 0.15s user 0.07s system 0% cpu 33.592 total
---------------
After (ruff+flake8):
make reformat 0.07s user 0.04s system 14% cpu 0.754 total
make lint 0.14s user 0.07s system 0% cpu 23.736 total