support ruff configuration in `pyproject.toml`? also option to choose b/w ruff and black
first, thanks for creating marimo, i'm having fun developing with it. however, i can't seem to get my ruff
pyproject.toml
config to work.
might be something with my setup defaulting to black? i can't easily remove black since i installed marimo with conda (through pixi
) and black is set as a required dependency.
would be useful to be able to manually select between the two.7 Replies
we default to Black if black is installed and then try ruff.
https://github.com/marimo-team/marimo/blob/e5de6b9716f2c219f40e892132ff337cb4fcc43a/marimo/_utils/formatter.py#L23
we could flip it now that ruff is more widely used
it would be nice to avoid a configuration and default to what the user has.
@lucabaggi you have good opinions back the python community - thoughts on making ruff the default formatter over black
Would be super cool! You could also use ruff for linting (and use lints for ai powered features).
Ruff is also becoming an LSP so you would eventually use that for type checking, refactoring…
thanks for the response!
@Raia would you be interested in making the contribution?
it could either be easy (switching the if statement), but i am not sure if it will use your ruff.toml or pyproject.toml. is that something you can verify?
sure, I can try it out!
cloned, did editable install, and tested. switching the if statements seems to be enough! also uses
pyproject.toml
or ruff.toml
will come back to this later tonight since it might be good to do more than just switching the if statements. maybe add a try: import ruff
like class BlackFormatter
or at least a warning like BlackFormatter
's LOGGER.warning( "To enable code formatting, install black (pip install black)")
That sounds like a good idea - appreciate the help!
created the pull request! https://github.com/marimo-team/marimo/pull/1765
GitHub
feat: prioritize ruff over black in formatter, requirements, and do...
📝 Summary
prioritize ruff over black in formatter, requirements, and documentation
🔍 Description of Changes
as discussed in this discord thread, changes were made to prioritize ruff over black.
ec...