It's here! `ruff format` is 99.9 % compatible with Black, is 30x faster, and allows changing the quoting and indentation styles:

https://astral.sh/blog/the-ruff-formatter

#python #ruff #formatters #black

The Ruff Formatter: An extremely fast, Black-compatible Python formatter

Ruff's formatter is over 30x faster than existing tools, while maintaining >99.9% compatibility with Black.

@astrojuanlu I don't work on big enough projects to notice the difference. Shaving a fraction of a second off just doesn't seem worth all new tools to me.
@sgillies The snappiness feels so good, to be honest. But also the fact that we can now do all the linting with 1 tool. All cookiecutters out there are going to get vastly simplified.
@astrojuanlu Does it have a darker mode (format a changeset)?
[Question] is it possible to run ruff only on edited lines of a branch/commit? · Issue #2472 · astral-sh/ruff

Similar to the what darker does for black, it would be very nice for introducing ruff to a code base to only apply it to changed lines.

GitHub

@astrojuanlu I've switched all my active projects over to it. Wow what a difference! Add me to the list of people who have to make an intentional bug to see it work.

The biggest gain for me so far is the underlined lines in VS Code to show where there's an issue update instantly when I delete a line. With flake8 there was always a noticeable lag.

Thanks so much!

@d Never thought of the IDE latency, that's another good reason to have tools that are as fast as we can 🚀