isort is an open source and free software project written in Python and designed to act as a plugin for the Kate and Pate text editors, helping Python developers to sort imports alphabetically. The utility can also separate Python imports into sections automatically.
The plugin comprises of a command-line utility, a Python library and a bunch of plugins for various text editors, allowing you to effortlessly and quickly sort all your Python imports. At the moment, isort supports Python 2.6 through 3.4 and uses the pies tool to sort imports in style without outputting ugly code.
I want to see it in action!
The following lines of code will show you how your Python imports are “sorted” when not using the isort plugin:from my_lib import Object
print("Hey")
import os
from my_lib import Object3
from my_lib import Object2
import sys
from third_party import lib15, lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8, lib9, lib10, lib11, lib12, lib13, lib14
import sys
from __future__ import absolute_import
from third_party import lib3
print("yo")
And now, we will show you how the above example can look when using the isort plugin, either on the Kate and Pate text editors, or standalone from the command-line:
from __future__ import absolute_import
import os
import sys
from third_party import (lib1, lib2, lib3, lib4, lib5, lib6, lib7, lib8,
lib9, lib10, lib11, lib12, lib13, lib14, lib15)
from my_lib import Object, Object2, Object3
print("Hey")
print("yo")
Under the hood and availability
The isort plugin is written entirely in the Python programming language. It is compatible with the Kate (KDE 4.13 or later) and Pate 2.0 or higher text editors, and it’s available for download as a universal source archive that must be configured and compiled prior to installation. isort has been successfully tested on 32-bit and 64-bit instruction set architectures.What is new in this release:
- This version adds support for Emacs and ensures inline comments placed on import lines follow the pep8 style guidelines.
What is new in version 3.6.0:
- This version adds support for nested comments within import definitions and fixes an issue with setting configuration options to False.
What is new in version 3.4.1:
- Support for ordering by the type of data being imported has been added.
What is new in version 3.3.0:
- This version adds support for setup.cfg-based configuration and skipping entire directories.
What is new in version 3.2.0:
- This version adds support for running recursively, dynamic settings lookup, enabling kate-plugin to correctly determine settings when sorting (independent of where it's started), and support for Windows.
What is new in version 3.1.2:
- Fixed a crash when parsing from a path with Unicode characters in Python 2
What is new in version 3.1.1:
- This version fixes placement of additional imports when no imports existed previously within the file.
What is new in version 3.1.0:
- This version adds support for intelligently-balanced multi-line wrapping and fixes an issue which caused section comments to show up more than once.
What is new in version 3.0.0:
- Adds support for editorconfig (http://editorconfig.org/)
- Adds support for consistent syntax when adding or removing imports
- Improves handling of files that a user doesn't have permission to read
- Adds the ability to separate import sections with custom comments
Requirements:
- KDE Plasma
- PyQt
Comments not found