Sort Python imports alphabetically and into sections
open sourceMITfree
isort is a Python utility and library from PyCQA that sorts imports alphabetically and separates them into sections and by type. It runs as a command-line tool, as a Python library and through editor plugins and pre-commit, has a compatibility profile for Black, and can format Python 2 code as well as Python 3.
Problems it solves
- keep the imports at the top of my Python files in a consistent order
- fix import order automatically in CI
- stop merge conflicts from reordered Python imports
Features
- sort imports alphabetically
- group imports into sections and by type
- command line, library and editor plugins
- pre-commit hook
- Black compatibility profile
Alternatives
The same job
These do what isort does.
- Ruff An extremely fast Python linter and code formatter, written in Rust
