Othoz/paragraph

Sphinx ignores op-decorated functions

Closed this issue · 1 comments

The @op decorator returns an instance of the class Op, so that a function thus decorated is a module-level object that is neither of Class nor function type. It is therefore ignored by sphinx.ext.autodoc.

One workaround consists in explicitly instructing autodoc to include the decorated function by adding the following statement to the module's docstring:

.. autodata:: function_name
   :annotation:

This would however require the decorator to copy the docstring of the wrapped function onto the Op instance it returns.

The docstring is now correctly copied (#19). Discovery of the callable instances by Sphinx lies outside of the scope of the library, thus I'm closing the issue.