isort is a Python utility that sorts import statements alphabetically and groups them into sections, usable via command line, library calls, or editor plugins.
- 10.0.0b1
- Published at
- 10d ago
- 6,962
- Stars
- 1,240
- Download
- Synced at
- 8d ago
Latest release
10.0.0b1Oct 18, 2026, 07:20 PMPre-releaseDownloads slow? Switch the source anytime above
README
Project Overview
isort is a Python utility for organizing import statements: it sorts them alphabetically and automatically separates them into sections by type such as standard library, third-party, and local imports. It offers a command line tool, a Python library API, and plugins for many editors, keeping imports tidy across your project. isort requires Python 3.11+ to run and can also format Python 2 code.
| Item | Value |
|---|---|
| Language | Python |
| Runtime | Python 3.11+ |
| Usage | CLI, Python library, editor plugins |
| License | MIT |
Delegate import sorting to the tool and never think about it again.
Key Features
- Automatic sorting: orders import statements alphabetically
- Section grouping: separates imports into sections by source type automatically
- Diff preview:
--diffshows proposed changes before applying them - Atomic mode:
--atomicapplies changes only when they introduce no syntax errors - Library API: callable from Python code through the isort interface
- Check mode:
--check-onlyvalidates import order in CI without modifying files - Fine-grained config: multi-line output modes, indentation, custom sections, and more
- Selective skipping: skip specific imports or files with
isort:skipcomments
Target Audience
- Python developers
- Open-source maintainers
- Code standards enforcers
- CI pipeline maintainers
- Teams using Black
Quick Start
- Install isort
pip install isort- Sort specific files
isort mypythonfile.py mypythonfile2.py- Process a whole project recursively
isort .- Validate without modifying in CI
isort . --check-onlyCore Advantages
- Works out of the box: defaults satisfy most projects
- Black compatible: an official guide covers Black-compatible configuration
- pre-commit support: officially supported pre-commit hook integration
- Deeply configurable: nearly every sorting detail can be customized
System Requirements
| Item | Requirement |
|---|---|
| OS | Linux, macOS, Windows |
| Runtime | Python 3.11 or later |
| Target code | can also format Python 2 code |
Notes
- Version requirement: running isort requires Python 3.11 or later
- Multi-line modes:
multi_line_outputoffers 12 wrapping styles; pick one per team convention - Atomic off by default:
--atomicis disabled by default to avoid cross-version misjudgment
Release history
Sort