Subject:
My use case is as follows, I have a decorated method compute_something.
It turns out that the decorator disable Sphinx auto documentation ...
@validate(argument)
def compute_something(param1, param2):
"""
Compute something
Parameters
----------
param1 : type
Description of parameter `param1`.
param2 : type
Description of parameter `param2`.
Returns
-------
type
Description of returned object.
"""
# do many things
return
the .rst file used by Sphinx is as follows
.. automodule:: compute_things
:members:
:undoc-members:
:show-inheritance:
Sphinx generates no doc for this function when I add the decorator
@validate(argument) whereas it works well without the decorator
Is there any work around ?
Do you use functools.wraps() for the decorator?
https://docs.python.org/3.6/library/functools.html#functools.wraps
Thanks for your answer, it worked perfectly !
Most helpful comment
Do you use
functools.wraps()for the decorator?https://docs.python.org/3.6/library/functools.html#functools.wraps