Scroll to navigation

ISORT(1) User Commands ISORT(1)


isort - program for sorting Python import definitions


isort [-h] [-l LINE_LENGTH] [-s SKIP] [-ns NOT_SKIP] [-t FORCE_TO_TOP] [-b KNOWN_STANDARD_LIBRARY] [-o KNOWN_THIRD_PARTY] [-p KNOWN_FIRST_PARTY] [-m MODE] [-i INDENT] [-a ADD_IMPORTS] [-af] [-r REMOVE_IMPORTS] [-ls] [-d] [-c] [-sl] [-sd DEFAULT_SECTION] [-df] [-e] [-rc] [-ot] [-ac] [-cs] [-v] [-vb] [-sp SETTINGS_PATH] file...


isort sorts Python import definitions alphabetically within logical sections.


show this help message and exit
The maximum length of an import line (used for wrapping long imports).
Files that sort imports should skip over.
Files that sort imports should never skip over.
Force specific imports to the top of their appropriate section.
Force isort to recognize a module as part of the python standard library.
Force isort to recognize a module as being part of a third party library.
Force isort to recognize a module as being part of the current python project.
Multi line output (0=grid, 1=vertical, 2=hanging, 3=vert-hanging, 4=vert-grid, 5=vert-grid-grouped).
String to place for indents; defaults to " " (4 spaces).
Adds the specified import line to all files, automatically determining correct placement.
Forces import adds even if the original file is empty.
Removes the specified import from all files.
Sort imports by their string length.
Force resulting output to stdout, instead of in-place.
Checks the file for unsorted imports and prints them to the command line without modifying the file.
Forces all from imports to appear on their own line.
Sets the default section for imports (by default, FIRSTPARTY). Possible values: FUTURE, ISTDLIB, THIRDPARTY, FIRSTPARTY, LOCALFOLDER
Prints a diff of all the changes isort would make to a file, instead of changing it in place
Balances wrapping to produce the most consistent line length possible.
Recursively look for Python files of which to sort imports.
Order imports by type in addition to alphabetically.
Ensures the output doesn't save if the resulting file contains syntax errors.
Ensures that if a star import is present, nothing else is imported from that namespace.
Show program's version number and exit.
Shows verbose output, such as when files are skipped or when a check is successful.
Explicitly set the settings path instead of auto determining based on file location.
December 2014 isort 3.9.2