Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
usha-nemani-by opened this issue Aug 10, 2020 · 2 comments
Labels
Milestone

Comments

@usha-nemani-by
Copy link

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//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.

@marco-neumann-by
Copy link

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]


@tk0miya
Copy link
Member

tk0miya commented Aug 13, 2020

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

@tk0miya tk0miya closed this as completed Aug 13, 2020
@tk0miya tk0miya added this to the 3.2.1 milestone Aug 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants