-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Reintroduce isort in the pre-commit #1145
base: master
Are you sure you want to change the base?
Conversation
Task linked: QF-5224 Reintroduce isort in the pre-commit |
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.
Cannot merge until we remove the dependency.
ruff.toml
Outdated
@@ -20,6 +20,7 @@ exclude = [ | |||
target-version = "py310" | |||
|
|||
[lint] | |||
select = ["I"] |
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 believe we don't need this one.
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 issue here, as mentioned in the description, is that ruff along with isort seems to break. I added select = ["I"]
to let Ruff handle import sorting natively (as it supports this kind of rules - check here, which improves both performance and dependencies reduction. However, if keeping isort separately offers more, I’m happy to revert it!
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.
See what I meant in the call earlier. https://docs.astral.sh/ruff/configuration/#python-file-discovery
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.
So we need extend-select I guess..
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.
Test it, I guess that too.
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.
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.
Great!
Please do a separate commit fixing all already existing errors with isort in the codebase and we are good to merge. |
4baae28
to
5acc8ec
Compare
There are conflicts in the PR and it is still WIP, shall I really review? |
5acc8ec
to
5311540
Compare
Auto-sort imports using Ruff instead of isort Replace select with extend-select for isort-based sorting of imports Fix import applying isort via pre-commit Fix conflicting files
6789d1f
to
5dc11ce
Compare
Ready to go! |
This PR integrates isort via
ruff
usingextend-select
. Instead of adding isort separately in pre-commit and dependencies, this PR utilizesruff
's built-in import sorting by extending its configuration.Changes in This PR
ruff
usingextend-select = ["I"]
in ruff.tomlHow to Test
pre-commit run --all-files
Before

After
