LinuxCommandLibrary

isort

sorts Python imports alphabetically and separates them into sections

TLDR

Sort imports in file

$ isort [file.py]
copy
Sort imports in place
$ 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 separates them into sections. It follows PEP 8 guidelines for import organization.
The tool groups imports by standard library, third-party, and local. It integrates with editors and CI pipelines.

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.

CAVEATS

Python-specific. May conflict with other formatters. Use profiles for compatibility.

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

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community