Black should alphabetize imports
See original GitHub issueI assert black should alphabetize imports, especially like:
from .foo import (
baz,
bar,
sandwich,
fingers,
)
Should be ordered as:
from .foo import (
bar,
baz,
fingers,
sandwich
)
If it can’t I’ll get flake8 pulled in as well and have it balk at these too, even if it can’t do the reordering for us like black can.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Black should re-order imports like isort #573 - GitHub
We are currently working on implementing an isort + black to format the code base and sort imports as well, but it would...
Read more >Black doesn't sort imports at all. - Hacker News
And PEP 8 doesn't mention sorting the imports. There are even counterexamples which aren't alphabetically sorted. It does mention grouping ...
Read more >Using Black with other tools - Black 22.12.0 documentation
Why those options above?# ... Black wraps imports that surpass line-length by moving identifiers into their own indented line. If that still doesn't...
Read more >Python & VS Code: make Black and organize imports work ...
I use Black to format my Python code, and I tell VS Code to organise ... It turns out that VS Code uses...
Read more >Can Black be configured to ignore imports? - Stack Overflow
While I do not mind the way Black sorts my imports, I would still like to use isort to handle my imports and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

are we talking about imports within the same line or multiline imports as well? e.g. should
become
because personally i am more of a fan of imports that look like christmas tree and go from general (numpy as np, pandas as pd, etc.) to specific (from graspologic.embed import AdjacencySpectralEmbed, LaplacianSpectralEmbed). but that’s just my 2 cents.
This has been added by requiring isort balking if it doesn’t like the order