Import Organizer
This Import Organizer now lets you:
- Sort & group with any
isortprofile. - Remove unused imports automatically.
- Combine simple top‑level imports into one line.
- Expand any comma‑separated imports back into individual lines.
- Optionally re‑format the whole file with Black.
Example: Combine vs. Expand
Input:
import os
import sys
def foo(): pass
Combine Only: Combine simple imports: ✔
import os, sys
def foo(): pass
Expand Only: Expand comma‑separated: ✔
import os
import sys
def foo(): pass
Both Off: (isort only)
import os
import sys
def foo(): pass
Why These Features Matter
- Compact code when you prefer one‑line imports.
- Readable lists when you want each import on its own line.
- Combine style control with linting (Black) in one tool.
- Adapt to any project’s import conventions via profiles.
When to Use
– Toggle as needed in pre‑commit hooks.
– Switch between compact scripts and verbose modules.
– Enforce team conventions across diverse codebases.