Support for Google-style docstrings?

623 views
Skip to first unread message

Colin Marquardt

unread,
Nov 24, 2015, 7:49:06 AM11/24/15
to spyder
Hi,

we are trying to select a default docstring style in my company, which means to decide between NumPy-style (http://sphinxcontrib-napoleon.readthedocs.org/en/latest/example_numpy.html#example-numpy) and Google-style (http://sphinxcontrib-napoleon.readthedocs.org/en/latest/example_google.html#example-google) docstrings..

Personally, I like the Google style better since it's more concise. Someone mentioned though that Spyder would support only the NumPy style, and indeed the few references I can find point towards that (like http://stackoverflow.com/a/24557076 and http://stackoverflow.com/a/29636242). However, since Sphinx (Spyder's rendering backend) needs an extension to understand NumPy style anyway (the numpydoc extension, or Napoleon), it may not be so hard to support both styles?

Does anybody have experience with this?

TIA
  Colin

Gonzalo Peña-Castellanos

unread,
Dec 28, 2015, 11:22:43 PM12/28/15
to spyder
Hi Colin

Thanks for the suggestion, does sphinx come with an extension to parse google type docstrings?, if that is the case then this should be straightforward to add,
can you file an issue in the issue tracker if so.

https://github.com/spyder-ide/spyder/issues

Cheers


G.

Nikolay Karelin

unread,
Dec 29, 2015, 6:11:34 AM12/29/15
to spyder
Hello,

Sphinx comes with a special extension called Napoleon: http://sphinx-doc.org/latest/ext/napoleon.html

Once enabled (normally in conf.py, when docu are generated) it makes Sphinx understand Google and Numpy docstrings.

Best,
Nikolay
Reply all
Reply to author
Forward
0 new messages