Sublime Text DocBlockr for python. Simplifies writing docstring comments in 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.
Package Control Now you can install it with package control!
Package Control: Install Package
.DocBlockr Python
and press Enter
.Manually Download the release and put it in your installed packages directory yourself
docblockr_python.sublime-package
file.Installed Packages
directory. (Preferences > Browse Packages...
and go up one directory to see Installed Packages
)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.
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.
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": [
// ...
]
}
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.
Below are the instructions to work on this repo locally.
ln -s <absolute/path/to/github/repo/sublime_docblockr_python> $HOME/.config/sublime-text-3/Packages/Docblockr_Python
ctrl + `
In addition to the setup instructions above, testing will require additinoal setup.
System Requirements:
Setup:
pipenv install --dev
pipenv run tox
3.4.3
, however sublime's python version is 3.3.6
. This is due to the difficulty of getting a working version of 3.3.6 in a dev environment, and the differences should be minimal.Things I want to do wtih this project. Not necessarily an exhaustive or prioritized list.