Does PyCharm 2.7 (or will PyCharm 3) have support for custom docstring and doctest stubs? If so, how does one go about writing this specific type of custom extension?
My current project has standardized on using the Google Python Style Guide (http://google-styleguide.googlecode.com/svn/trunk/pyguide.html). I love PyCharm's docstring support, but it's only two supported formats right now are epytext and reStructureText. I want, and am willing to write myself, a PyCharm plugin that creates a documentation comment stub formatted in either Google or Numpydoc style (https://pypi.python.org/pypi/sphinxcontrib-napoleon/). Of special importance here is incorporating the type inference abilities that PyCharm has with the other two documentation types.
Press Ctrl+Alt+S and go to Editor | General |Smart Keys. Select the Insert type placeholders checkbox in the Smart Keys page of the editor settings. Place the caret at the function name, and press Alt+Enter . In the list of intention actions that opens, choose Insert documentation string stub.
Declaring Docstrings: The docstrings are declared using ”'triple single quotes”' or “””triple double quotes””” just below the class, method or function declaration. All functions should have a docstring.
Quick documentation look-upPress Ctrl+Q or choose View | Quick Documentation Lookup on the main menu. In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | General | Code Completion. The Code completion page opens. Select the Show the documentation popup checkbox and specify the elapsed time.
With PyCharm 5.0 we finally got to select Google and NumPy Style Python Docstrings templates.
It is also mentioned in the whatsnew section for PyCharm 5.0.
How to change the Docstring Format:
File --> Settings --> Tools --> Python Integrated Tools
There you can choose from the available Docstrings formats:
Plain, Epytext, reStructuredText, NumPy, Google
As pointed out by jstol: for Mac users, this is under
PyCharm -> Preferences -> Tools -> Python Integrated Tools.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With