-
Notifications
You must be signed in to change notification settings - Fork 901
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
Replace black with ruff-format #15312
Conversation
f"{string.ascii_lowercase[i]}": ["sum", "mean", "count"] | ||
for i in range(6) | ||
}, | ||
{f"{string.ascii_lowercase[i]}": ["sum", "mean", "count"] for i in range(6)}, |
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 find the previous version more readable, do we have to configure any line length settings to achieve that?
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 can re-configure ruff to go back to a 79
line length
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.
Of note: Some of our copyright lines lines are longer than 79 line length, so I had to noqa
those.
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.
Thanks! I think noqa
'ing those is fine.
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.
Adding noqa here isn't ideal. The SPDX identifiers are meant to be machine-readable...
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 is a documented limitation:
astral-sh/ruff#4429
astral-sh/ruff#5899
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.
The reason I hesitate on this is that I think we are supposed to migrate towards SPDX identifiers in all our copyright headers. We shouldn’t noqa every file.
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.
FWIW I would also be OK with a line-length of 88 (that's what we use in pandas)
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.
We can, as the ruff FAQs suggest, run ruff format
but ignore E501
(line length issues). This might lead to some lines that are over the line length, but with the conservative value of 79, I don't think it is necessarily that problematic.
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.
Good idea with ignoring E501
. Yeah we can go with that for now.
python/cudf/cudf/core/resample.py
Outdated
@@ -1,4 +1,4 @@ | |||
# SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. | |||
# SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. # noqa: E501 |
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 don't really want to make linter exceptions for the copyrights "inline". 😕 What alternatives do we have? A line length of 88 would permit this.
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.
Almost everywhere else (which is why we don't need it), we have NVIDIA CORPORATION
rather than NVIDIA CORPORATION & AFFILIATES
.
Not saying which is right/wrong, just noting.
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.
For these files, it needs to stay as-is with the "& AFFILIATES".
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 am happy with this, pending resolution of the line length issues in comments one way or another.
python/cudf/cudf/core/resample.py
Outdated
@@ -1,4 +1,4 @@ | |||
# SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. | |||
# SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. # noqa: E501 |
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.
Almost everywhere else (which is why we don't need it), we have NVIDIA CORPORATION
rather than NVIDIA CORPORATION & AFFILIATES
.
Not saying which is right/wrong, just noting.
Co-authored-by: Lawrence Mitchell <wence@gmx.li>
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 is an acceptable compromise (disabling E501 and having the formatter enforce line lengths). But we should remove the [tool.ruff.format]
excludes list. It's not needed.
Co-authored-by: Bradley Dice <bdice@bradleydice.com>
/merge |
since #15312 moved formatting from Black to Rufft, it would make sense also unify import formatting under the same ruff so use build-in `I` rule instead of additional `isort` Authors: - Jirka Borovec (https://github.com/Borda) - Kyle Edwards (https://github.com/KyleFromNVIDIA) - Bradley Dice (https://github.com/bdice) Approvers: - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) - https://github.com/jakirkham URL: #16685
Description
xref #14882
This PR replaces
black
withruff-format
with it's default configurations. The ruff configuration had a line length of 88 while black had a line length configuration of 79, so aligned them to 79.The next step would be to consider replacing
isort
tooChecklist