Alternative formatters for generated code, like `ruff format`?

For linting rather than formatting, but:

In case this could nudge things in the direction of Ruff, I did come across a ticket today where Ruff has its own rule that would be useful: #36215 (Update Python code style in contribution docs to mention using PEP 448 unpacking to concatenate iterables) – Django

I don’t know if it’s enough to move the needle. But I do think Ruff is starting to look like a better option than sticking with Flake8, isort, and black, all running separately and quite slowly.

1 Like

I threw this together in the meantime if anyone is interested django-migrations-ruff-formatter · PyPI

Or you can just use this tiny script

#!/bin/bash

if [ "$1" == "--fast" ]; then
	shift
fi

ruff format $@

and store it as black somewhere in your shell search path.

that won’t really scale that easily across a team or contributors