-
Notifications
You must be signed in to change notification settings - Fork 134
Add import sorting #1267
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
Add import sorting #1267
Conversation
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 think we should use the ruff import sorter rather than bring isort in. Since we're already using ruff and ruff comes with an isort-like import sorter.
Ruff documentation on its import sorter: https://docs.astral.sh/ruff/faq/#how-does-ruffs-import-sorting-compare-to-isort
Ruff documentation on how to use its import sorter: https://docs.astral.sh/ruff/formatter/#sorting-imports
I don't see any conflicts between ruff and isort in the repo as-is, and can't find any description of this, but I know isort and black and have conflicting opinions about how to format imports, and I imagine that could be true for isort and ruff as well.
I think the main value here is reducing additional dependencies, which is a chronic problem with parsons.
|
How interesting, I had no idea that Ruff offered that. |
67edde9 to
1fa0df7
Compare
austinweisgrau
left a comment
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.
How elegant
236a4aa to
2f5c237
Compare
shaunagm
left a comment
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.
looks great!
As per last year's discussion in #1132, here is a discrete PR implementing import sorting in the Github Actions check and pre-commit config.
See PEP #8 > Imports
https://peps.python.org/pep-0008/#imports