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

WARNING: py:class reference target not found: .. #8127

Closed
altendky opened this issue Aug 14, 2020 · 4 comments
Closed

WARNING: py:class reference target not found: .. #8127

altendky opened this issue Aug 14, 2020 · 4 comments

Comments

@altendky
Copy link
Contributor

Describe the bug

I think this might be referring to the ellipsis but I'm not sure at present.

/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.Runner.trio_main:: WARNING: py:class reference target not found: ..
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.Runner.trio_main:: WARNING: py:class reference target not found: ..

https://github.com/altendky/qtrio/blob/661520c1442556016e328169c81c7cd3bdc7f7c3/qtrio/_core.py#L556-L560

    async def trio_main(
        self,
        async_fn: typing.Callable[..., typing.Awaitable[None]],
        args: typing.Tuple[object, ...],
    ) -> None:

Note that I've already tracked the other warnings (outcomes and event type) to other issues.

This time I did remember to try latest 3.x (f861b4c). It showed the same issue.

To Reproduce
Steps to reproduce the behavior:

git clone https://github.com/altendky/qtrio
cd qtrio
git checkout 661520c1442556016e328169c81c7cd3bdc7f7c3
python3.8 -m venv venv
venv/bin/pip install --upgrade pip setuptools wheel
venv/bin/pip install .[pyside2,docs]
venv/bin/pip freeze
source venv/bin/activate
cd docs
make html
Steps with output including complete traceback
altendky@p1:~/repos/preqtrio/tmp$ git clone https://github.com/altendky/qtrio
Cloning into 'qtrio'...
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 4073 (delta 9), reused 16 (delta 8), pack-reused 4044
Receiving objects: 100% (4073/4073), 536.01 KiB | 1.90 MiB/s, done.
Resolving deltas: 100% (2630/2630), done.
altendky@p1:~/repos/preqtrio/tmp$ cd qtrio
altendky@p1:~/repos/preqtrio/tmp/qtrio$ git checkout 661520c1442556016e328169c81c7cd3bdc7f7c3
Note: switching to '661520c1442556016e328169c81c7cd3bdc7f7c3'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 661520c *args: object,
altendky@p1:~/repos/preqtrio/tmp/qtrio$ python3.8 -m venv venv
altendky@p1:~/repos/preqtrio/tmp/qtrio$ venv/bin/pip install --upgrade pip setuptools wheel
Collecting pip
  Using cached https://files.pythonhosted.org/packages/5a/4a/39400ff9b36e719bdf8f31c99fe1fa7842a42fa77432e584f707a5080063/pip-20.2.2-py2.py3-none-any.whl
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/c3/a9/5dc32465951cf4812e9e93b4ad2d314893c2fa6d5f66ce5c057af6e76d85/setuptools-49.6.0-py3-none-any.whl
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/85/37/7252beacf7e60cffe3bc5a97f94e3ccf22a927e87697d377cfe16abea7cf/wheel-0.35.0-py2.py3-none-any.whl
Collecting packaging>=20.2 (from wheel)
  Using cached https://files.pythonhosted.org/packages/46/19/c5ab91b1b05cfe63cccd5cfc971db9214c6dd6ced54e33c30d5af1d2bc43/packaging-20.4-py2.py3-none-any.whl
Collecting pyparsing>=2.0.2 (from packaging>=20.2->wheel)
  Using cached https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc279a2025a39e22449b7cf29864669b15d/pyparsing-2.4.7-py2.py3-none-any.whl
Collecting six (from packaging>=20.2->wheel)
  Using cached https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, pyparsing, six, packaging, wheel
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
  Found existing installation: setuptools 41.2.0
    Uninstalling setuptools-41.2.0:
      Successfully uninstalled setuptools-41.2.0
Successfully installed packaging-20.4 pip-20.2.2 pyparsing-2.4.7 setuptools-49.6.0 six-1.15.0 wheel-0.35.0
altendky@p1:~/repos/preqtrio/tmp/qtrio$ venv/bin/pip install .[pyside2,docs]
Processing /home/altendky/repos/preqtrio/tmp/qtrio
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting trio>=0.16
  Using cached trio-0.16.0-py3-none-any.whl (337 kB)
Collecting towncrier>=19.9.0rc1
  Using cached towncrier-19.9.0rc1-py2.py3-none-any.whl (28 kB)
Collecting sphinx>=3.2.1
  Using cached Sphinx-3.2.1-py3-none-any.whl (2.9 MB)
Requirement already satisfied: packaging in ./venv/lib/python3.8/site-packages (from sphinx>=3.2.1->qtrio==0.1.0+dev) (20.4)
Requirement already satisfied: setuptools in ./venv/lib/python3.8/site-packages (from sphinx>=3.2.1->qtrio==0.1.0+dev) (49.6.0)
Collecting sphinx-qt-documentation>=0.3
  Using cached sphinx_qt_documentation-0.3-py3-none-any.whl (5.6 kB)
Collecting attrs
  Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting async-generator
  Using cached async_generator-1.10-py3-none-any.whl (18 kB)
Collecting sphinxcontrib-jsmath
  Using cached sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl (5.1 kB)
Collecting outcome
  Using cached outcome-1.0.1-py2.py3-none-any.whl (10 kB)
Collecting sniffio
  Using cached sniffio-1.1.0-py3-none-any.whl (4.5 kB)
Collecting sphinxcontrib-devhelp
  Using cached sphinxcontrib_devhelp-1.0.2-py2.py3-none-any.whl (84 kB)
Collecting sphinxcontrib-applehelp
  Using cached sphinxcontrib_applehelp-1.0.2-py2.py3-none-any.whl (121 kB)
Collecting sphinxcontrib-qthelp
  Using cached sphinxcontrib_qthelp-1.0.3-py2.py3-none-any.whl (90 kB)
Collecting sphinxcontrib-htmlhelp
  Using cached sphinxcontrib_htmlhelp-1.0.3-py2.py3-none-any.whl (96 kB)
Processing /home/altendky/.cache/pip/wheels/7e/9f/ec/d087477ddc7c2807136ca08eb01b5f00e66da90eb4dbf323ab/click_default_group-1.2.2-py3-none-any.whl
Collecting sphinxcontrib-serializinghtml
  Using cached sphinxcontrib_serializinghtml-1.1.4-py2.py3-none-any.whl (89 kB)
Collecting snowballstemmer>=1.1
  Using cached snowballstemmer-2.0.0-py2.py3-none-any.whl (97 kB)
Collecting sphinxcontrib-trio
  Using cached sphinxcontrib_trio-1.1.2-py3-none-any.whl (12 kB)
Collecting imagesize
  Using cached imagesize-1.2.0-py2.py3-none-any.whl (4.8 kB)
Collecting docutils>=0.12
  Using cached docutils-0.16-py2.py3-none-any.whl (548 kB)
Collecting incremental
  Using cached incremental-17.5.0-py2.py3-none-any.whl (16 kB)
Collecting alabaster<0.8,>=0.7
  Using cached alabaster-0.7.12-py2.py3-none-any.whl (14 kB)
Collecting toml
  Using cached toml-0.10.1-py2.py3-none-any.whl (19 kB)
Collecting Pygments>=2.0
  Using cached Pygments-2.6.1-py3-none-any.whl (914 kB)
Collecting babel>=1.3
  Using cached Babel-2.8.0-py2.py3-none-any.whl (8.6 MB)
Collecting pyside2
  Using cached PySide2-5.15.0-5.15.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl (170.8 MB)
Collecting shiboken2==5.15.0
  Using cached shiboken2-5.15.0-5.15.0-cp35.cp36.cp37.cp38-abi3-manylinux1_x86_64.whl (856 kB)
Collecting sphinx-rtd-theme
  Using cached sphinx_rtd_theme-0.5.0-py2.py3-none-any.whl (10.8 MB)
Collecting idna
  Using cached idna-2.10-py2.py3-none-any.whl (58 kB)
Collecting pytz>=2015.7
  Using cached pytz-2020.1-py2.py3-none-any.whl (510 kB)
Collecting qtpy
  Using cached QtPy-1.9.0-py2.py3-none-any.whl (54 kB)
Collecting decorator
  Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting sphinx-autodoc-typehints
  Using cached sphinx_autodoc_typehints-1.11.0-py3-none-any.whl (8.5 kB)
Requirement already satisfied: six in ./venv/lib/python3.8/site-packages (from packaging->sphinx>=3.2.1->qtrio==0.1.0+dev) (1.15.0)
Requirement already satisfied: pyparsing>=2.0.2 in ./venv/lib/python3.8/site-packages (from packaging->sphinx>=3.2.1->qtrio==0.1.0+dev) (2.4.7)
Collecting jinja2
  Using cached Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
Collecting MarkupSafe>=0.23
  Using cached MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl (32 kB)
Collecting click
  Using cached click-7.1.2-py2.py3-none-any.whl (82 kB)
Collecting sortedcontainers
  Using cached sortedcontainers-2.2.2-py2.py3-none-any.whl (29 kB)
Collecting requests>=2.5.0
  Using cached requests-2.24.0-py2.py3-none-any.whl (61 kB)
Collecting chardet<4,>=3.0.2
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Using cached urllib3-1.25.10-py2.py3-none-any.whl (127 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2020.6.20-py2.py3-none-any.whl (156 kB)
Collecting pytest
  Using cached pytest-6.0.1-py3-none-any.whl (270 kB)
Requirement already satisfied: packaging in ./venv/lib/python3.8/site-packages (from sphinx>=3.2.1->qtrio==0.1.0+dev) (20.4)
Collecting py>=1.8.2
  Using cached py-1.9.0-py2.py3-none-any.whl (99 kB)
Collecting iniconfig
  Using cached iniconfig-1.0.1-py3-none-any.whl (4.2 kB)
Collecting pluggy<1.0,>=0.12
  Using cached pluggy-0.13.1-py2.py3-none-any.whl (18 kB)
Collecting more-itertools>=4.0.0
  Using cached more_itertools-8.4.0-py3-none-any.whl (43 kB)
Building wheels for collected packages: qtrio
  Building wheel for qtrio (PEP 517) ... done
  Created wheel for qtrio: filename=qtrio-0.1.0+dev-py3-none-any.whl size=34621 sha256=6765fc5d949922751f6ebe903b0edb0ff734a29c1a1240e46ab0581ebc12767a
  Stored in directory: /tmp/pip-ephem-wheel-cache-xzjtae2b/wheels/4d/b7/56/4e68a784b1eefc0f978a537a24c566caabfee8741e8eab4c6e
Successfully built qtrio
Installing collected packages: urllib3, pytz, MarkupSafe, idna, chardet, certifi, attrs, toml, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, sortedcontainers, snowballstemmer, sniffio, requests, Pygments, py, pluggy, outcome, more-itertools, jinja2, iniconfig, imagesize, docutils, click, babel, async-generator, alabaster, trio, sphinx, shiboken2, qtpy, pytest, incremental, decorator, click-default-group, towncrier, sphinxcontrib-trio, sphinx-rtd-theme, sphinx-qt-documentation, sphinx-autodoc-typehints, qtrio, pyside2
Successfully installed MarkupSafe-1.1.1 Pygments-2.6.1 alabaster-0.7.12 async-generator-1.10 attrs-19.3.0 babel-2.8.0 certifi-2020.6.20 chardet-3.0.4 click-7.1.2 click-default-group-1.2.2 decorator-4.4.2 docutils-0.16 idna-2.10 imagesize-1.2.0 incremental-17.5.0 iniconfig-1.0.1 jinja2-2.11.2 more-itertools-8.4.0 outcome-1.0.1 pluggy-0.13.1 py-1.9.0 pyside2-5.15.0 pytest-6.0.1 pytz-2020.1 qtpy-1.9.0 qtrio-0.1.0+dev requests-2.24.0 shiboken2-5.15.0 sniffio-1.1.0 snowballstemmer-2.0.0 sortedcontainers-2.2.2 sphinx-3.2.1 sphinx-autodoc-typehints-1.11.0 sphinx-qt-documentation-0.3 sphinx-rtd-theme-0.5.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 sphinxcontrib-htmlhelp-1.0.3 sphinxcontrib-jsmath-1.0.1 sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.4 sphinxcontrib-trio-1.1.2 toml-0.10.1 towncrier-19.9.0rc1 trio-0.16.0 urllib3-1.25.10
altendky@p1:~/repos/preqtrio/tmp/qtrio$ venv/bin/pip freeze
alabaster==0.7.12
async-generator==1.10
attrs==19.3.0
Babel==2.8.0
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
click-default-group==1.2.2
decorator==4.4.2
docutils==0.16
idna==2.10
imagesize==1.2.0
incremental==17.5.0
iniconfig==1.0.1
Jinja2==2.11.2
MarkupSafe==1.1.1
more-itertools==8.4.0
outcome==1.0.1
packaging==20.4
pluggy==0.13.1
py==1.9.0
Pygments==2.6.1
pyparsing==2.4.7
PySide2==5.15.0
pytest==6.0.1
pytz==2020.1
QtPy==1.9.0
qtrio @ file:///home/altendky/repos/preqtrio/tmp/qtrio
requests==2.24.0
shiboken2==5.15.0
six==1.15.0
sniffio==1.1.0
snowballstemmer==2.0.0
sortedcontainers==2.2.2
Sphinx==3.2.1
sphinx-autodoc-typehints==1.11.0
sphinx-qt-documentation==0.3
sphinx-rtd-theme==0.5.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==1.0.3
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.4
sphinxcontrib-trio==1.1.2
toml==0.10.1
towncrier==19.9.0rc1
trio==0.16.0
urllib3==1.25.10
altendky@p1:~/repos/preqtrio/tmp/qtrio$ source venv/bin/activate
(venv) altendky@p1:~/repos/preqtrio/tmp/qtrio$ cd docs
(venv) altendky@p1:~/repos/preqtrio/tmp/qtrio/docs$ make html
Running Sphinx v3.2.1
making output directory... done
loading intersphinx inventory from https://outcome.readthedocs.io/en/stable/objects.inv...
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
loading intersphinx inventory from https://www.riverbankcomputing.com/static/Docs/PyQt5/objects.inv...
loading intersphinx inventory from https://docs.pytest.org/en/stable/objects.inv...
loading intersphinx inventory from https://trio.readthedocs.io/en/stable/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 13 source files that are out of date
updating environment: [new config] 13 added, 0 changed, 0 removed
reading sources... [100%] tutorial                                                                                                                                                                                                           
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] tutorial                                                                                                                                                                                                            
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.run:: WARNING: py:class reference target not found: qtrio._core.Outcomes
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.run:: WARNING: py:class reference target not found: qtrio._core.Outcomes
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.Runner.done_callback:: WARNING: py:class reference target not found: qtrio._core.Outcomes
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.Runner.outcomes:: WARNING: py:class reference target not found: qtrio._core.Outcomes
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.Runner.run:: WARNING: py:class reference target not found: qtrio._core.Outcomes
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.Runner.trio_main:: WARNING: py:class reference target not found: ..
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.Runner.trio_main:: WARNING: py:class reference target not found: ..
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.register_requested_event_type:: WARNING: py:class reference target not found: <class 'PySide2.QtCore.QEvent.Type'>
/home/altendky/repos/preqtrio/tmp/qtrio/qtrio/_core.py:docstring of qtrio.registered_event_type:: WARNING: py:class reference target not found: <class 'PySide2.QtCore.QEvent.Type'>
generating indices...  genindexdone
writing additional pages...  searchdone
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 9 warnings.

The HTML pages are in build/html.

Expected behavior
I'm not completely sure but at least a reference to a specific thing in my code. If it is referring to the ellipsis then perhaps it just shouldn't have an issue at all. I'm guessing it should just be a plain ... in the output. It could link to https://docs.python.org/3/library/constants.html#Ellipsis but that doesn't really describe it's meaning in typing and the generic type for which it is a parameter would already be linked.

Your project
altendky/qtrio#146

Environment info

  • OS: Ubuntu Linux 20.04
  • Python version: 3.8.3
  • Sphinx version: 3.2.0
  • Sphinx extensions:
    • sphinx.ext.autodoc
    • sphinx.ext.intersphinx
    • sphinx.ext.coverage
    • sphinx.ext.napoleon
    • sphinx_qt_documentation
    • sphinxcontrib_trio
@altendky
Copy link
Contributor Author

Changing to Ellipsis:

    async def trio_main(
        self,
        async_fn: typing.Callable[Ellipsis, typing.Awaitable[None]],
        args: typing.Tuple[object, Ellipsis],
    ) -> None:

Still results in the same output, even still with ...

/home/altendky/repos/preqtrio/qtrio/_core.py:docstring of qtrio.Runner.trio_main:: WARNING: py:class reference target not found: ..
/home/altendky/repos/preqtrio/qtrio/_core.py:docstring of qtrio.Runner.trio_main:: WARNING: py:class reference target not found: ..

Other substitutes like int eliminate the warning as you might expect.

@altendky
Copy link
Contributor Author

I don't know if this will provide any useful context but qtrio._pytest.host uses @typing.overload resulting in hints in the signature per #7785. It also doesn't trigger the 'not found' reported here nor does the ellipsis turn into [..].

image

So I tried autodoc_typehints = 'signature' and the warning went away. Notice how while the square brackets are still added, there are three dots in the ellipsis unlike above.

image

Just in case this offers any insight... This is the result of just messing around so nothing has been committed. If valuable I can provide it of course.

altendky added a commit to altendky/qtrio that referenced this issue Aug 21, 2020
@altendky altendky mentioned this issue Aug 21, 2020
2 tasks
@hoefling
Copy link
Contributor

hoefling commented Apr 16, 2021

Suggesting a workaround until the issue is fixed. In your conf.py:

from docutils.nodes import Text
from sphinx.ext.intersphinx import missing_reference


def setup(app):
    app.connect("missing-reference", __sphinx_issue_8127)


def __sphinx_issue_8127(app, env, node, contnode):
    reftarget = node.get("reftarget", None)
    if reftarget == "..":
        node["reftype"] = "data"
        node["reftarget"] = "Ellipsis"
        text_node = next(iter(contnode.traverse(lambda n: n.tagname == "#text")))
        replacement_node = Text("...", "")
        if text_node.parent is not None:
            text_node.parent.replace(text_node, replacement_node)
        else:  # e.g. happens in rtype fields
            contnode = replacement_node
        return missing_reference(app, env, node, contnode)

This will rewrite all the .. to a ... with a ref :py:data:`Ellipsis` .

@tk0miya tk0miya added this to the 4.0.0 milestone Apr 16, 2021
@tk0miya
Copy link
Member

tk0miya commented Apr 16, 2021

I reproduced the error with the following mark-up:

.. py:function:: foo(fn)

   :param fn: blah
   :type fn: typing.Callable[..., typing.Awaitable[None]]

tk0miya added a commit to tk0miya/sphinx that referenced this issue Apr 16, 2021
…t-picky warning

On parsing the types, the leading dot of the ellipsis (...) is considered
as a reference name.  And its first dot is considered as a notation for
relative type reference (ex. ".ClassName"). As a result, it was converted
double dots unexpectedly.

This changes the parsing rule to treat the ellipsis as a symbol, not a
name.
tk0miya added a commit that referenced this issue Apr 17, 2021
Fix #8127: py domain: Ellipsis in info-field-list causes nit-picky warning
@tk0miya tk0miya closed this as completed Apr 17, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants