clize
clize copied to clipboard
Support more docstring formats through napoleon
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.
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.
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