marimo
marimo copied to clipboard
Support code formatting using `ruff format`
Description
It would be nice to be able to use ruff format
instead of black
. It's designed as a faster drop-in replacement for black, see https://docs.astral.sh/ruff/formatter/
Suggested solution
Check if ruff is installed and if so, use ruff format
instead of black
.
I thought of that too but I think the problem is that ruff does not offer a Python API while black does. @akshayka what if marimo used black or ruff in the environment and installing black + isort would be optional (like marimo[format]
)? The only issue I see is that I mostly install ruff as a pre-commit hook or as an external dependency, but we could just configure the path in the configs. It could be an entrypoint to create an API to support plugins for formatting.