Simple way to convert Python docstrings from reStructured Text to Google style?

9.1k Views Asked by At

Does anyone now a simple way do convert all docstrings in an existing project from reStructured Text to the Google format?

It looks like Napoleon can do something like that, but it looks very complicated, so I figured I'd ask if someone has done that before. Any idea would be much appreciated.

2

There are 2 best solutions below

3
On BEST ANSWER

Try using pyment to convert docstrings from reStructuredText to Google format. Then use Napolean to generate documentation via Sphinx.

Napoleon is a pre-processor that parses NumPy and Google style docstrings and converts them to reStructuredText before Sphinx attempts to parse them.

0
On

There is also docconvert at https://github.com/cbillingham/docconvert.

I personally found it did a much better job;

  • better indentation and line wrapping (personal choice)
  • coped with docstrings that were a mix of google and reSTructured styles in the same docstring!