ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Python Imports Sorter

by vi4m ST2/ST3

Sublime Text 2 plugin to organize your imports easily.

Details

  • 2016.07.31.13.10.31
  • github.​com
  • github.​com
  • 3 years ago
  • 56 minutes ago
  • 7 years ago

Installs

  • Total 10K
  • Win 3K
  • OS X 3K
  • Linux 3K
Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4 Sep 3 Sep 2 Sep 1 Aug 31 Aug 30 Aug 29 Aug 28 Aug 27 Aug 26 Aug 25 Aug 24 Aug 23 Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3
Windows 0 0 0 4 1 1 2 5 0 0 1 2 1 0 0 2 0 2 2 1 2 2 2 2 0 1 2 0 1 1 0 1 1 2 2 1 2 2 2 0 3 3 0 2 2
OS X 1 0 0 0 0 0 0 1 1 1 1 0 2 1 1 0 1 1 0 1 0 2 1 0 0 2 0 5 2 1 0 0 4 0 0 0 1 0 2 1 0 2 3 1 0
Linux 1 1 1 0 1 0 0 0 1 2 2 0 2 0 0 1 0 0 2 1 0 1 0 0 0 0 2 1 0 0 1 0 1 0 0 1 0 0 0 0 1 2 0 1 0

Readme

Source
raw.​githubusercontent.​com

python_imports_sorter

Sublime Text 2/3 plugin for organizing imports in your Python source code. Rules are described by Guido here: http://www.python.org/dev/peps/pep-0008/#imports

Example

Input

import sys
  import project.module1
  import os
  import django.contrib
  import django.admin

When selecting and pressing Cmd + Shift + I it will format this like this:

Output

import os
  import sys

  import django.admin
  import django.contrib

  import project.module1

Spliting arguments

You can split long-line python keyword arguments into the new lines using additional command: split arguments. This feature is available only for ST3+

Example:

dict(very_long_variable_name=1, even_longer_variable_name=2, additional_param=3)

to the form of : “

dict( very_long_variable_name=1, even_longer_variable_name=2, additional_param=3 )

Just use command pallete pressing `Super+Shift+P` and chose `split arguments` 
action

Installation
============

Use Sublime Text 2 Package manager. Look for python_imports_sorter