sphinx-autoapi icon indicating copy to clipboard operation
sphinx-autoapi copied to clipboard

Option to disable docstring inheritance

Open dhowland opened this issue 1 year ago • 3 comments

I have read the sphinx-autoapi documentation thoroughly but it isn't clear exactly how Sphinx's autodoc is leveraged by sphinx-autoapi. In any case, the following does not work:

...
extensions = ['autoapi.extension', 'sphinx.ext.autodoc']
autodoc_inherit_docstrings = False
...

So there appears to be no way to instruct sphinx-autoapi not to inherit docstrings.

I would prefer being able to fine-tune autodoc directly (as above), but if that just isn't compatible with the sphinx-autoapi architecture, I would certainly settle for an equivalent of the autodoc_inherit_docstrings setting.

Edited to remove incorrect assumption

dhowland avatar Oct 09 '24 13:10 dhowland

please, this would be very helpful. The unittest.TestCase type has an issue with its docstring, when I inherit from it, it adds the docstring in the output and raises an error for a text I didn't write.

mrbmp33 avatar Apr 04 '25 13:04 mrbmp33

I'm also interested in how to accomplish this, for the same reason as the original requester. I need just that specific option, but some way to generally pass-through options to autodoc would be cool.

lannocc avatar Apr 23 '25 02:04 lannocc

I concur, especially for classes that naturally do not have __init__ methods, such as those that inherit from TypedDict or are dataclasses, and also Exception et Enum.

I observe this behavior with autoapi_python_class_content = "both" BTW, and with undoc-members disabled (seems to be relevant for Exception and Enum only).

Reylak avatar Aug 29 '25 10:08 Reylak