Sort only the import types without rearranging the lines #12310
-
Is there a ruff config to do this?
Before from .yyy import BBB, AAA
from .xxx import DDD, CCC After (Notice how only the types are sorted, not the lines) from .yyy import AAA, BBB
from .xxx import CCC, DDD Current (I do not want this behavior) from .xxx import CCC, DDD
from .yyy import AAA, BBB Reason: I use this in Thanks for your work on the project. |
Beta Was this translation helpful? Give feedback.
Answered by
MichaReiser
Jul 15, 2024
Replies: 1 comment 3 replies
-
HI @Alc-Alc no option disables sorting of the imported modules entirely. Can you tell me more about how you determine the order of your import statements or do you want to allow arbitrary import ordering? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the detailed explanation. That helped!
I assume that this exception only applies to a few imports? If so, you can tell Ruff to not sort a specific import by using
isort: skip
https://docs.astral.sh/ruff/linter/#action-comments