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