Python Import Magic
This Sublime Text 2 plugin attempts to automatically manage Python imports.
Details
Installs
- Total 2K
- Win 749
- Mac 559
- Linux 455
Oct 31 | Oct 30 | Oct 29 | Oct 28 | Oct 27 | Oct 26 | Oct 25 | Oct 24 | Oct 23 | Oct 22 | Oct 21 | Oct 20 | Oct 19 | Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Sublime Text 3 - Python Import Magic
This plugin attempts to automatically manage Python imports.
WARNING: This is a relatively complex plugin and thus may contain bugs. It may remove imports that you need. It may add imports that you don't. Use at your own risk.
It can:
- Detect and add imports for unknown symbols.
- Remove unused imports.
- Order imports according to PEP8.
It currently does NOT (but support is planned):
- Detect changes to files and update its index automatically. The current workaround is to use the command palette
Python Import Magic: Reset Index
.
Example
Usage
There are three ways of invoking the auto-importer:
- The hotkey:
⌘⇧I
on OSX and^⇧I
on Windows and Linux. - Via the command palette:
Python Import Magic: Update Imports
. - Setting
update_imports_on_save
totrue
in the user settings for the package. I would not encourage use of this setting at this stage, but if you're feeling particularly brave…
Configuration
eg.
{
"update_imports_on_save": true,
"python_path": {
"/Library/Python/2.7/site-packages": "S",
"/Users/alec/Projects/SublimePythonImportMagic/.venv/lib/python2.7/site-packages": "L"
}
}
update_imports_on_save = false
If true, update imports on each save. WARNING: This might not be a good idea.
index_filename = ".importmagic.idx"
Name of file to store index in.
python_path = {<path>: <classification>}
NOTE: Not implemented yet
Keys are the paths to search for Python modules. Values are how the path should be classified.
Paths will also be looked up in the default Sublime configuration under the key python_import_magic_python_path
.
<classification>
is from the following table:
Key | Classification |
---|---|
3 | Third party |
S | System |
L | Local |