I can't seem to find any way to get sphinx to include doc strings from super methods. For example:
class Base(object):
def a_method(self, param_a, param_b, **kwargs):
""" This is an adapter method which must be implemented by each Sub class.
:param param_a: Param A Available to all adapters.
:type param_a: str
:param param_b: Param B Available to all adapters.
:type param_b: str
"""
raise NotImplementedError('This method must be implemented in each Sub')
class Sub (Base):
def a_method(self, param_a, param_b, param_c, **kwargs):
""" Adapted for interface with this unique API.
:param param_c: An option unique to this API.
:type param_c: str
"""
... obtain data from API here ...
return result
# UPDATE TO ORIGINAL: this will combine the docs
method_a.__doc__ += Base.method_a.__doc__
# Now i need to combine params so that Sub supersedes Super and
# incorporate this into sphinx.
I would like the documentation for Sub to include param_a from Base, param_b from Base, and param_c from Sub in the docs for Sub.a_method. Any way to get the output to look like this?
class Sub()
----a_method(param_a, param_b, param_c, **kwargs)
--------Super A method docs
--------Sub A method docs
--------Parameters:
-----------Param_a (str) – Param A.
-----------Param_b (str) – Param B.
-----------Param_c (str) – Param C.