Black is an opinionated, deterministic Python code formatter that rewrites files in place with minimal diffs.
PyCQA/isort
A Python utility and library that automatically sorts and groups your import statements.
- Stars
- 6,962
- Forks
- 724
- Open issues
- 78
- Last commit
- 9 hours ago
What is it?
isort sorts Python import statements alphabetically and automatically separates them into sections by type, such as standard library, third-party, and first-party imports. It can be run from the command line on individual files or whole directories, or called from Python code through its library functions.
The tool offers a --diff option to preview changes before applying them, and a --check-only mode that reports files with unsorted imports, which suits pre-commit hooks and CI checks. Its output wrapping for long from-imports has 12 configurable modes, and it can be configured to stay compatible with the black formatter.
isort also provides plugins for various text editors, official pre-commit support, and a Git hook. It requires Python 3.11 or later to run, though it can format Python 2 code.
Key features
- 01Sorts imports alphabetically and groups them into configurable sections.
- 02Offers a --diff preview and a --check-only mode for CI and pre-commit use.
- 03Provides 12 multi-line wrapping modes for long import statements.
- 04Supports compatibility with the black formatter.
- 05Can be used from the command line or as a Python library.
Use cases
- Keeping imports consistent across a large Python codebase.
- Enforcing import order in CI or pre-commit hooks.
- Automatically tidying imports in editors on save.
- Calling import sorting from scripts or other Python tools.
Topics
FAQ
- What is isort?
- A Python utility and library that automatically sorts and groups your import statements. isort sorts Python import statements alphabetically and automatically separates them into sections by type, such as standard library, third-party, and first-party imports. It can be run from the command line on individual files or whole directories, or called from Python code through its library functions.
- Is isort free to use? What license does it have?
- isort is open source under the MIT license. Check the license terms before using it in commercial products.
- Is isort still maintained?
- Actively maintained. The last commit to isort was on Oct 21, 2026.
- What can I use isort for?
- Keeping imports consistent across a large Python codebase. Enforcing import order in CI or pre-commit hooks. Automatically tidying imports in editors on save. Calling import sorting from scripts or other Python tools.
- Where can I get isort?
- The source code and installation instructions are on GitHub: https://github.com/PyCQA/isort
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A pluggable linter and auto-fixer that enforces Protocol Buffer style guide rules without requiring a protoc compiler.
A Rust-based toolchain for web projects that provides a formatter and linter for JavaScript, TypeScript, JSX, JSON, CSS and more, via CLI and LSP.
A zero-configuration linter and formatter for JavaScript and TypeScript that wires up Biome, ESLint, or Oxlint with preset rules in one command.
A CLI that scores the code quality of a project across 14 languages and produces a report with an overall score and per-file rankings.
A Python checker that flags common AI writing patterns in English text and scores it out of 5, plus an AI-assisted editing workflow.