-
-
Notifications
You must be signed in to change notification settings - Fork 749
isort → ruff #9152
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
Merged
Merged
isort → ruff #9152
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,6 +80,7 @@ line-length = 120 | |
| extend-select = [ | ||
| "B", | ||
| "TID", | ||
| "I", | ||
| "UP", | ||
| ] | ||
| ignore = [ | ||
|
|
@@ -101,15 +102,11 @@ ignore = [ | |
| "distributed/shuffle/tests/test_shuffle.py" = ["F601"] | ||
| "distributed/utils.py" = ["F821"] | ||
|
|
||
| [tool.isort] | ||
| sections = ["FUTURE", "STDLIB", "THIRDPARTY", "DISTRIBUTED", "FIRSTPARTY", "LOCALFOLDER"] | ||
| profile = "black" | ||
| skip_gitignore = true | ||
| force_to_top = ["true"] | ||
| default_section = "THIRDPARTY" | ||
|
Comment on lines
-106
to
-109
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Obviously, I think that Option |
||
| known_first_party = ["distributed"] | ||
| known_distributed = ["dask", "zict"] | ||
DimitriPapadopoulos marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| add_imports = ["from __future__ import annotations"] | ||
| [tool.ruff.lint.isort] | ||
| section-order = ["future", "standard-library", "third-party", "distributed", "first-party", "local-folder"] | ||
|
|
||
| [tool.ruff.lint.isort.sections] | ||
| "distributed" = ["dask", "zict"] | ||
|
|
||
| [tool.setuptools_scm] | ||
| version_file = "distributed/_version.py" | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks like ruff supports sections, can you make sure we are configuring things the same way? We use these sections specifically to improve readability.
I would suggest going through each setting we had with isort and checking if you can replicate the same setting with ruff.
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.
Like for dask, I focused on actual changes in the source code instead of reviewing individual options in detail. It seems to work well in both repositories.
I can review the options more in detail. I seem to recall that most of them are identical to the defaults, which is why I removed them. I'll have a look.
Uh oh!
There was an error while loading. Please reload this page.
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.
tool.isort.sectionsdefines all sections isort uses by default:The main difference with the default value is the addition of
DISTRIBUTED.where
DISTRIBUTEDis defined as:which I guess
forces to identifyputsdask,distributedandzictas being part of the current python project. This avoids the empty line betweendaskanddistributedimportsdaskandzictimports in a section of their own, between third-party and first-partydistributed.My thoughts about it:
Actually, why avoid the line betweendaskanddistributedimports? I don't see how that's a good idea.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.
Nevertheless, I have added this section in ruff settings:
I'll have a fresh look at
dasktaking into account this change.