LinuxCommandLibrary

isort

Python import sorter and organizer

TLDR

Sort imports in file

$ isort [file.py]
copy
Check without modifying
$ isort --check-only [file.py]
copy
Show diff
$ isort --diff [file.py]
copy
Sort all Python files
$ isort .
copy
Use Black-compatible profile
$ isort --profile black [file.py]
copy

SYNOPSIS

isort [options] [path...]

DESCRIPTION

isort sorts Python imports alphabetically and automatically separates them into sections following PEP 8 guidelines. It groups imports into standard library, third-party, and local application sections with blank lines between each group.
The tool integrates with popular formatters like Black through profiles, and can be used in editor plugins, pre-commit hooks, and CI pipelines to enforce consistent import ordering across a codebase.

PARAMETERS

--check-only

Check without modifying.
--diff
Show changes as diff.
--profile NAME
Use predefined profile (black, django, pycharm).
-l LENGTH
Line length limit.
--force-single-line
One import per line.
--skip GLOB
Skip files matching pattern.
--help
Display help information.

CONFIGURATION

pyproject.toml `[tool.isort]`

Preferred configuration location. Supports all isort settings including profile, linelength, and knownthird_party.
setup.cfg `[isort]`
Alternative configuration in setup.cfg format.
.isort.cfg
Dedicated isort configuration file, searched in the project root.

CAVEATS

Python-specific. May conflict with other formatters without proper profile configuration. Use profiles for compatibility with Black or other tools.

HISTORY

isort was created by Timothy Crosley to automatically sort and organize Python imports following best practices.

SEE ALSO

black(1), flake8(1), autopep8(1), pylint(1)

> TERMINAL_GEAR

Curated for the Linux community

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

BOSGAME Mini PC N95, Intel 12th Mini Computers| 16GB DDR4 RAM| 512GB M.2 2280 SSD| 4K 60HZ Triple Displays by Dual HDMI+Type-C, 6W TDP Quiet Mini PC, WIFI5, BT 5.0 Office

$239.99
New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

New Raspberry Pi 3 Model B+ Board Raspberry PI 3B+

$54.00
KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

$129.95
KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50