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

Auto​PEP8

by wistful ALL

Automatically formats Python code to conform to the PEP 8 style guide using autopep8 and pep8 modules

Details

  • 2.3.0
    1.3.6
  • github.​com
  • github.​com
  • 4 years ago
  • 2 hours ago
  • 12 years ago

Installs

  • Total 161K
  • Win 82K
  • Mac 39K
  • Linux 39K
Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12
Windows 0 6 9 8 16 9 5 5 5 5 11 5 11 6 4 3 6 6 10 8 3 1 4 3 11 2 5 11 4 6 12 5 7 5 6 4 12 11 11 4 3 5 4 4 6 8
Mac 0 3 3 0 5 4 1 4 2 3 2 1 6 5 0 4 5 4 2 3 1 0 7 3 3 2 3 1 1 1 2 3 3 1 3 2 2 1 5 3 2 2 4 2 4 1
Linux 0 2 2 1 6 1 0 0 2 2 1 3 3 3 3 4 2 2 3 3 0 1 2 1 4 3 6 0 2 3 5 2 4 4 3 3 6 5 6 3 5 1 3 3 5 6

Readme

Source
raw.​githubusercontent.​com

Sublime Auto PEP8 Formatting

Note: project is no longer supported.

About

Automatically formats Python code to conform to the PEP 8 style guide using autopep8 library.

Supports ST3 only.

Note: The walrus(if thing := foo.bar.baz: pass) operator is not supported. Auto-formatting is running by SublimeText python interpreter, which is locked to version 3.3, and walrus operator is supporter starting python3.8.

Features

  • format / preview code according PEP8
  • format / preview selected text
  • format / preview all python modules in folder
  • side bar menu
  • format code while saving

Installing

The easiest way to install AutoPEP8 in through Package Control, which can be found at this site: http://wbond.net/sublime_packages/package_control.

Once you install Package Control, restart ST3 and bring up the Command Palette (Command+Shift+P on OS X, Control+Shift+P on Linux/Windows). Select “Package Control: Install Package”, wait while Package Control fetches the latest package list, then select AutoPEP8 when the list appears.

Pep8(pycodestyle) configuration

The extenstion supports both --global-config and --ignore-local-config options from the autopep8.

Settings

{

    "max-line-length": 79,

    // Do not fix these errors / warnings(e.g. E4, W)
    "ignore": "",

    // Select errors / warnings(e.g. E4, W)
    "select": "",

    // Number of spaces per indent level
    "indent-size": 4,

    // Don't look for and apply local config files;
    // if false, defaults are updated with any config files in the project's root directory.
    "ignore-local-config": false,

    // Path to a global pep8 config file;
    // if this file doesnot exist then this is ignored.
    "global-config": "",

    // Hang closing bracket instead of matching indentation of opening bracket's line.
    "hang-closing": false,

    // Specifies whether or not format files once they saved.
    "format_on_save": false,

    // If true - open new output panel with format/preview results.
    "show_output_panel": true,

    // Format/Preview menu items only appear for views
    // with syntax from `syntax_list`
    // value is base filename of the .tmLanguage syntax files
    "syntax_list": ["Python"],

    // The value shows how deep the plugin should look for *.py files
    // before disabling "Preview" and "Format" items in the Side Bar "AutoPep8" Context Menu.
    "file_menu_search_depth": 3, // max depth to search python files

    // If value is false(default)
    // then formatter doesn't treat absence of bottom empty line as an error
    // and doesn't try to fix it.
    "avoid_new_line_in_select_mode": false,

    // For debug purporse only.
    "debug": false,
    "logfile": "/tmp/sublimeautopep8.log"  // File to store debug messages.
}

Using

  • SideBar - right click on the file(s) or folder(s)
  • Active view - right click on the view
  • Selected text - right click on the selected text
  • On Save - provide by settings: option format_on_save
  • Command Palette - bring up the Command Palette and select PEP8: Format Code or PEP8: Preview Changes
  • Hotkeys - Command/Control + Shift + 8 to format code, Command/Control + 8 to preview changes