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 |
larsoner
left a comment
There was a problem hiding this comment.
+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.
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
|
@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) |
| (clusters[cluster_ind]) for ii, cluster_ind in enumerate(good_cluster_inds) | ||
| ][ | ||
| 0 | ||
| ] # first cluster |
There was a problem hiding this comment.
@drammock here's an example where things are reversed and are looking better with ruff
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
|
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 <larson.eric.d@gmail.com> Co-authored-by: Daniel McCloy <dan@mccloy.info>
Closes #12255
I also removed numerous unnecessary
# noqa: D102's from__init__()methods. (Unnecessary there if the class itself has a docstring)