You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
This problem occurred during the migration from sphinx to mkdocs, specifically when auto-generating the API documentation 1.
In sphinx, it is possible (apparently the default when turning autodoc_default_options = { "inherited-members": True, ... } on) to have a docstring of a method in a parent class appear in the documentation of a subclass that overrides this method without supplying a new docstring.
classShape:
contour: list[Point]
defsurface_area(self):
"""Return the surface area in square meters."""returnnumerical_integration(self.contour)
classRectange(Shape)
defsurface_area(self):
returndistance(self.cotour[2], self.contour[0]) *distance(self.contour[3], self.contour[1])
We would like to have "Return the surface area in square meters." also appear for surface_area.
Additionally, sphinx performs some merging of docstrings3, as demonstrated below. Example:
classShape:
contour: list[Point]
defsurface_area(self):
"""Return the surface area in square meters."""returnnumerical_integration(self.contour)
classRectange(Shape)
defsurface_area(self):
"""Note: This is way faster than the calculation for general shapes!"""returndistance(self.cotour[2], self.contour[0]) *distance(self.contour[3], self.contour[1])
For this example, the documentation for surface_area should include: "Return the surface area in square meters. Note: This is way faster than the calculation for general shapes!"
Describe the solution you'd like
I'd like a configurable setting e.g. docstring_inherit_strategy that can be changed to realize a "plain insertion" of parent docstrings for members or to "merge" docstrings from the inheritance tree.
I'm already working on a solution as I saw that contributions are always welcome 😃
Describe alternatives you've considered
Continue using sphinx >.>.
Setting inherited_members: true in mkdocs.yml, but this doesn't achieve the described behavior4.
Is your feature request related to a problem? Please describe.
This problem occurred during the migration from
sphinx
tomkdocs
, specifically when auto-generating the API documentation 1.In sphinx, it is possible (apparently the default when turning
autodoc_default_options = { "inherited-members": True, ... }
on) to have a docstring of a method in a parent class appear in the documentation of a subclass that overrides this method without supplying a new docstring.Example2:
We would like to have
"Return the surface area in square meters."
also appear forsurface_area
.Additionally, sphinx performs some merging of docstrings3, as demonstrated below.
Example:
For this example, the documentation for
surface_area
should include:"Return the surface area in square meters. Note: This is way faster than the calculation for general shapes!"
Describe the solution you'd like
I'd like a configurable setting e.g.
docstring_inherit_strategy
that can be changed to realize a "plain insertion" of parent docstrings for members or to "merge" docstrings from the inheritance tree.I'm already working on a solution as I saw that contributions are always welcome 😃
Describe alternatives you've considered
>.>
.inherited_members: true
inmkdocs.yml
, but this doesn't achieve the described behavior4.Additional context
Footnotes
https://github.com/Quantco/metalearners/pull/81 ↩
https://github.com/Quantco/metalearners/pull/81#issuecomment-2317285231 ↩
Compare
MetaLearner.evaluate
with e.g.RLearner.evaluate
. Just beforeParameters
, RLearner has an additional paragraph that stems from this docstring ↩https://github.com/Quantco/metalearners/pull/81#issuecomment-2317267997 ↩
The text was updated successfully, but these errors were encountered: