clize icon indicating copy to clipboard operation
clize copied to clipboard

Support more docstring formats through napoleon

Open epsy opened this issue 11 years ago • 2 comments

Currently Clize supports docstrings in docutils/Sphinx format and in its own legacy docstring format.

This could be done in one of two ways:

  • Sphinx includes a 'napoleon' extension that converts docstrings in Numpy and Google style to something that docutils can process. We may be able to use it for this purpose. If so we need to ask about API stability with them
  • If the above solution is too overkill, maybe we can implement our own converter.

epsy avatar Oct 08 '12 23:10 epsy

Came to this issue because Clize looks pretty nice but all my docstrings are in Numpy format. The current library that I use for CLI is 'mando' which went the sphinx napoleon route. There are a lot of dependencies to make that happen.

There is however a much nicer solution by going with something like https://github.com/rr-/docstring_parser which parses REST, Google, and Numpy docstrings. Pure python, no additional dependencies.

timcera avatar Feb 05 '21 18:02 timcera

This can be achieved by subclassing ClizeHelp and passing it to Clize constructor via helper_class argument:

https://github.com/metoppv/improver/blob/8194d01/improver/cli/init.py#L57-#L102

TomekTrzeciak avatar Mar 12 '21 14:03 TomekTrzeciak