marimo icon indicating copy to clipboard operation
marimo copied to clipboard

Support code formatting using `ruff format`

Open pavelzw opened this issue 1 year ago • 1 comments

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.

pavelzw avatar Jan 13 '24 07:01 pavelzw

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.

baggiponte avatar Jan 14 '24 19:01 baggiponte