-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ruff format
as our Python formatter
#3839
Conversation
ac443a0
to
539cfba
Compare
539cfba
to
c8c02de
Compare
235b87b
to
769687e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Left some questions about pixi ~ justfile discrepancies and blackdoc
. I suppose that's still in flux
justfile
Outdated
set -euo pipefail | ||
# The order below is important and sadly we need to call black twice. Ruff does not yet | ||
# fix line-length (See: https://github.com/astral-sh/ruff/issues/1904). | ||
# | ||
# 1) Call black, which among others things fixes line-length | ||
# 2) Call ruff, which requires line-lengths to be correct | ||
# 3) Call black again to cleanup some whitespace issues ruff might introduce | ||
black --config rerun_py/pyproject.toml {{py_folders}} | ||
# NOTE: the order here matches the one in `crates/re_types_builder/src/format/python.rs`: | ||
ruff --fix --config rerun_py/pyproject.toml {{py_folders}} | ||
black --config rerun_py/pyproject.toml {{py_folders}} | ||
ruff format --config rerun_py/pyproject.toml {{py_folders}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a deeper story that this isn't a pixi task yet? There is a pixi task for checking but not for formatting 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, this is the deeper story: #3717 :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also the {[py_folders}}
which I don't know if pixi
supports. Anyway, this PR is not about moving more tasks into pixi
justfile
Outdated
ruff --fix --config rerun_py/pyproject.toml {{py_folders}} | ||
black --config rerun_py/pyproject.toml {{py_folders}} | ||
ruff format --config rerun_py/pyproject.toml {{py_folders}} | ||
blackdoc {{py_folders}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to imply that there is still need for black? But it was removed from the pixi toml and everywhere else 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blackdoc
formats code in docstrings, which ruff format
does not yet do: astral-sh/ruff#7146
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment about this
It should be fine to run just |
What
ruff format
is much faster.But, it is still in beta: https://github.com/astral-sh/ruff/milestone/6
Checklist