What does it do?
isort looks at the list of imports at the top of a Python file, the lines that pull in other pieces of code, and automatically sorts and groups them into a consistent order, alphabetically and by category. It’s the code equivalent of alphabetizing a bookshelf and grouping fiction separately from reference books, done automatically every time someone adds a new book. Left alone, developers add imports in whatever order they happen to write code, which turns into a disorganized pile within weeks. isort rewrites that section cleanly every time, with zero manual effort required.
See it in action
This shows a file’s import lines before and after running the isort command, which automatically sorts them alphabetically and groups outside libraries separately from built-in ones.
# before: isort my_script.py
import sys
import requests
import os
# after isort reorders the imports:
import os
import sys
import requests
Why would a non-developer care?
It’s a small, unglamorous tool, but it removes one more thing from the long list of tiny frictions that slow teams down and spark pointless disagreements during code review.
Real-world examples
isort is commonly wired into the same automated checks that run Black, so a project’s imports and formatting both stay consistent without anyone thinking about it. It’s specifically designed to play nicely alongside Black rather than fight with it over formatting decisions.
Who uses it
Python developers and teams who want a tidy, consistent import section in every file without manually reordering lines themselves.
How it compares to alternatives
Its job overlaps with what Ruff now handles internally as one of its many built-in checks, meaning some teams have replaced isort entirely by switching to Ruff’s all-in-one approach.