This release includes the Beta version of the Ruff formatter — an extremely fast, Black-compatible Python formatter.
Try it today with ruff format.
Changes
Preview features
[pylint] Implement non-...
I’ve been largely avoiding Black for years, purely because I’m obsessive about coding style and I love how clean Python looks with single quotes (I understand why they made the choice to enforce one style, but I’ve discovered I can be very stubborn!). I would always use linters to check for PEP8 violations, but I’d then fix the style myself.
Unironically the fact that the Ruff autoformatter allows single quotes has made the difference in convincing me to adopt it (although it also helps that Ruff is already my preferred linter!).
I use Black with quote normalisation disabled. My projects have a rule about string quotes:
Single quotes for symbols that must be an exact match for a symbol elsewhere. Dict hashes, equality match, etc. These will be in API contracts (think JSON APIs), so any change will require care.
Double quotes for user-facing strings, including friendly error/warning messages and i18n strings. These are meant to be periodically revised to improve usability.
Exceptions are allowed when a string contains quote characters. Backslash escapes are uglier.
Quote normalisation makes it harder for developers to recognise the purpose of a string.
Faster Black with single quotes? The original Black could be a history soon.
I got so used to double quotes now RIP angry me from Years ago
I’ve been largely avoiding Black for years, purely because I’m obsessive about coding style and I love how clean Python looks with single quotes (I understand why they made the choice to enforce one style, but I’ve discovered I can be very stubborn!). I would always use linters to check for PEP8 violations, but I’d then fix the style myself.
Unironically the fact that the Ruff autoformatter allows single quotes has made the difference in convincing me to adopt it (although it also helps that Ruff is already my preferred linter!).
I use Black with quote normalisation disabled. My projects have a rule about string quotes:
Single quotes for symbols that must be an exact match for a symbol elsewhere. Dict hashes, equality match, etc. These will be in API contracts (think JSON APIs), so any change will require care.
Double quotes for user-facing strings, including friendly error/warning messages and i18n strings. These are meant to be periodically revised to improve usability.
Exceptions are allowed when a string contains quote characters. Backslash escapes are uglier.
Quote normalisation makes it harder for developers to recognise the purpose of a string.