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
Describe the bug
This is halfway between a bug and a feature request (and probably not of high priority either way). The docstring in a child class can't cross-reference methods/attributes that it inherits using the native :meth:`inherited_method` syntax. Instead it has to use fully qualified referencing :meth:`~ParentClass.inherited_method` .
classFoo:
deffoo(self):
"""A docstring."""passclassBar(Foo):
defuses_foo(self):
"""This cross reference to :meth:`foo`won't work. A fully qualified reference like :meth:`~Foo.foo` does work but gets tedious if the parent class if from another library and therefore needs the module name too. """pass
To Reproduce
I've put the above example, along with its autodoc stubs in an example repo.
The last command should cause a warning about the failed cross-reference.
/.../sphinx-reference-issue/test.py:docstring of test.Bar.uses_foo:1: WARNING: py:meth reference target not found: foo
Expected behavior
I would like the :attr:`attribute` and :meth:`method` to reference the attribute/method from the parent class if that attribute/method has not been overloaded by the child class. i.e In my example above, the cross references in Bar.uses_foo() should both link to Foo.foo().
Environment info
OS: Linux 5.11.6-1-MANJARO
Python version: 3.9
Sphinx version: 3.5.4
Sphinx extensions: [sphinx.ext.autodoc]
Extra tools: None
The text was updated successfully, but these errors were encountered:
Thank you for reporting. At present, it's not supported. The reference :meth:`inherited_method` tries to search Bar.instance_method only. It does not search Foo.instance_method. Please use the "fully qualified referencing" workaround.
Note: This is the same as #272. So I'm closing this as duplicated.
Describe the bug
This is halfway between a bug and a feature request (and probably not of high priority either way). The docstring in a child class can't cross-reference methods/attributes that it inherits using the native
:meth:`inherited_method`
syntax. Instead it has to use fully qualified referencing:meth:`~ParentClass.inherited_method`
.To Reproduce
I've put the above example, along with its autodoc stubs in an example repo.
The last command should cause a warning about the failed cross-reference.
Expected behavior
I would like the
:attr:`attribute`
and:meth:`method`
to reference the attribute/method from the parent class if that attribute/method has not been overloaded by the child class. i.e In my example above, the cross references inBar.uses_foo()
should both link toFoo.foo()
.Environment info
The text was updated successfully, but these errors were encountered: