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

Doc​Blockr_Python

by adambullmer ST3

Sublime Text DocBlockr for python. Simplifies writing docstring comments in Python.

Details

Installs

  • Total 19K
  • Win 12K
  • OS X 4K
  • Linux 4K
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 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
Windows 31 30 24 25 25 14 22 22 12 22 34 9 11 8 22 18 14 20 27 23 30 29 32 26 18 22 16 23 28 32 21 37 27 26 30 41 30 23 20 12 16 29 26 26 22 23
OS X 13 3 7 9 4 4 2 7 6 2 8 5 3 10 9 5 6 10 5 9 8 5 9 7 6 8 3 1 10 7 10 9 10 7 12 18 8 6 8 3 6 6 10 11 8 3
Linux 6 5 6 3 6 7 2 8 1 9 4 6 6 10 7 1 5 4 7 2 10 8 6 11 16 7 7 5 9 11 19 2 9 9 14 14 6 6 3 5 5 7 9 7 4 7

Readme

Source
raw.​githubusercontent.​com

DocBlockr for Python

Based off the DocBlockr project, This extension provides the similar funtionality but for python docstrings. The default formatter for this plugin is designed around PEP-257 compliance but with more verbosity: Added variable types, listing class extensions, and listing decorators. The main goal of this project is to help developer provide better documentation by giving easy and consistent formatting.

Installation

Package Control Now you can install it with package control!

  1. Open your command pallete and type Package Control: Install Package.
  2. Find this project DocBlockr Python and press Enter.

Manually Download the release and put it in your installed packages directory yourself

  1. Go to the Latest Release and download the docblockr_python.sublime-package file.
  2. Move this file to your Installed Packages directory. (Preferences > Browse Packages... and go up one directory to see Installed Packages)
  3. If you are updating your existing install, a restart of Sublime Text will be in order.

Usage

There isn't a command pallete command to start this plugin, it is triggerg by hitting enter or tab after opening a docstring (""") at the module, class, or function level. If you wanted to simply put a new line after opening a docstring and not trigger the formatter, just hold ctrl and press enter.

Default and User Settings

You can configure which docstring format to use by updating your user settings for this package. (Preferences > Package Settings > DocBlockr Python > Settings (User)) For a full list of settings with documentation on what they affect, look at the Settings (Default) file.

Project Settings

You can also override your user settings on a per project basis by editing your project file. Any setting will be available for overriding here.

{
    "DocblockrPython": {
        "formatter": "sphinx"
    },
    "folders": [
      // ...
    ]
}

Supported Docstring Styles

Extendability

If you don't like the formatting styles above, or want to make your own style to fit your use case, you can write your own formatter. All you will need to do is extend the Base formatter class and write your formatter functions. If you're not sure about it, you can take a look at any of the other formatters in the formatters source dir and see how they did it.

from DocBlockr_Python.formatters.base import Base


class MyFormatter(Base):
    # This will be used as your settings file value,
    # and how the formatter is registered in the registry
    name = 'my'

Note: The console should yell at you if you didn't write all the abstract methods. Be sure to read the docs on the Base formatter to make sure you understand all the caveats of each formatter function.

Known Issues

  • Only detects closed docstring if it is on a line of the same indentation, and has no text in front of it. Single Line docstrings are converted to block

Roadmap

Things I want to do wtih this project. Not necessarily an exhaustive or prioritized list.

  • Unit Tests!
  • More completions!
  • Javadoc style formatter
  • Keyboard Shortcuts
  • Reparsing Docstring (switch templating style)
  • Command Pallete Commands for changing syntax
  • Dynamic completions based on chosen syntax
  • Integration back with the original DocBlockr
  • Better Syntax Highlighting within docstrings (in particular for other styles)
  • Examples of each style to completion
  • Documentation (isn't it ironic?)