Changelogs » Isort



**Breaking changes:**
- isort now requires Python 3.5+ to run but continues to support formatting
Python 2 code.
- isort deprecates official support for Python 3.4, removing modules only in this release from known_standard_library:
- user
- isort now utilizes mypy and typing to filter out typing related issues before deployment

- profile support for common project types (black, django, google, etc)


- Fixed issue 957 - Long aliases and use_parentheses generates invalid syntax


- Fixed issue 948 - Pipe redirection broken on Python2.7


- Fixed issue 942 - correctly handle pyi (Python Template Files) to match `black` output


- Fixed an issue with parsing files that contain unicode characters in Python 2
- Fixed issue 924 - Pulling in pip internals causes depreciation warning
- Fixed issue 938 - Providing a way to filter explicitly passed in files via configuration settings (`--filter-files`)
- Improved interoperability with toml configuration files


- Fixed issue 905 & 919: Import section headers behaving strangely


- Fixed issue 909 - skip and skip-glob are not enforced when using settings-path.
- Fixed issue 907 - appdirs optional requirement does not correctly specify version
- Fixed issue 902 - Too broad warning about missing toml package
- Fixed issue 778 - remove `user` from known standard library as it's no longer in any supported Python version.


- Fixed a regression with handling streaming input from pipes (Issue 895)
- Fixed handling of \x0c whitespace character (Issue 811)
- Improved CLI documentation


- Fixed a regression with */directory/*.py style patterns


- Fixed the inability to accurately determine import section when a mix of conda and virtual environments are used.
- Fixed some output being printed even when --quiet mode is enabled.
- Fixed issue 890 interoperability with PyCharm by allowing case sensitive non type grouped sorting.
- Fixed issue 889 under some circumstances isort will incorrectly add a new line at the beginning of a file.
- Fixed issue 885 many files not being skipped according to set skip settings.
- Fixed issue 842 streaming encoding improvements.


- Fix error caused when virtual environment not detected


- Fixed issue 876: confused by symlinks pointing to virtualenv gives FIRSTPARTY not THIRDPARTY
- Fixed issue 873: current version skips every file on travis
- Additional caching to reduce performance regression introduced in 4.3.5


- Fixed Windows incompatibilities (Issue 835)
- Fixed relative import sorting bug (Issue 417)
- Fixed "no_lines_before" to also be respected from previous empty sections.
- Fixed slow-down introduced by finders mechanism by adding a LRU cache (issue 848)
- Fixed issue 842 default encoding not-set in Python2
- Restored Windows automated testing
- Added Mac automated testing


- Fixed a bug that led to an incompatibility with black: 831


- Fixed a bug that led to the recursive option not always been available from the command line.


- Expands the finder failsafe to occur on the creation of the finder objects.


- Fixes a fatal error that occurs if a single finder throws an exception. Important as we add more finders that utilize third party libraries.

4.3.5 - February 24, 2019 - last Python 2.7 Maintenance Release

This is the final Python 2.x release of isort, and includes the following major changes:

Potentially Interface Breaking:
- The `-r` option for removing imports has been renamed `-rm` to avoid accidental deletions and confusion with the `-rc` recursive option.
- `` has been removed from the default ignore list. The default ignore list is now empty - with all items needing to be explicitly ignored.
- Isort will now by default ignore .tox / venv folders in an effort to be "safe". You can disable this behaviour by setting the "--unsafe" flag, this is separate from any skip or not skip rules you may have in place.
- Isort now allows for files missing closing newlines in whitespace check
- `distutils` support has been removed to simplify

- Official Python 3.7 Compatibility.
- Support for using requirements files to auto determine third-paty section if pipreqs & requirementslib are installed.
- Added support for using pyproject.toml if toml is installed.
- Added support for XDG_HOME if appdirs is installed.
- An option has been added to enable ignoring trailing comments ('ignore_comments') defaulting to False.
- Added support to enable line length sorting for only specific sections
- Added a `correctly_sorted` property on the SortsImport to enable more intuitive programmatic checking.

- Improved black compatibility.
- Isort will now detect files in the CWD as first-party.
- Fixed several cases where '-ns' or 'not_skip' was being incorrectly ignored.
- Fixed sorting of relative path imports ('.', '..', '...', etc).
- Fixed bugs caused by a failure to maintain order when loading iterables from config files.
- Correctly handle CPython compiled imports and others that need EXT_SUFFIX to correctly identify.
- Fixed handling of Symbolic Links to follow them when walking the path.
- Fixed handling of relative known_paths.
- Fixed lack of access to all wrap modes from the CLI.
- Fixed handling of FIFO files.
- Fixed a bug that could result in multiple imports being inserted on the same line.


- Fixed issue 671: isort is corrupting CRLF files


- Fixed issue 665: Tabs turned into single spaces


- Fixed issue 651: Add imports option is broken
- Fixed issue 662: An error generated by rewriting `.imports` to `. imoprts`


- Fixed errors
- Fixed issue 654: Trailing comma count error
- Fixed issue 650: Wrong error message displayed


- Fixed 557: `force_alphabetical_sort` and `force_sort_within_sections` can now be utilized together without extra new lines
- Fix case-sensitive path existence check in Mac OS X
- Added `--no-lines-before` for more granular control over section output
- Fixed 493: Unwanted conversion to Windows line endings
- Fixed 590: Import `as` mucks with alphabetical sorting
- Implemented `--version-number` to retrieve just the version number without the isort logo
- Breaking changes
- Python 2.7+ only (dropped 2.6) allowing various code simplifications and improvements.


IMPORTANT NOTE: This will be the last release with Python 2.6 support, subsequent releases will be 2.7+ only
- Fixed certain one line imports not being successfully wrapped


- Fixed 559 & 565: Added missing standard library imports


- Fixed 553: Check only and --diff now work together again


- Fixed wheel distribution bug


- Fixed 546: Can't select y/n/c after latest update
- Fixed 545: Incorrectly moves __future__ imports above encoding comments


- Fixed 428: Check only modifies sorting
- Fixed 540: Not correctly identifying stdlib modules


- Added `--virtual-env` switch command line option
- Added --enforce-whitespace option to go along with --check-only for more exact checks (issue 423)
- Fixed imports with a tailing '\' and no space in-between getting removed (issue 425)
- Fixed issue 299: long lines occasionally not wrapped
- Fixed issue 432: No longer add import inside class when class starts at top of file after encoding comment
- Fixed issue 440: Added missing `--use-parentheses` option to command line tool and documentation
- Fixed issue 496: import* imports now get successfully identified and reformatted instead of deleted
- Fixed issue 491: Non ending parentheses withing single line comments no longer cause formatting issues
- Fixed issue 471: Imports that wrap the maximum line length and contain comments on the last line are no longer rendered incorrectly
- Fixed issue 436: Force sort within section no longer rearranges comments
- Fixed issue 473: Force_to_top and force_sort_within_sections now work together
- Fixed issue 484 & 472: Consistent output with imports of same spelling but different case
- Fixed issue 433: No longer incorrectly add an extra new-line when comment between imports and function definition
- Fixed issue 419: Path specification for skipped paths is not Unix/Windows inter-operable.
Breaking Changes:
- Fixed issue 511: All command line options with an underscore, have had the underscore replaced with a dash for consistency. This effects: multi-line, add-import, remove-import, force-adds, --force-single-line-imports, and length-sort.
- Replaced the `--enforce-whitespace` option with `--ignore-whitespace` to restore original behavior of strict whitespace by default


- Fixed an issue that caused modules to inccorectly be matched as thirdparty when they simply had `src` in the leading path, even if they weren't withing $VIRTUALENV/src 414


- Fixed an issue that caused module that contained functions before doc strings, to incorrectly place imports
- Fixed regression in how `force_alphabetical_sort` was being interpretted (issue 409)
- Fixed stray print statement printing skipped files (issue 411)
- Added option for forcing imports into a single bucket: `no_sections`
- Added option for new lines between import types (from, straight): `lines_between_sections`


- Fixed a large number of priority bugs - bug fix only release


- Give an error message when isort is unable to determine where to place a module
- Allow imports to be sorted by module, independent of import_type, when `force_sort_within_sections` option is set
- Fixed an issue that caused Python files with 2 top comments not to be sorted


- Hot fix release to fix code error when skipping globs


- Added option "NOQA" Do not wrap lines, but add a noqa statement at the end
- Added support for running isort recursively, simply with a standalone `isort` command
- Added support to run isort library as a module
- Added compatibility for Python 3.5
- Fixed performance issue (338) when running on project with lots of skipped directories
- Fixed issue 328: extra new can occasionally occur when using alphabetical-only sort
- Fixed custom sections parsing from config file (unicode string -> list)
- Updated pylama extension to the correct entry point
- Skip files even when file_contents is provided if they are explicitly in skip list
- Removed always showing isort banner, keeping it for when the version is requested, verbose is used, or show_logo setting is set.


- Fixed issue 323: Accidental default configuration change introduced


- Added support for partial file match skips (thanks to Amwam)
- Added support for --quiet option to only show errors when running isort
- Fixed issue 316: isort added new lines incorrectly when a top-of line comment is present


- Started keeping a log of all changes between releases
- Added the isort logo to the command line interface
- Added example usage gif to README
- Implemented issue 292: skip setting now supports glob patterns
- Implemented issue 271: Add option to sort imports purely alphabetically
- Implemented issue 301: Readme is now natively in RST format, making it easier for Python tooling to pick up
- Implemented pylama isort extension
- Fixed issue 260:  encoding lines at the top of the file are now correctly supported
- Fixed issue 284: Sticky comments above first import are now supported
- Fixed issue 310: Ensure comments don't get duplicated when reformatting imports
- Fixed issue 289: Sections order not being respected
- Fixed issue 296: Made it more clear how to set arguments more then once


- Removed all external dependencies