Auto-add docstrings to decorators
Inherit BaseDecorator and the functions' docstrings w / doc
Tried the following, which works from within the library, but NOT in sphinx docs build:
def decorator_factory(decorator_name, func):
"""Takes in a function and outputs a class that can be used as a decorator."""
class decorator_name(BaseDecorator):
__doc__ = ("Decorator version of `{func_name}`. "
"See `{func_name}`'s docstring for arguments and examples."
.format(func_name=func.__name__))
check_func = staticmethod(func)
return decorator_name
The html docs still say alias of bulwark.decorators.decorator_factory.<locals>.decorator_name in every case.
May want to reference and/or parse func.doc
Update re the alias of issue w/ Sphinx autodoc - looks like there might be a fix coming in 3.1.0: https://github.com/sphinx-doc/sphinx/pull/7749
My PR only changes the behavior of GenericAliases. It does not change the behavior of decorators. I don't know what is happened on your document. So please let me know your problem in our issues. Thanks,
Thanks for reaching out here. I'll create an issue.