When I use Sphinx automethod to document a specific method like so:
.. automethod:: my_module.MyClass.my_method
The resulting docs append the class name to the method name like this:
MyClass.my_method(kwarg1=None, kwarg2=None)
This is the docstring for my_method...
Is there any way to tell automethod to not prefix the method name with the class name, such that the resulting docs look like this:
my_method(kwarg1=None, kwarg2=None)
This is the docstring for my_method...
?
Add this line in your conf.py
file
add_module_names = False
In addition to
add_module_names = False
use
.. autofunction:: my_module.MyClass.my_method
instead of automodule
and the class name is omitted in the generated doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With