Debian Codegraph @

docs/configuration/options.md

raw
1 # Configuration options for isort
2
3 As a code formatter isort has opinions. However, it also allows you to have your own. If your opinions disagree with those of isort,
4 isort will disagree but commit to your way of formatting. To enable this, isort exposes a plethora of options to specify
5 how you want your imports sorted, organized, and formatted.
6
7 Too busy to build your perfect isort configuration? For curated common configurations, see isort's [built-in
8 profiles](./profiles.md).
9
10 ## Python Version
11
12 Tells isort to set the known standard library based on the specified Python version. Default is to assume any Python 3 version could be the target, and use a union of all stdlib modules across versions. If auto is specified, the version of the interpreter used to run isort (currently: 39) will be used.
13
14 **Type:** String
15 **Default:** `py3`
16 **Config default:** `3`
17 **Python & Config File Name:** py_version
18 **CLI Flags:**
19
20 - --py
21 - --python-version
22
23 **Examples:**
24
25 ### Example `.isort.cfg`
26
27 ```
28 [settings]
29 py_version=39
30
31 ```
32
33 ### Example `pyproject.toml`
34
35 ```
36 [tool.isort]
37 py_version=39
38
39 ```
40
41 ### Example cli usage
42
43 `isort --py 39`
44
45 ## Force To Top
46
47 Force specific imports to the top of their appropriate section.
48
49 **Type:** List of Strings
50 **Default:** `frozenset()`
51 **Config default:** `[]`
52 **Python & Config File Name:** force_to_top
53 **CLI Flags:**
54
55 - -t
56 - --top
57
58 ## Skip
59
60 Files that isort should skip over. If you want to skip multiple files you should specify twice: `--skip file1 --skip file2`. Values can be file names, directory names or file paths. To skip all files in a nested path, use [`--skip-glob`](#skip-glob). To even skip matching files that have been specified on the command line, use [`--filter-files`](#filter-files).
61
62 **Type:** List of Strings
63 **Default:** `('.bzr', '.direnv', '.eggs', '.git', '.hg', '.mypy_cache', '.nox', '.pants.d', '.pytype' '.svn', '.tox', '.venv', '__pypackages__', '_build', 'buck-out', 'build', 'dist', 'node_modules', 'venv')`
64 **Config default:** `['.bzr', '.direnv', '.eggs', '.git', '.hg', '.mypy_cache', '.nox', '.pants.d', '.svn', '.tox', '.venv', '__pypackages__', '_build', 'buck-out', 'build', 'dist', 'node_modules', 'venv']`
65 **Python & Config File Name:** skip
66 **CLI Flags:**
67
68 - -s
69 - --skip
70
71 **Examples:**
72
73 ### Example `.isort.cfg`
74
75 ```
76 [settings]
77 skip=.gitignore,.dockerignore
78 ```
79
80 ### Example `pyproject.toml`
81
82 ```
83 [tool.isort]
84 skip = [".gitignore", ".dockerignore"]
85
86 ```
87
88 ## Extend Skip
89
90 Extends --skip to add additional files that isort should skip over. If you want to skip multiple files you should specify twice: --skip file1 --skip file2. Values can be file names, directory names or file paths. To skip all files in a nested path, use [`--skip-glob`](#skip-glob). To even skip matching files that have been specified on the command line, use [`--filter-files`](#filter-files).
91
92 **Type:** List of Strings
93 **Default:** `frozenset()`
94 **Config default:** `[]`
95 **Python & Config File Name:** extend_skip
96 **CLI Flags:**
97
98 - --extend-skip
99
100 **Examples:**
101
102 ### Example `.isort.cfg`
103
104 ```
105 [settings]
106 extend_skip=.md,.json
107 ```
108
109 ### Example `pyproject.toml`
110
111 ```
112 [tool.isort]
113 extend_skip = [".md", ".json"]
114
115 ```
116
117 ## Skip Glob
118
119 Files that isort should skip over. To even skip matching files that have been specified on the command line, use [`--filter-files`](#filter-files).
120
121 **Type:** List of Strings
122 **Default:** `frozenset()`
123 **Config default:** `[]`
124 **Python & Config File Name:** skip_glob
125 **CLI Flags:**
126
127 - --sg
128 - --skip-glob
129
130 **Examples:**
131
132 ### Example `.isort.cfg`
133
134 ```
135 [settings]
136 skip_glob=docs/*
137
138 ```
139
140 ### Example `pyproject.toml`
141
142 ```
143 [tool.isort]
144 skip_glob = ["docs/*"]
145
146 ```
147
148 ## Extend Skip Glob
149
150 Additional files that isort should skip over (extending --skip-glob). To even skip matching files that have been specified on the command line, use [`--filter-files`](#filter-files).
151
152 **Type:** List of Strings
153 **Default:** `frozenset()`
154 **Config default:** `[]`
155 **Python & Config File Name:** extend_skip_glob
156 **CLI Flags:**
157
158 - --extend-skip-glob
159
160 **Examples:**
161
162 ### Example `.isort.cfg`
163
164 ```
165 [settings]
166 extend_skip_glob=my_*_module.py,test/*
167
168 ```
169
170 ### Example `pyproject.toml`
171
172 ```
173 [tool.isort]
174 extend_skip_glob = ["my_*_module.py", "test/*"]
175
176 ```
177
178 ## Skip Gitignore
179
180 Treat project as a git repository and ignore files listed in .gitignore. To even skip matching files that have been specified on the command line, use [`--filter-files`](#filter-files).
181
182 NOTE: This requires git to be installed and accessible from the same shell as isort.
183
184 **Type:** Bool
185 **Default:** `False`
186 **Config default:** `false`
187 **Python & Config File Name:** skip_gitignore
188 **CLI Flags:**
189
190 - --gitignore
191 - --skip-gitignore
192
193 ## Line Length
194
195 The max length of an import line (used for wrapping long imports).
196
197 **Type:** Int
198 **Default:** `79`
199 **Config default:** `79`
200 **Python & Config File Name:** line_length
201 **CLI Flags:**
202
203 - -l
204 - -w
205 - --line-length
206 - --line-width
207
208 ## Wrap Length
209
210 Specifies how long lines that are wrapped should be, if not set line_length is used.
211 NOTE: wrap_length must be LOWER than or equal to line_length.
212
213 **Type:** Int
214 **Default:** `0`
215 **Config default:** `0`
216 **Python & Config File Name:** wrap_length
217 **CLI Flags:**
218
219 - --wl
220 - --wrap-length
221
222 ## Line Ending
223
224 Forces line endings to the specified value. If not set, values will be guessed per-file.
225
226 **Type:** String
227 **Default:** ` `
228 **Config default:** ` `
229 **Python & Config File Name:** line_ending
230 **CLI Flags:**
231
232 - --le
233 - --line-ending
234
235 ## Sort Re-exports
236
237 Specifies whether to sort re-exports (`__all__` collections) automatically.
238
239 **Type:** Bool
240 **Default:** `False`
241 **Config default:** `false`
242 **Python & Config File Name:** sort_reexports
243 **CLI Flags:**
244
245 - --srx
246 - --sort-reexports
247
248 ## Sections
249
250 What sections isort should display imports for and in what order
251
252 **Type:** List of Strings
253 **Default:** `('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER')`
254 **Config default:** `['FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER']`
255 **Python & Config File Name:** sections
256 **CLI Flags:** **Not Supported**
257
258 ## No Sections
259
260 Put all imports into the same section bucket
261
262 **Type:** Bool
263 **Default:** `False`
264 **Config default:** `false`
265 **Python & Config File Name:** no_sections
266 **CLI Flags:**
267
268 - --ds
269 - --no-sections
270
271 ## Known Future Library
272
273 Force isort to recognize a module as part of Python's internal future compatibility libraries. WARNING: this overrides the behavior of __future__ handling and therefore can result in code that can't execute. If you're looking to add dependencies such as six, a better option is to create another section below --future using custom sections. See: https://github.com/PyCQA/isort#custom-sections-and-ordering and the discussion here: https://github.com/PyCQA/isort/issues/1463.
274
275 **Type:** List of Strings
276 **Default:** `('__future__',)`
277 **Config default:** `['__future__']`
278 **Python & Config File Name:** known_future_library
279 **CLI Flags:**
280
281 - -f
282 - --future
283
284 ## Known Third Party
285
286 Force isort to recognize a module as being part of a third party library.
287
288 **Type:** List of Strings
289 **Default:** `frozenset()`
290 **Config default:** `[]`
291 **Python & Config File Name:** known_third_party
292 **CLI Flags:**
293
294 - -o
295 - --thirdparty
296
297 **Examples:**
298
299 ### Example `.isort.cfg`
300
301 ```
302 [settings]
303 known_third_party=my_module1,my_module2
304
305 ```
306
307 ### Example `pyproject.toml`
308
309 ```
310 [tool.isort]
311 known_third_party = ["my_module1", "my_module2"]
312
313 ```
314
315 ## Known First Party
316
317 Force isort to recognize a module as being part of the current python project.
318
319 **Type:** List of Strings
320 **Default:** `frozenset()`
321 **Config default:** `[]`
322 **Python & Config File Name:** known_first_party
323 **CLI Flags:**
324
325 - -p
326 - --project
327
328 **Examples:**
329
330 ### Example `.isort.cfg`
331
332 ```
333 [settings]
334 known_first_party=my_module1,my_module2
335
336 ```
337
338 ### Example `pyproject.toml`
339
340 ```
341 [tool.isort]
342 known_first_party = ["my_module1", "my_module2"]
343
344 ```
345
346 ## Known Local Folder
347
348 Force isort to recognize a module as being a local folder. Generally, this is reserved for relative imports (from . import module).
349
350 **Type:** List of Strings
351 **Default:** `frozenset()`
352 **Config default:** `[]`
353 **Python & Config File Name:** known_local_folder
354 **CLI Flags:**
355
356 - --known-local-folder
357
358 **Examples:**
359
360 ### Example `.isort.cfg`
361
362 ```
363 [settings]
364 known_local_folder=my_module1,my_module2
365
366 ```
367
368 ### Example `pyproject.toml`
369
370 ```
371 [tool.isort]
372 known_local_folder = ["my_module1", "my_module2"]
373
374 ```
375
376 ## Known Standard Library
377
378 Force isort to recognize a module as part of Python's standard library.
379
380 **Type:** List of Strings
381 **Default:** `('_ast', '_dummy_thread', '_thread', 'abc', 'aifc', 'argparse', 'array', 'ast', 'asynchat', 'asyncio', 'asyncore', 'atexit', 'audioop', 'base64', 'bdb', 'binascii', 'binhex', 'bisect', 'builtins', 'bz2', 'cProfile', 'calendar', 'cgi', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop', 'collections', 'colorsys', 'compileall', 'concurrent', 'configparser', 'contextlib', 'contextvars', 'copy', 'copyreg', 'crypt', 'csv', 'ctypes', 'curses', 'dataclasses', 'datetime', 'dbm', 'decimal', 'difflib', 'dis', 'distutils', 'doctest', 'dummy_threading', 'email', 'encodings', 'ensurepip', 'enum', 'errno', 'faulthandler', 'fcntl', 'filecmp', 'fileinput', 'fnmatch', 'formatter', 'fpectl', 'fractions', 'ftplib', 'functools', 'gc', 'getopt', 'getpass', 'gettext', 'glob', 'graphlib', 'grp', 'gzip', 'hashlib', 'heapq', 'hmac', 'html', 'http', 'imaplib', 'imghdr', 'imp', 'importlib', 'inspect', 'io', 'ipaddress', 'itertools', 'json', 'keyword', 'lib2to3', 'linecache', 'locale', 'logging', 'lzma', 'macpath', 'mailbox', 'mailcap', 'marshal', 'math', 'mimetypes', 'mmap', 'modulefinder', 'msilib', 'msvcrt', 'multiprocessing', 'netrc', 'nis', 'nntplib', 'ntpath', 'numbers', 'operator', 'optparse', 'os', 'ossaudiodev', 'parser', 'pathlib', 'pdb', 'pickle', 'pickletools', 'pipes', 'pkgutil', 'platform', 'plistlib', 'poplib', 'posix', 'posixpath', 'pprint', 'profile', 'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'queue', 'quopri', 'random', 're', 'readline', 'reprlib', 'resource', 'rlcompleter', 'runpy', 'sched', 'secrets', 'select', 'selectors', 'shelve', 'shlex', 'shutil', 'signal', 'site', 'smtpd', 'smtplib', 'sndhdr', 'socket', 'socketserver', 'spwd', 'sqlite3', 'sre', 'sre_compile', 'sre_constants', 'sre_parse', 'ssl', 'stat', 'statistics', 'string', 'stringprep', 'struct', 'subprocess', 'sunau', 'symbol', 'symtable', 'sys', 'sysconfig', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios', 'test', 'textwrap', 'threading', 'time', 'timeit', 'tkinter', 'token', 'tokenize', 'trace', 'traceback', 'tracemalloc', 'tty', 'turtle', 'turtledemo', 'types', 'typing', 'unicodedata', 'unittest', 'urllib', 'uu', 'uuid', 'venv', 'warnings', 'wave', 'weakref', 'webbrowser', 'winreg', 'winsound', 'wsgiref', 'xdrlib', 'xml', 'xmlrpc', 'zipapp', 'zipfile', 'zipimport', 'zlib', 'zoneinfo')`
382 **Config default:** `['_ast', '_dummy_thread', '_thread', 'abc', 'aifc', 'argparse', 'array', 'ast', 'asynchat', 'asyncio', 'asyncore', 'atexit', 'audioop', 'base64', 'bdb', 'binascii', 'binhex', 'bisect', 'builtins', 'bz2', 'cProfile', 'calendar', 'cgi', 'cgitb', 'chunk', 'cmath', 'cmd', 'code', 'codecs', 'codeop', 'collections', 'colorsys', 'compileall', 'concurrent', 'configparser', 'contextlib', 'contextvars', 'copy', 'copyreg', 'crypt', 'csv', 'ctypes', 'curses', 'dataclasses', 'datetime', 'dbm', 'decimal', 'difflib', 'dis', 'distutils', 'doctest', 'dummy_threading', 'email', 'encodings', 'ensurepip', 'enum', 'errno', 'faulthandler', 'fcntl', 'filecmp', 'fileinput', 'fnmatch', 'formatter', 'fpectl', 'fractions', 'ftplib', 'functools', 'gc', 'getopt', 'getpass', 'gettext', 'glob', 'graphlib', 'grp', 'gzip', 'hashlib', 'heapq', 'hmac', 'html', 'http', 'imaplib', 'imghdr', 'imp', 'importlib', 'inspect', 'io', 'ipaddress', 'itertools', 'json', 'keyword', 'lib2to3', 'linecache', 'locale', 'logging', 'lzma', 'macpath', 'mailbox', 'mailcap', 'marshal', 'math', 'mimetypes', 'mmap', 'modulefinder', 'msilib', 'msvcrt', 'multiprocessing', 'netrc', 'nis', 'nntplib', 'ntpath', 'numbers', 'operator', 'optparse', 'os', 'ossaudiodev', 'parser', 'pathlib', 'pdb', 'pickle', 'pickletools', 'pipes', 'pkgutil', 'platform', 'plistlib', 'poplib', 'posix', 'posixpath', 'pprint', 'profile', 'pstats', 'pty', 'pwd', 'py_compile', 'pyclbr', 'pydoc', 'queue', 'quopri', 'random', 're', 'readline', 'reprlib', 'resource', 'rlcompleter', 'runpy', 'sched', 'secrets', 'select', 'selectors', 'shelve', 'shlex', 'shutil', 'signal', 'site', 'smtpd', 'smtplib', 'sndhdr', 'socket', 'socketserver', 'spwd', 'sqlite3', 'sre', 'sre_compile', 'sre_constants', 'sre_parse', 'ssl', 'stat', 'statistics', 'string', 'stringprep', 'struct', 'subprocess', 'sunau', 'symbol', 'symtable', 'sys', 'sysconfig', 'syslog', 'tabnanny', 'tarfile', 'telnetlib', 'tempfile', 'termios', 'test', 'textwrap', 'threading', 'time', 'timeit', 'tkinter', 'token', 'tokenize', 'trace', 'traceback', 'tracemalloc', 'tty', 'turtle', 'turtledemo', 'types', 'typing', 'unicodedata', 'unittest', 'urllib', 'uu', 'uuid', 'venv', 'warnings', 'wave', 'weakref', 'webbrowser', 'winreg', 'winsound', 'wsgiref', 'xdrlib', 'xml', 'xmlrpc', 'zipapp', 'zipfile', 'zipimport', 'zlib', 'zoneinfo']`
383 **Python & Config File Name:** known_standard_library
384 **CLI Flags:**
385
386 - -b
387 - --builtin
388
389 **Examples:**
390
391 ### Example `.isort.cfg`
392
393 ```
394 [settings]
395 known_standard_library=my_module1,my_module2
396
397 ```
398
399 ### Example `pyproject.toml`
400
401 ```
402 [tool.isort]
403 known_standard_library = ["my_module1", "my_module2"]
404
405 ```
406
407 ## Extra Standard Library
408
409 Extra modules to be included in the list of ones in Python's standard library.
410
411 **Type:** List of Strings
412 **Default:** `frozenset()`
413 **Config default:** `[]`
414 **Python & Config File Name:** extra_standard_library
415 **CLI Flags:**
416
417 - --extra-builtin
418
419 **Examples:**
420
421 ### Example `.isort.cfg`
422
423 ```
424 [settings]
425 extra_standard_library=my_module1,my_module2
426
427 ```
428
429 ### Example `pyproject.toml`
430
431 ```
432 [tool.isort]
433 extra_standard_library = ["my_module1", "my_module2"]
434
435 ```
436
437 ## Known Other
438
439 known_OTHER is how imports of custom sections are defined. OTHER is a placeholder for the custom section name.
440
441 **Type:** Dict
442 **Default:** `{}`
443 **Config default:** `{}`
444 **Python & Config File Name:** known_other
445 **CLI Flags:** **Not Supported**
446
447 **Examples:**
448
449 ### Example `.isort.cfg`
450
451 ```
452 [settings]
453 sections=FUTURE,STDLIB,THIRDPARTY,AIRFLOW,FIRSTPARTY,LOCALFOLDER
454 known_airflow=airflow
455 ```
456
457 ### Example `pyproject.toml`
458
459 ```
460 [tool.isort]
461 sections = ['FUTURE', 'STDLIB', 'THIRDPARTY', 'AIRFLOW', 'FIRSTPARTY', 'LOCALFOLDER']
462 known_airflow = ['airflow']
463 ```
464
465 ## Multi Line Output
466
467 Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 5-vert-grid-grouped, 6-deprecated-alias-for-5, 7-noqa, 8-vertical-hanging-indent-bracket, 9-vertical-prefix-from-module-import, 10-hanging-indent-with-parentheses).
468
469 **Type:** Wrapmodes
470 **Default:** `WrapModes.GRID`
471 **Config default:** `WrapModes.GRID`
472 **Python & Config File Name:** multi_line_output
473 **CLI Flags:**
474
475 - -m
476 - --multi-line
477
478 **Examples:**
479
480 ### Example `.isort.cfg`
481
482 ```
483 [settings]
484 multi_line_output=3
485 ```
486
487 ### Example `pyproject.toml`
488
489 ```
490 [tool.isort]
491 multi_line_output = 3
492 ```
493
494 ## Forced Separate
495
496 Force certain sub modules to show separately
497
498 **Type:** List of Strings
499 **Default:** `()`
500 **Config default:** `[]`
501 **Python & Config File Name:** forced_separate
502 **CLI Flags:**
503
504 - --fs
505 - --forced-separate
506
507 **Examples:**
508
509 ### Example `.isort.cfg`
510
511 ```
512 [settings]
513 forced_separate=glob_exp1,glob_exp2
514
515 ```
516
517 ### Example `pyproject.toml`
518
519 ```
520 [tool.isort]
521 forced_separate = ["glob_exp1", "glob_exp2"]
522
523 ```
524
525 ## Indent
526
527 String to place for indents defaults to " " (4 spaces).
528
529 **Type:** String
530 **Default:** ` `
531 **Config default:** ` `
532 **Python & Config File Name:** indent
533 **CLI Flags:**
534
535 - -i
536 - --indent
537
538 ## Comment Prefix
539
540 Allows customizing how isort prefixes comments that it adds or modifies on import linesGenerally ` #` (two spaces before a pound symbol) is use, though one space is also common.
541
542 **Type:** String
543 **Default:** ` #`
544 **Config default:** ` #`
545 **Python & Config File Name:** comment_prefix
546 **CLI Flags:** **Not Supported**
547
548 ## Length Sort
549
550 Sort imports by their string length.
551
552 **Type:** Bool
553 **Default:** `False`
554 **Config default:** `false`
555 **Python & Config File Name:** length_sort
556 **CLI Flags:**
557
558 - --ls
559 - --length-sort
560
561 ## Length Sort Straight
562
563 Sort straight imports by their string length. Similar to `length_sort` but applies only to straight imports and doesn't affect from imports.
564
565 **Type:** Bool
566 **Default:** `False`
567 **Config default:** `false`
568 **Python & Config File Name:** length_sort_straight
569 **CLI Flags:**
570
571 - --lss
572 - --length-sort-straight
573
574 ## Length Sort Sections
575
576 Sort the given sections by length
577
578 **Type:** List of Strings
579 **Default:** `frozenset()`
580 **Config default:** `[]`
581 **Python & Config File Name:** length_sort_sections
582 **CLI Flags:** **Not Supported**
583
584 **Examples:**
585
586 ### Example `.isort.cfg`
587
588 ```
589 [settings]
590 length_sort_sections=future,stdlib
591
592 ```
593
594 ### Example `pyproject.toml`
595
596 ```
597 [tool.isort]
598 length_sort_sections = ["future", "stdlib"]
599
600 ```
601
602 ## Add Imports
603
604 Adds the specified import line to all files, automatically determining correct placement.
605
606 **Type:** List of Strings
607 **Default:** `frozenset()`
608 **Config default:** `[]`
609 **Python & Config File Name:** add_imports
610 **CLI Flags:**
611
612 - -a
613 - --add-import
614
615 **Examples:**
616
617 ### Example `.isort.cfg`
618
619 ```
620 [settings]
621 add_imports=import os,import json
622
623 ```
624
625 ### Example `pyproject.toml`
626
627 ```
628 [tool.isort]
629 add_imports = ["import os", "import json"]
630
631 ```
632
633 ## Remove Imports
634
635 Removes the specified import from all files.
636
637 **Type:** List of Strings
638 **Default:** `frozenset()`
639 **Config default:** `[]`
640 **Python & Config File Name:** remove_imports
641 **CLI Flags:**
642
643 - --rm
644 - --remove-import
645
646 **Examples:**
647
648 ### Example `.isort.cfg`
649
650 ```
651 [settings]
652 remove_imports=os,json
653
654 ```
655
656 ### Example `pyproject.toml`
657
658 ```
659 [tool.isort]
660 remove_imports = ["os", "json"]
661
662 ```
663
664 ## Append Only
665
666 Only adds the imports specified in --add-import if the file contains existing imports.
667
668 **Type:** Bool
669 **Default:** `False`
670 **Config default:** `false`
671 **Python & Config File Name:** append_only
672 **CLI Flags:**
673
674 - --append
675 - --append-only
676
677 ## Reverse Relative
678
679 Reverse order of relative imports.
680
681 **Type:** Bool
682 **Default:** `False`
683 **Config default:** `false`
684 **Python & Config File Name:** reverse_relative
685 **CLI Flags:**
686
687 - --rr
688 - --reverse-relative
689
690 ## Force Single Line
691
692 Forces all from imports to appear on their own line
693
694 **Type:** Bool
695 **Default:** `False`
696 **Config default:** `false`
697 **Python & Config File Name:** force_single_line
698 **CLI Flags:**
699
700 - --sl
701 - --force-single-line-imports
702
703 ## Single Line Exclusions
704
705 One or more modules to exclude from the single line rule.
706
707 **Type:** List of Strings
708 **Default:** `()`
709 **Config default:** `[]`
710 **Python & Config File Name:** single_line_exclusions
711 **CLI Flags:**
712
713 - --nsl
714 - --single-line-exclusions
715
716 **Examples:**
717
718 ### Example `.isort.cfg`
719
720 ```
721 [settings]
722 single_line_exclusions=os,json
723
724 ```
725
726 ### Example `pyproject.toml`
727
728 ```
729 [tool.isort]
730 single_line_exclusions = ["os", "json"]
731
732 ```
733
734 ## Default Section
735
736 Sets the default section for import options: ('FUTURE', 'STDLIB', 'THIRDPARTY', 'FIRSTPARTY', 'LOCALFOLDER')
737
738 **Type:** String
739 **Default:** `THIRDPARTY`
740 **Config default:** `THIRDPARTY`
741 **Python & Config File Name:** default_section
742 **CLI Flags:**
743
744 - --sd
745 - --section-default
746
747 ## Import Headings
748
749 A mapping of import sections to import heading comments that should show above them.
750
751 **Type:** Dict
752 **Default:** `{}`
753 **Config default:** `{}`
754 **Python & Config File Name:** import_headings
755 **CLI Flags:** **Not Supported**
756
757 ## Import Footers
758
759 A mapping of import sections to import footer comments that should show below them.
760
761 **Type:** Dict
762 **Default:** `{}`
763 **Config default:** `{}`
764 **Python & Config File Name:** import_footers
765 **CLI Flags:** **Not Supported**
766
767 ## Balanced Wrapping
768
769 Balances wrapping to produce the most consistent line length possible
770
771 **Type:** Bool
772 **Default:** `False`
773 **Config default:** `false`
774 **Python & Config File Name:** balanced_wrapping
775 **CLI Flags:**
776
777 - -e
778 - --balanced
779
780 ## Use Parentheses
781
782 Use parentheses for line continuation on length limit instead of backslashes. **NOTE**: This is separate from wrap modes, and only affects how individual lines that are too long get continued, not sections of multiple imports.
783
784 **Type:** Bool
785 **Default:** `False`
786 **Config default:** `false`
787 **Python & Config File Name:** use_parentheses
788 **CLI Flags:**
789
790 - --up
791 - --use-parentheses
792
793 ## Order By Type
794
795 Order imports by type, which is determined by case, in addition to alphabetically.
796
797 **NOTE**: type here refers to the implied type from the import name capitalization.
798 isort does not do type introspection for the imports. These "types" are simply: CONSTANT_VARIABLE, CamelCaseClass, variable_or_function. If your project follows PEP8 or a related coding standard and has many imports this is a good default, otherwise you likely will want to turn it off. From the CLI the `--dont-order-by-type` option will turn this off.
799
800 **Type:** Bool
801 **Default:** `True`
802 **Config default:** `true`
803 **Python & Config File Name:** order_by_type
804 **CLI Flags:**
805
806 - --ot
807 - --order-by-type
808
809 ## Atomic
810
811 Ensures the output doesn't save if the resulting file contains syntax errors.
812
813 **Type:** Bool
814 **Default:** `False`
815 **Config default:** `false`
816 **Python & Config File Name:** atomic
817 **CLI Flags:**
818
819 - --ac
820 - --atomic
821
822 ## Lines Before Imports
823
824 The number of blank lines to place before imports. -1 for automatic determination
825
826 **Type:** Int
827 **Default:** `-1`
828 **Config default:** `-1`
829 **Python & Config File Name:** lines_before_imports
830 **CLI Flags:**
831
832 - --lbi
833 - --lines-before-imports
834
835 ## Lines After Imports
836
837 The number of blank lines to place after imports. -1 for automatic determination
838
839 **Type:** Int
840 **Default:** `-1`
841 **Config default:** `-1`
842 **Python & Config File Name:** lines_after_imports
843 **CLI Flags:**
844
845 - --lai
846 - --lines-after-imports
847
848 ## Lines Between Sections
849
850 The number of lines to place between sections
851
852 **Type:** Int
853 **Default:** `1`
854 **Config default:** `1`
855 **Python & Config File Name:** lines_between_sections
856 **CLI Flags:** **Not Supported**
857
858 ## Lines Between Types
859
860 The number of lines to place between direct and from imports
861
862 **Type:** Int
863 **Default:** `0`
864 **Config default:** `0`
865 **Python & Config File Name:** lines_between_types
866 **CLI Flags:**
867
868 - --lbt
869 - --lines-between-types
870
871 ## Combine As Imports
872
873 Combines as imports on the same line.
874
875 **Type:** Bool
876 **Default:** `False`
877 **Config default:** `false`
878 **Python & Config File Name:** combine_as_imports
879 **CLI Flags:**
880
881 - --ca
882 - --combine-as
883
884 ## Combine Star
885
886 Ensures that if a star import is present, nothing else is imported from that namespace.
887
888 **Type:** Bool
889 **Default:** `False`
890 **Config default:** `false`
891 **Python & Config File Name:** combine_star
892 **CLI Flags:**
893
894 - --cs
895 - --combine-star
896
897 ## Include Trailing Comma
898
899 Includes a trailing comma on multi line imports that include parentheses.
900
901 **Type:** Bool
902 **Default:** `False`
903 **Config default:** `false`
904 **Python & Config File Name:** include_trailing_comma
905 **CLI Flags:**
906
907 - --tc
908 - --trailing-comma
909 ## Split on Trailing Comma
910
911 Split imports list followed by a trailing comma into VERTICAL_HANGING_INDENT mode. This follows Black style magic comma.
912
913 **Type:** Bool
914 **Default:** `False`
915 **Config default:** `false`
916 **Python & Config File Name:** split_on_trailing_comma
917 **CLI Flags:**
918
919 - --split-on-trailing-comma
920
921 ## From First
922
923 Switches the typical ordering preference, showing from imports first then straight ones.
924
925 **Type:** Bool
926 **Default:** `False`
927 **Config default:** `false`
928 **Python & Config File Name:** from_first
929 **CLI Flags:**
930
931 - --ff
932 - --from-first
933
934 ## Verbose
935
936 Shows verbose output, such as when files are skipped or when a check is successful.
937
938 **Type:** Bool
939 **Default:** `False`
940 **Config default:** `false`
941 **Python & Config File Name:** verbose
942 **CLI Flags:**
943
944 - -v
945 - --verbose
946
947 ## Quiet
948
949 Shows extra quiet output, only errors are outputted.
950
951 **Type:** Bool
952 **Default:** `False`
953 **Config default:** `false`
954 **Python & Config File Name:** quiet
955 **CLI Flags:**
956
957 - -q
958 - --quiet
959
960 ## Force Adds
961
962 Forces import adds even if the original file is empty.
963
964 **Type:** Bool
965 **Default:** `False`
966 **Config default:** `false`
967 **Python & Config File Name:** force_adds
968 **CLI Flags:**
969
970 - --af
971 - --force-adds
972
973 ## Force Alphabetical Sort Within Sections
974
975 Force all imports to be sorted alphabetically within a section
976
977 **Type:** Bool
978 **Default:** `False`
979 **Config default:** `false`
980 **Python & Config File Name:** force_alphabetical_sort_within_sections
981 **CLI Flags:**
982
983 - --fass
984 - --force-alphabetical-sort-within-sections
985
986 ## Force Alphabetical Sort
987
988 Force all imports to be sorted as a single section
989
990 **Type:** Bool
991 **Default:** `False`
992 **Config default:** `false`
993 **Python & Config File Name:** force_alphabetical_sort
994 **CLI Flags:**
995
996 - --fas
997 - --force-alphabetical-sort
998
999 ## Force Grid Wrap
1000
1001 Force number of from imports (defaults to 2 when passed as CLI flag without value) to be grid wrapped regardless of line length. If 0 is passed in (the global default) only line length is considered.
1002
1003 **Type:** Int
1004 **Default:** `0`
1005 **Config default:** `0`
1006 **Python & Config File Name:** force_grid_wrap
1007 **CLI Flags:**
1008
1009 - --fgw
1010 - --force-grid-wrap
1011
1012 ## Force Sort Within Sections
1013
1014 Don't sort straight-style imports (like import sys) before from-style imports (like from itertools import groupby). Instead, sort the imports by module, independent of import style.
1015
1016 **Type:** Bool
1017 **Default:** `False`
1018 **Config default:** `false`
1019 **Python & Config File Name:** force_sort_within_sections
1020 **CLI Flags:**
1021
1022 - --fss
1023 - --force-sort-within-sections
1024
1025 ## Lexicographical
1026
1027 Lexicographical order is strictly alphabetical order. For example by default isort will sort `1, 10, 2` into `1, 2, 10` - but with lexicographical sorting enabled it will remain `1, 10, 2`.
1028
1029 **Type:** Bool
1030 **Default:** `False`
1031 **Config default:** `false`
1032 **Python & Config File Name:** lexicographical
1033 **CLI Flags:** **Not Supported**
1034
1035 ## Group By Package
1036
1037 If `True` isort will automatically create section groups by the top-level package they come from.
1038
1039 **Type:** Bool
1040 **Default:** `False`
1041 **Config default:** `false`
1042 **Python & Config File Name:** group_by_package
1043 **CLI Flags:** **Not Supported**
1044
1045 ## Separate Packages
1046
1047 Separate packages within the listed sections with newlines.
1048
1049 **Type:** List of Strings
1050 **Default:** `frozenset()`
1051 **Config default:** `[]`
1052 **Python & Config File Name:** separate_packages
1053 **CLI Flags:** **Not Supported**
1054
1055 **Examples:**
1056
1057 ### Example `.isort.cfg`
1058
1059 ```
1060 [settings]
1061 separate_packages=THIRDPARTY
1062 ```
1063
1064 ### Example `pyproject.toml`
1065
1066 ```
1067 [tool.isort]
1068 separate_packages = ["THIRDPARTY"]
1069 ```
1070
1071 ### Example before:
1072 ```python
1073 import os
1074 import sys
1075
1076 from django.db.models.signals import m2m_changed
1077 from django.utils import functional
1078 from django_filters import BooleanFilter
1079 from junitparser import JUnitXml
1080 from loguru import logger
1081 ```
1082
1083 ### Example after:
1084 ```python
1085 import os
1086 import sys
1087
1088 from django.db.models.signals import m2m_changed
1089 from django.utils import functional
1090
1091 from django_filters import BooleanFilter
1092
1093 from junitparser import JUnitXml
1094
1095 from loguru import logger
1096 ```
1097
1098 ## Ignore Whitespace
1099
1100 Tells isort to ignore whitespace differences when --check-only is being used.
1101
1102 **Type:** Bool
1103 **Default:** `False`
1104 **Config default:** `false`
1105 **Python & Config File Name:** ignore_whitespace
1106 **CLI Flags:**
1107
1108 - --ws
1109 - --ignore-whitespace
1110
1111 ## No Lines Before
1112
1113 Sections which should not be split with previous by empty lines
1114
1115 **Type:** List of Strings
1116 **Default:** `frozenset()`
1117 **Config default:** `[]`
1118 **Python & Config File Name:** no_lines_before
1119 **CLI Flags:**
1120
1121 - --nlb
1122 - --no-lines-before
1123
1124 **Examples:**
1125
1126 ### Example `.isort.cfg`
1127
1128 ```
1129 [settings]
1130 no_lines_before=future,stdlib
1131
1132 ```
1133
1134 ### Example `pyproject.toml`
1135
1136 ```
1137 [tool.isort]
1138 no_lines_before = ["future", "stdlib"]
1139
1140 ```
1141
1142 ## No Inline Sort
1143
1144 Leaves `from` imports with multiple imports 'as-is' (e.g. `from foo import a, c ,b`).
1145
1146 **Type:** Bool
1147 **Default:** `False`
1148 **Config default:** `false`
1149 **Python & Config File Name:** no_inline_sort
1150 **CLI Flags:**
1151
1152 - --nis
1153 - --no-inline-sort
1154
1155 ## Ignore Comments
1156
1157 If enabled, isort will strip comments that exist within import lines.
1158
1159 **Type:** Bool
1160 **Default:** `False`
1161 **Config default:** `false`
1162 **Python & Config File Name:** ignore_comments
1163 **CLI Flags:** **Not Supported**
1164
1165 ## Case Sensitive
1166
1167 Tells isort to include casing when sorting module names
1168
1169 **Type:** Bool
1170 **Default:** `False`
1171 **Config default:** `false`
1172 **Python & Config File Name:** case_sensitive
1173 **CLI Flags:**
1174
1175 - --case-sensitive
1176
1177 ## Virtual Env
1178
1179 Virtual environment to use for determining whether a package is third-party
1180
1181 **Type:** String
1182 **Default:** ` `
1183 **Config default:** ` `
1184 **Python & Config File Name:** virtual_env
1185 **CLI Flags:**
1186
1187 - --virtual-env
1188
1189 ## Conda Env
1190
1191 Conda environment to use for determining whether a package is third-party
1192
1193 **Type:** String
1194 **Default:** ` `
1195 **Config default:** ` `
1196 **Python & Config File Name:** conda_env
1197 **CLI Flags:**
1198
1199 - --conda-env
1200
1201 ## Ensure Newline Before Comments
1202
1203 Inserts a blank line before a comment following an import.
1204
1205 **Type:** Bool
1206 **Default:** `False`
1207 **Config default:** `false`
1208 **Python & Config File Name:** ensure_newline_before_comments
1209 **CLI Flags:**
1210
1211 - -n
1212 - --ensure-newline-before-comments
1213
1214 ## Profile
1215
1216 Base profile type to use for configuration. Profiles include: black, django,
1217 pycharm, google, open\_stack, plone, attrs, hug, wemake, appnexus. As well as
1218 any [shared
1219 profiles](../howto/shared_profiles.md).
1220
1221 **Type:** String
1222 **Default:** ` `
1223 **Config default:** ` `
1224 **Python & Config File Name:** profile
1225 **CLI Flags:**
1226
1227 - --profile
1228
1229 ## Honor Noqa
1230
1231 Tells isort to honor noqa comments to enforce skipping those comments.
1232
1233 **Type:** Bool
1234 **Default:** `False`
1235 **Config default:** `false`
1236 **Python & Config File Name:** honor_noqa
1237 **CLI Flags:**
1238
1239 - --honor-noqa
1240
1241 ## Src Paths
1242
1243 Add an explicitly defined source path (modules within src paths have their imports automatically categorized as first_party). Glob expansion (`*` and `**`) is supported for this option.
1244
1245 **Type:** List of Strings
1246 **Default:** `()`
1247 **Config default:** `[]`
1248 **Python & Config File Name:** src_paths
1249 **CLI Flags:**
1250
1251 - --src
1252 - --src-path
1253
1254 **Examples:**
1255
1256 ### Example `.isort.cfg`
1257
1258 ```
1259 [settings]
1260 src_paths = src,tests
1261
1262 ```
1263
1264 ### Example `pyproject.toml`
1265
1266 ```
1267 [tool.isort]
1268 src_paths = ["src", "tests"]
1269
1270 ```
1271
1272 ## Remove Redundant Aliases
1273
1274 Tells isort to remove redundant aliases from imports, such as `import os as os`. This defaults to `False` simply because some projects use these seemingly useless aliases to signify intent and change behaviour.
1275
1276 **Type:** Bool
1277 **Default:** `False`
1278 **Config default:** `false`
1279 **Python & Config File Name:** remove_redundant_aliases
1280 **CLI Flags:**
1281
1282 - --remove-redundant-aliases
1283
1284 ## Float To Top
1285
1286 Causes all non-indented imports to float to the top of the file having its imports sorted (immediately below the top of file comment).
1287 This can be an excellent shortcut for collecting imports every once in a while when you place them in the middle of a file to avoid context switching.
1288
1289 *NOTE*: It currently doesn't work with cimports and introduces some extra over-head and a performance penalty.
1290
1291 **Type:** Bool
1292 **Default:** `False`
1293 **Config default:** `false`
1294 **Python & Config File Name:** float_to_top
1295 **CLI Flags:**
1296
1297 - --float-to-top
1298
1299 ## Filter Files
1300
1301 Tells isort to filter files even when they are explicitly passed in as part of the CLI command.
1302
1303 **Type:** Bool
1304 **Default:** `False`
1305 **Config default:** `false`
1306 **Python & Config File Name:** filter_files
1307 **CLI Flags:**
1308
1309 - --filter-files
1310
1311 ## Formatter
1312
1313 Specifies the name of a formatting plugin to use when producing output.
1314
1315 **Type:** String
1316 **Default:** ` `
1317 **Config default:** ` `
1318 **Python & Config File Name:** formatter
1319 **CLI Flags:**
1320
1321 - --formatter
1322
1323 ## Formatting Function
1324
1325 The fully qualified Python path of a function to apply to format code sorted by isort.
1326
1327 **Type:** Nonetype
1328 **Default:** `None`
1329 **Config default:** ` `
1330 **Python & Config File Name:** formatting_function
1331 **CLI Flags:** **Not Supported**
1332
1333 ## Color Output
1334
1335 Tells isort to use color in terminal output.
1336
1337 **Type:** Bool
1338 **Default:** `False`
1339 **Config default:** `false`
1340 **Python & Config File Name:** color_output
1341 **CLI Flags:**
1342
1343 - --color
1344
1345 ## Treat Comments As Code
1346
1347 Tells isort to treat the specified single line comment(s) as if they are code.
1348
1349 **Type:** List of Strings
1350 **Default:** `frozenset()`
1351 **Config default:** `[]`
1352 **Python & Config File Name:** treat_comments_as_code
1353 **CLI Flags:**
1354
1355 - --treat-comment-as-code
1356
1357 **Examples:**
1358
1359 ### Example `.isort.cfg`
1360
1361 ```
1362 [settings]
1363 treat_comments_as_code = # my comment 1, # my other comment
1364
1365 ```
1366
1367 ### Example `pyproject.toml`
1368
1369 ```
1370 [tool.isort]
1371 treat_comments_as_code = ["# my comment 1", "# my other comment"]
1372
1373 ```
1374
1375 ## Treat All Comments As Code
1376
1377 Tells isort to treat all single line comments as if they are code.
1378
1379 **Type:** Bool
1380 **Default:** `False`
1381 **Config default:** `false`
1382 **Python & Config File Name:** treat_all_comments_as_code
1383 **CLI Flags:**
1384
1385 - --treat-all-comment-as-code
1386
1387 ## Supported Extensions
1388
1389 Specifies what extensions isort can be run against.
1390
1391 **Type:** List of Strings
1392 **Default:** `('pxd', 'py', 'pyi', 'pyx')`
1393 **Config default:** `['pxd', 'py', 'pyi', 'pyx']`
1394 **Python & Config File Name:** supported_extensions
1395 **CLI Flags:**
1396
1397 - --ext
1398 - --extension
1399 - --supported-extension
1400
1401 **Examples:**
1402
1403 ### Example `.isort.cfg`
1404
1405 ```
1406 [settings]
1407 supported_extensions=pyw,ext
1408
1409 ```
1410
1411 ### Example `pyproject.toml`
1412
1413 ```
1414 [tool.isort]
1415 supported_extensions = ["pyw", "ext"]
1416
1417 ```
1418
1419 ## Blocked Extensions
1420
1421 Specifies what extensions isort can never be run against.
1422
1423 **Type:** List of Strings
1424 **Default:** `('pex',)`
1425 **Config default:** `['pex']`
1426 **Python & Config File Name:** blocked_extensions
1427 **CLI Flags:**
1428
1429 - --blocked-extension
1430
1431 **Examples:**
1432
1433 ### Example `.isort.cfg`
1434
1435 ```
1436 [settings]
1437 blocked_extensions=pyw,pyc
1438
1439 ```
1440
1441 ### Example `pyproject.toml`
1442
1443 ```
1444 [tool.isort]
1445 blocked_extensions = ["pyw", "pyc"]
1446
1447 ```
1448
1449 ## Constants
1450
1451 An override list of tokens to always recognize as a CONSTANT for order_by_type regardless of casing.
1452
1453 **Type:** List of Strings
1454 **Default:** `frozenset()`
1455 **Config default:** `[]`
1456 **Python & Config File Name:** constants
1457 **CLI Flags:** **Not Supported**
1458
1459 ## Classes
1460
1461 An override list of tokens to always recognize as a Class for order_by_type regardless of casing.
1462
1463 **Type:** List of Strings
1464 **Default:** `frozenset()`
1465 **Config default:** `[]`
1466 **Python & Config File Name:** classes
1467 **CLI Flags:** **Not Supported**
1468
1469 ## Variables
1470
1471 An override list of tokens to always recognize as a var for order_by_type regardless of casing.
1472
1473 **Type:** List of Strings
1474 **Default:** `frozenset()`
1475 **Config default:** `[]`
1476 **Python & Config File Name:** variables
1477 **CLI Flags:** **Not Supported**
1478
1479 ## Dedup Headings
1480
1481 Tells isort to only show an identical custom import heading comment once, even if there are multiple sections with the comment set.
1482
1483 **Type:** Bool
1484 **Default:** `False`
1485 **Config default:** `false`
1486 **Python & Config File Name:** dedup_headings
1487 **CLI Flags:**
1488
1489 - --dedup-headings
1490
1491 ## Only Sections
1492
1493 Causes imports to be sorted based on their sections like STDLIB, THIRDPARTY, etc. Within sections, the imports are ordered by their import style and the imports with the same style maintain their relative positions.
1494
1495 **Type:** Bool
1496 **Default:** `False`
1497 **Config default:** `false`
1498 **Python & Config File Name:** only_sections
1499 **CLI Flags:**
1500
1501 - --only-sections
1502 - --os
1503
1504 ## Only Modified
1505
1506 Suppresses verbose output for non-modified files.
1507
1508 **Type:** Bool
1509 **Default:** `False`
1510 **Config default:** `false`
1511 **Python & Config File Name:** only_modified
1512 **CLI Flags:**
1513
1514 - --only-modified
1515 - --om
1516
1517 ## Combine Straight Imports
1518
1519 Combines all the bare straight imports of the same section in a single line. Won't work with sections which have 'as' imports
1520
1521 **Type:** Bool
1522 **Default:** `False`
1523 **Config default:** `false`
1524 **Python & Config File Name:** combine_straight_imports
1525 **CLI Flags:**
1526
1527 - --combine-straight-imports
1528 - --csi
1529
1530 ## Auto Identify Namespace Packages
1531
1532 Automatically determine local namespace packages, generally by lack of any src files before a src containing directory.
1533
1534 **Type:** Bool
1535 **Default:** `True`
1536 **Config default:** `true`
1537 **Python & Config File Name:** auto_identify_namespace_packages
1538 **CLI Flags:** **Not Supported**
1539
1540 ## Namespace Packages
1541
1542 Manually specify one or more namespace packages.
1543
1544 **Type:** List of Strings
1545 **Default:** `frozenset()`
1546 **Config default:** `[]`
1547 **Python & Config File Name:** namespace_packages
1548 **CLI Flags:** **Not Supported**
1549
1550 ## Follow Links
1551
1552 If `True` isort will follow symbolic links when doing recursive sorting.
1553
1554 **Type:** Bool
1555 **Default:** `True`
1556 **Config default:** `true`
1557 **Python & Config File Name:** follow_links
1558 **CLI Flags:** **Not Supported**
1559
1560 ## Indented Import Headings
1561
1562 If `True` isort will apply import headings to indented imports the same way it does unindented ones.
1563
1564 **Type:** Bool
1565 **Default:** `True`
1566 **Config default:** `true`
1567 **Python & Config File Name:** indented_import_headings
1568 **CLI Flags:** **Not Supported**
1569
1570 ## Honor Case In Force Sorted Sections
1571
1572 Honor `--case-sensitive` when `--force-sort-within-sections` is being used. Without this option set, `--order-by-type` decides module name ordering too.
1573
1574 **Type:** Bool
1575 **Default:** `False`
1576 **Config default:** `false`
1577 **Python & Config File Name:** honor_case_in_force_sorted_sections
1578 **CLI Flags:**
1579
1580 - --hcss
1581 - --honor-case-in-force-sorted-sections
1582
1583 ## Sort Relative In Force Sorted Sections
1584
1585 When using `--force-sort-within-sections`, sort relative imports the same way as they are sorted when not using that setting.
1586
1587 **Type:** Bool
1588 **Default:** `False`
1589 **Config default:** `false`
1590 **Python & Config File Name:** sort_relative_in_force_sorted_sections
1591 **CLI Flags:**
1592
1593 - --srss
1594 - --sort-relative-in-force-sorted-sections
1595
1596 ## Overwrite In Place
1597
1598 Tells isort to overwrite in place using the same file handle. Comes at a performance and memory usage penalty over its standard approach but ensures all file flags and modes stay unchanged.
1599
1600 **Type:** Bool
1601 **Default:** `False`
1602 **Config default:** `false`
1603 **Python & Config File Name:** overwrite_in_place
1604 **CLI Flags:**
1605
1606 - --overwrite-in-place
1607
1608 ## Reverse Sort
1609
1610 Reverses the ordering of imports.
1611
1612 **Type:** Bool
1613 **Default:** `False`
1614 **Config default:** `false`
1615 **Python & Config File Name:** reverse_sort
1616 **CLI Flags:**
1617
1618 - --reverse-sort
1619
1620 ## Star First
1621
1622 Forces star imports above others to avoid overriding directly imported variables.
1623
1624 **Type:** Bool
1625 **Default:** `False`
1626 **Config default:** `false`
1627 **Python & Config File Name:** star_first
1628 **CLI Flags:**
1629
1630 - --star-first
1631
1632 ## Format Error
1633
1634 Override the format used to print errors.
1635
1636 **Type:** String
1637 **Default:** `{error}: {message}`
1638 **Config default:** `{error}: {message}`
1639 **Python & Config File Name:** format_error
1640 **CLI Flags:**
1641
1642 - --format-error
1643
1644 ## Format Success
1645
1646 Override the format used to print success.
1647
1648 **Type:** String
1649 **Default:** `{success}: {message}`
1650 **Config default:** `{success}: {message}`
1651 **Python & Config File Name:** format_success
1652 **CLI Flags:**
1653
1654 - --format-success
1655
1656 ## Sort Order
1657
1658 Specify sorting function. Can be built in (natural[default] = force numbers to be sequential, native = Python's built-in sorted function) or an installable plugin.
1659
1660 **Type:** String
1661 **Default:** `natural`
1662 **Config default:** `natural`
1663 **Python & Config File Name:** sort_order
1664 **CLI Flags:**
1665
1666 - --sort-order
1667
1668 ## Show Version
1669
1670 Displays the currently installed version of isort.
1671
1672 **Type:** Bool
1673 **Default:** `False`
1674 **Config default:** `false`
1675 **Python & Config File Name:** **Not Supported**
1676 **CLI Flags:**
1677
1678 - -V
1679 - --version
1680
1681 **Examples:**
1682
1683 ### Example cli usage
1684
1685 `isort --version`
1686
1687 ## Version Number
1688
1689 Returns just the current version number without the logo
1690
1691 **Type:** String
1692 **Default:** `==SUPPRESS==`
1693 **Config default:** `==SUPPRESS==`
1694 **Python & Config File Name:** **Not Supported**
1695 **CLI Flags:**
1696
1697 - --vn
1698 - --version-number
1699
1700 ## Write To Stdout
1701
1702 Force resulting output to stdout, instead of in-place.
1703
1704 **Type:** Bool
1705 **Default:** `False`
1706 **Config default:** `false`
1707 **Python & Config File Name:** **Not Supported**
1708 **CLI Flags:**
1709
1710 - -d
1711 - --stdout
1712
1713 ## Show Config
1714
1715 See isort's determined config, as well as sources of config options.
1716
1717 **Type:** Bool
1718 **Default:** `False`
1719 **Config default:** `false`
1720 **Python & Config File Name:** **Not Supported**
1721 **CLI Flags:**
1722
1723 - --show-config
1724
1725 ## Show Files
1726
1727 See the files isort will be run against with the current config options.
1728
1729 **Type:** Bool
1730 **Default:** `False`
1731 **Config default:** `false`
1732 **Python & Config File Name:** **Not Supported**
1733 **CLI Flags:**
1734
1735 - --show-files
1736
1737 ## Show Diff
1738
1739 Prints a diff of all the changes isort would make to a file, instead of changing it in place
1740
1741 **Type:** Bool
1742 **Default:** `False`
1743 **Config default:** `false`
1744 **Python & Config File Name:** **Not Supported**
1745 **CLI Flags:**
1746
1747 - --df
1748 - --diff
1749
1750 ## Check
1751
1752 Checks the file for unsorted / unformatted imports and prints them to the command line without modifying the file. Returns 0 when nothing would change and returns 1 when the file would be reformatted.
1753
1754 **Type:** Bool
1755 **Default:** `False`
1756 **Config default:** `false`
1757 **Python & Config File Name:** **Not Supported**
1758 **CLI Flags:**
1759
1760 - -c
1761 - --check-only
1762 - --check
1763
1764 ## Settings Path
1765
1766 Explicitly set the settings path or file instead of auto determining based on file location.
1767
1768 **Type:** String
1769 **Default:** `None`
1770 **Config default:** ` `
1771 **Python & Config File Name:** **Not Supported**
1772 **CLI Flags:**
1773
1774 - --sp
1775 - --settings-path
1776 - --settings-file
1777 - --settings
1778
1779 ## Config Root
1780
1781 Explicitly set the config root for resolving all configs. When used with the --resolve-all-configs flag, isort will look at all sub-folders in this config root to resolve config files and sort files based on the closest available config(if any)
1782
1783 **Type:** String
1784 **Default:** `None`
1785 **Config default:** ` `
1786 **Python & Config File Name:** **Not Supported**
1787 **CLI Flags:**
1788
1789 - --cr
1790 - --config-root
1791
1792 ## Resolve All Configs
1793
1794 Tells isort to resolve the configs for all sub-directories and sort files in terms of its closest config files.
1795
1796 **Type:** Bool
1797 **Default:** `False`
1798 **Config default:** `false`
1799 **Python & Config File Name:** **Not Supported**
1800 **CLI Flags:**
1801
1802 - --resolve-all-configs
1803
1804 ## Jobs
1805
1806 Number of files to process in parallel. Negative value means use number of CPUs.
1807
1808 **Type:** Int
1809 **Default:** `None`
1810 **Config default:** ` `
1811 **Python & Config File Name:** **Not Supported**
1812 **CLI Flags:**
1813
1814 - -j
1815 - --jobs
1816
1817 ## Ask To Apply
1818
1819 Tells isort to apply changes interactively.
1820
1821 **Type:** Bool
1822 **Default:** `False`
1823 **Config default:** `false`
1824 **Python & Config File Name:** **Not Supported**
1825 **CLI Flags:**
1826
1827 - --interactive
1828
1829 ## Files
1830
1831 One or more Python source files that need their imports sorted.
1832
1833 **Type:** String
1834 **Default:** `None`
1835 **Config default:** ` `
1836 **Python & Config File Name:** **Not Supported**
1837 **CLI Flags:**
1838
1839 -
1840
1841 ## Dont Follow Links
1842
1843 Tells isort not to follow symlinks that are encountered when running recursively.
1844
1845 **Type:** Bool
1846 **Default:** `False`
1847 **Config default:** `false`
1848 **Python & Config File Name:** **Not Supported**
1849 **CLI Flags:**
1850
1851 - --dont-follow-links
1852
1853 ## Filename
1854
1855 Provide the filename associated with a stream.
1856
1857 **Type:** String
1858 **Default:** `None`
1859 **Config default:** ` `
1860 **Python & Config File Name:** **Not Supported**
1861 **CLI Flags:**
1862
1863 - --filename
1864
1865 ## Allow Root
1866
1867 Tells isort not to treat / specially, allowing it to be run against the root dir.
1868
1869 **Type:** Bool
1870 **Default:** `False`
1871 **Config default:** `false`
1872 **Python & Config File Name:** **Not Supported**
1873 **CLI Flags:**
1874
1875 - --allow-root
1876
1877 ## Dont Float To Top
1878
1879 Forces --float-to-top setting off. See --float-to-top for more information.
1880
1881 **Type:** Bool
1882 **Default:** `False`
1883 **Config default:** `false`
1884 **Python & Config File Name:** **Not Supported**
1885 **CLI Flags:**
1886
1887 - --dont-float-to-top
1888
1889 ## Dont Order By Type
1890
1891 Don't order imports by type, which is determined by case, in addition to alphabetically.
1892
1893 **NOTE**: type here refers to the implied type from the import name capitalization.
1894 isort does not do type introspection for the imports. These "types" are simply: CONSTANT_VARIABLE, CamelCaseClass, variable_or_function. If your project follows PEP8 or a related coding standard and has many imports this is a good default. You can turn this on from the CLI using `--order-by-type`.
1895
1896 **Type:** Bool
1897 **Default:** `False`
1898 **Config default:** `false`
1899 **Python & Config File Name:** **Not Supported**
1900 **CLI Flags:**
1901
1902 - --dt
1903 - --dont-order-by-type
1904
1905 ## Ext Format
1906
1907 Tells isort to format the given files according to an extensions formatting rules.
1908
1909 **Type:** String
1910 **Default:** `None`
1911 **Config default:** ` `
1912 **Python & Config File Name:** **Not Supported**
1913 **CLI Flags:**
1914
1915 - --ext-format
1916
1917 ## Deprecated Flags
1918
1919 ==SUPPRESS==
1920
1921 **Type:** String
1922 **Default:** `None`
1923 **Config default:** ` `
1924 **Python & Config File Name:** **Not Supported**
1925 **CLI Flags:**
1926
1927 - -k
1928 - --keep-direct-and-as