Replies: 1 comment
-
Not sure about the blocks..., but you can force isort to keep each import on separate lines with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I've been writing Python for over a decade and I've ultimately arrived at this approach that has not changed in a few years. From what I can tell this can't be done with isort, but maybe I didn't find the right settings:
This is how my organisation typically looks like in my code:
__future__
imports, sorted by name.import
directives, sorted by name.from
directives, sorted by name.I do not use any commas in my imports, that means I never do
from foo import bar, baz
. I've stopped doing that at some point as it makes for easier sorting and nicer Git histories.Basically what I do is write my import in the right block, then sort the block.
Any way isort can support this style? Thanks for letting me know.
Beta Was this translation helpful? Give feedback.
All reactions