Reputation: 625
I'm documenting some Python code that has multiple layers of inheritance using Sphinx. The structure is roughly:
class _foo(np.ndarray):
#do _foo stuff
class bar(_foo):
#do bar stuff
class baz(_foo):
#do baz stuff
With :inherited-members: in my .rst file I get the documentation from _foo
as part of bar
and baz
but I also get all the documentation from np.ndarray
, which I don't want.
The Sphinx documentation (https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html) says:
For example; If your class Foo is derived from list class and you don’t want to document list.__len__(), you should specify a option :inherited-members: list to avoid special members of list class.
But I've tried:
None of which prevent the entirety of numpy.ndarray documentation being included for every single class. Does anyone know if there's a way to exclude the numpy documentation, but keep the parts I need? Thanks.
Upvotes: 2
Views: 2022
Reputation: 625
As explained in comments by @Masklinn, requires version 3.0 or higher, it then works correctly with:
:inherited-members: ndarray
Upvotes: 1