-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MRG: Use ruff-format instead of Black #12261
Conversation
Style checks are still duplicated with "Tests / Style" (GHA) and "pre-commit.ci" checks. I think we can remove the "pre-commit.ci" check, since we disabled autofix. @larsoner? |
What is the benefit of ruff-format compared to black? Especially as black is available in many IDEs and ruff is not? |
OK found the linked issue, speed sounds good, although I would also be inclined to give them some time to refine this new functionality. EDIT: OK so just Spyder lagging behind, not a big issue. |
It's faster and one tool less to run via pre-commit hooks, making for a smoother dev experience if these hooks are installed |
Spyder can use it via python-lsp-ruff in https://github.com/python-lsp/python-lsp-server |
I'd rather move more stuff to |
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.
+1 for merge from me, with or without looking into the " + ".*"
stuff. Overall I think this improves things and we can manually fix the " + ".*"
when we come across them (or wait for the tool to get better and fix these for us automatically!).
1 | ||
/ (sigma * np.sqrt(2 * np.pi)) | ||
* np.exp(-((times - mu) ** 2) / (2 * sigma**2)) | ||
1 / (sigma * np.sqrt(2 * np.pi)) * np.exp(-((times - mu) ** 2) / (2 * sigma**2)) |
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 was wondering why we had a ton of lines removed... I'm guessing it's mostly from this. I consider this a nice readability win
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.
Same.
@larsoner Currently, some GHA jobs like the one that runs pytest depend on the "style" job, which runs the pre-commit hooks. This is to avoid running pytest as long as there are still code style issues. Can we make our GHA runs conditional on pre-commit.ci return codes? |
Possibly but someone would have to look into it. FYI Azure also has a style run that other runs depend on IIRC |
But that would mean we run the pre-commit hooks twice (pre-commit.ci and GHA)? Unless we remove the job from GHA, businesses then the others cannot be (easily) conditional What do you suggest we do? |
I think the way things work right now are okay. There's always room for improvement but I think we have more important stuff to work on (diminishing returns tweaking CIs further) |
@@ -285,9 +285,7 @@ def stat_fun(*args): | |||
|
|||
inds_t, inds_v = [ | |||
(clusters[cluster_ind]) for ii, cluster_ind in enumerate(good_cluster_inds) | |||
][ | |||
0 | |||
] # first cluster |
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.
@drammock here's an example where things are reversed and are looking better with ruff
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
Co-authored-by: Daniel McCloy <[email protected]>
I think this is good to go. |
@mscheltienne Okay with you if we move forward here? |
Sure! |
Okay let's give it a shot! I'll add e7dd158 to |
* upstream/main: MRG: Use ruff-format instead of Black (mne-tools#12261) MAINT: Make selenium optional and use on CircleCI (mne-tools#12263) MAINT: Post-release deprecations (mne-tools#12265) MAINT: Replace `Path.parent.parent` with `Path.parents[N]` in tests (mne-tools#12257)
Co-authored-by: Eric Larson <[email protected]> Co-authored-by: Daniel McCloy <[email protected]>
Closes #12255
I also removed numerous unnecessary
# noqa: D102
's from__init__()
methods. (Unnecessary there if the class itself has a docstring)