Sphinx: Sphinx 3.2.0 gives WARNING: py:class reference target not found: type warning but treated as error

Created on 10 Aug 2020  路  2Comments  路  Source: sphinx-doc/sphinx

Describe the bug
I am using Sphinx for autodoc . This bug is regression issue caused in Sphinx==3.2.0, which relates to

[https://github.com/sphinx-doc/sphinx/issues/965]

I am using absolute path of my class kartothek.core.dataset.DatasetMetadata and Sphinx3.2.0 throws below error.
This worked well, when I used sphinx==3.1.2

`Warning, treated as error:
docstring of xx.yy.zz:py:class reference target not found: A.B.C.D]]

[error]Process completed with exit code 1.`

To Reproduce
Steps to reproduce the behavior:
Install sphinx==3.2.0
Use absolute path of a class in the documentation.

Expected behavior
Sphinx to accept the absolute path of the class.

bug

Most helpful comment

Sorry for the inconvenience. This was fixed by #8095.

All 2 comments

Some more details for the bug above:

Test Code

from sphinx import __version__ as version
from sphinx.ext.napoleon import NumpyDocstring

print(version)

print("=== Variant 1 ===")
docstring1 = """
Parameters
----------
arg: Union[str, my_package.MyClass]
    An argument.

"""
print(str(NumpyDocstring(docstring1)))


print("=== Variant 2 ===")
docstring2 = """
Parameters
----------
arg: Union[str,my_package.MyClass]
    An argument.

"""
print(str(NumpyDocstring(docstring2)))

Output Sphinx 3.2.0

It seems that the arg parser should not split spaces within the type description:

3.2.0
=== Variant 1 ===

:param arg: An argument.
:type arg: :class:`Union[str`, :class:`my_package.MyClass]`

=== Variant 2 ===

:param arg: An argument.
:type arg: :class:`Union[str,my_package.MyClass]`


Output Sphinx 3.1.2

Here it doesn't matter at all because types are not automatically linked:

3.1.2
=== Variant 1 ===

:param arg: An argument.
:type arg: Union[str, my_package.MyClass]

=== Variant 2 ===

:param arg: An argument.
:type arg: Union[str,my_package.MyClass]


Sorry for the inconvenience. This was fixed by #8095.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miketheman picture miketheman  路  3Comments

oonid picture oonid  路  3Comments

jessetan picture jessetan  路  3Comments

shimizukawa picture shimizukawa  路  3Comments

shimizukawa picture shimizukawa  路  3Comments