mrkeyoor.com_
Sun 20 Sept 04:56 UTC
PyPICLI & Toolingupdated 19 Sept 2026

isort review

isort 8.0.1 rearranges Python imports without formatting the surrounding program. Its CLI and Python API classify statements as future, standard library, third party, first party, or local, then apply configured section order and one of 12 wrapping modes. The current release fixes Python 3.14 standard-library data and a case where comments inside an indented block were damaged. It runs on Python 3.10 or newer, still parses older source, and arrived as one typed pure-Python package in our test.

Verdict

isort 8.0.1 installed as 1 package using 1 MB in our sandbox, imported in 0.35 seconds, and produced no audit findings. Keep it for established policies and custom sections; for a new project with ordinary grouping, Ruff's I rules are the simpler starting point.

We installed it

Lab card: what happened when we installed isortScreenshot of isort documentation
Install✓ · 0.4s1 package on disk · 1 MB
Importimport isort in 0.35s · pure Python · py.typed · requires Python >=3.10.0
Known vulns0(pip-audit)

Answers from our run

Does isort install cleanly?

Yes. In a fresh container with an empty cache, pip install isort finished in 0.4s, leaving 1 package and 1 MB on disk. pip-audit reported no known vulnerabilities.

What does isort need to run?

Python >=3.10.0, and nothing compiled: it is pure Python. In our run import isort succeeded in 0.35s, and the package ships py.typed for type checkers.

isort or ruff: which should you use?

ruff: Use its I rules when one fast executable should lint, sort imports, and format. isort 8.0.1 installed as 1 package using 1 MB in our sandbox, imported in 0.35 seconds, and produced no audit findings.

When should you not use isort?

A new project already uses Ruff; enabling its I rules usually removes a separate import command.

API stability3/5Common CLI flags, pyproject settings, compatibility profiles, skip comments, and the string/file Python API remain recognizable. The observable product is the rewritten text, though, and version 8 updated standard-library knowledge while removing older integration paths. Pinning matters because a correct classifier change can produce a large diff even when no public method signature changed.
Docs4/5The official site covers configuration discovery, Black cooperation, pre-commit, custom sections, skip directives, profiles, module placement, and all 12 multiline modes. Its settings reference connects defaults to CLI flags. Safe setup still requires visiting several pages because root discovery, path classification, formatter agreement, and file filtering are separate concerns rather than one short project checklist.
Maintenance4/5PyPI published 8.0.1 on February 28, 2026, and GitHub shows an active unarchived repository pushed on August 18, 2026. The repository has 6,947 stars and 87 open issues and pull requests. Recent fixes track Python 3.14's standard library and preserve comments correctly, while major releases also remove aging integrations instead of promising permanent compatibility.
Ecosystem5/5The supplied registry figure is 31,108,297 weekly downloads, and GitHub reports 6,947 stars. isort has a maintained pre-commit hook, editor integrations, a library API, named formatter profiles, and configuration conventions reused by other tools. Ruff naming its compatible import rules as the I family shows that isort's section model is now common vocabulary even for teams that do not install isort.

Use it if

  • A repository already standardizes import output through isort in editors, hooks, and CI.
  • Import policy needs custom sections, forced separation, or explicit first-party classification.
  • A Python transformation calls `isort.code` or `isort.file` instead of starting another process.
  • Order-sensitive files need supported line, block, or whole-file skip controls.
Skip it if

Setup reality

We installed isort 8.0.1 in a fresh Python 3.12 Bookworm environment in 0.4 seconds. The install left 1 package and 1 MB on disk. Metadata reports 1 direct dependency, pure Python, an MIT license, Python 3.10 or newer, and a bundled py.typed marker. import isort worked in 0.35 seconds, while pip-audit found 0 known vulnerabilities. The package cost is small; synchronized configuration and version pins are the operational work.

Place the shared policy in [tool.isort] within pyproject.toml. isort can also discover .isort.cfg, setup.cfg, and tox.ini while walking upward from a target, so different monorepo paths may resolve different roots. --settings-path removes that ambiguity. Projects using a src layout or namespace packages should set src_paths or known_first_party; otherwise internal modules can land among third-party imports.

For Black, set profile = "black" and use the same line length. isort does not automatically follow .gitignore unless skip_gitignore is enabled. Pre-commit jobs that pass explicit filenames often need --filter-files so isort exclusions still apply. CI should use --check-only --diff, and both the hook revision and CI dependency should pin 8.0.1. A classifier update can otherwise fail a file nobody edited.

Alphabetic validity does not imply runtime safety. Imports may register plugins, monkey-patch a module, choose a Matplotlib backend, or sit inside a function to break a cycle. --atomic catches syntax errors only. Use # isort: skip, off/on blocks, or a file exclusion for intentional order. Version 8.0.1 repaired comment handling in indented blocks, yet teams upgrading from 7 should inspect the initial full diff before enabling writes.

Patterns

Rewrite imports under two directories format-paths

isort src tests

# Preview without writing
isort --diff src tests

The first command edits files in place; review the preview before an initial repository-wide run.

Fail CI and print the required patch check-in-ci

isort --check-only --diff src tests

A nonzero exit marks any file that would change, while `--diff` gives the contributor the exact repair.

Use Black-compatible wrapping match-black

# pyproject.toml
[tool.isort]
profile = "black"
line_length = 88

Black and isort must share the 88-character limit or they can disagree about the same import block.

Classify modules in a src layout mark-first-party

[tool.isort]
src_paths = ["src", "tests"]
known_first_party = ["billing", "testkit"]
known_third_party = ["vendor_sdk"]

Namespace packages and unusual roots often require explicit names even when `src_paths` is present.

Exclude imports with runtime ordering requirements protect-order

import gevent.monkey  # isort: skip
gevent.monkey.patch_all()

# isort: off
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
# isort: on

These comments preserve monkey-patching and backend selection that a sorter cannot infer from syntax.

Lock the official hook to 8.0.1 pin-pre-commit

repos:
  - repo: https://github.com/PyCQA/isort
    rev: 8.0.1
    hooks:
      - id: isort
        args: ["--filter-files"]

The version pin prevents an automatic formatter change; `--filter-files` reapplies isort exclusions to explicit hook paths.

Reorder source held in memory sort-string

import isort
config = isort.Config(profile='black', known_first_party=['billing'])
result = isort.code('import requests\nimport billing\n', config=config)
print(result)

`isort.code` returns a new string and does not write a file; reuse one Config across a batch.

Show the settings and files isort resolved inspect-config

isort --show-config src/billing/api.py
isort --show-files src tests
isort --verbose --diff src/billing/api.py

These commands explain disagreements among an editor, a shell, and CI by exposing the selected root and input set.

Insert a dedicated framework section define-section

[tool.isort]
sections = ["FUTURE", "STDLIB", "DJANGO", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
known_django = ["django"]
section_comments = ["DJANGO"]

A custom section needs the corresponding `known_<lowercase>` list, which is one reason to choose isort over a simpler sorter.

Alternatives

PackageRegistryPick it when
ruffPyPIUse its I rules when one fast executable should lint, sort imports, and format.
reorder-python-importsPyPIUse it for a stricter style with fewer configuration choices.
usortPyPIUse it when side-effect barriers should constrain how far imports can move.
autoflakePyPIUse it when removing unused or duplicate imports is the actual job.

More cli & tooling guides

commander · chalk · typescript · esbuild · yargs · click · the whole shelf →

How this guide is made: grounded in the library's documentation, release notes, changelog, and issue history, on a fixed rubric — not a hands-on install of every release. The 50 most-downloaded entries are additionally install-verified in clean containers. Corrections: contact the desk.