-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
PythonDomain.resolve_xref incorrectly matches ivars to class methods #2549
Comments
I'm having the exact same problem, is there a known workaround for that? I'm trying to build pytest's documentation with |
I still haven't found a workaround. |
I had to change from |
Bump, also having this issue. |
I'm getting this same error with |
me too -- seeing the issue also with |
Still no good workaround for this 😕 |
…build, cant fix cross attribute warnings due to still open bug in sphinx: sphinx-doc/sphinx#2549
Also seeing this with |
It is perhaps not a "good" workaround, but this monkey patch works: https://stackoverflow.com/a/41184353. |
I'm seeing this with
within docstrings finds |
This can probably be reverted when sphinx-doc/sphinx#2549 is fixed.
* Fix some sphinx make html warnings. * Add pycomedi import guard if package is not available. * Fix some broken references. * Disambiguate attribute/methods in docstrings. This can probably be reverted when sphinx-doc/sphinx#2549 is fixed.
Most notably, taskflow is hitting the sphinx issue sphinx-doc/sphinx#2549 which causes a spurious warning that breaks the build with -W. There is a workaround posted in https://stackoverflow.com/questions/31784830/sphinx-ivar-tag-goes-looking-for-cross-references to move :ivar: docstrings to inline comments on the member variable itself. This is not ideal because it causes the docs to render differently from :ivar:, but until the sphinx bug is fixed it will allow us to keep documenting the problematic variables. There was also a problem with one of the doctests because the output had changed. That is now fixed. I also noticed a typo in one of the parameter descriptions so that is fixed too. Change-Id: Ib44621f6c3ba2c5476ec430218a0449f9f45d18f
foo.py:
bar.py:
log:
Without |
The error is: ``` stdpopsim/species.py:docstring of stdpopsim.Species::more than one target found for cross-reference 'id': stdpopsim.engines._MsprimeEngine.id, stdpopsim.slim_engine._SLiMEngine.id ``` See currently open sphinx issue for workaround. sphinx-doc/sphinx#2549
The error is: ``` stdpopsim/species.py:docstring of stdpopsim.Species::more than one target found for cross-reference 'id': stdpopsim.engines._MsprimeEngine.id, stdpopsim.slim_engine._SLiMEngine.id ``` See currently open sphinx issue for workaround. sphinx-doc/sphinx#2549
The error is: ``` stdpopsim/species.py:docstring of stdpopsim.Species::more than one target found for cross-reference 'id': stdpopsim.engines._MsprimeEngine.id, stdpopsim.slim_engine._SLiMEngine.id ``` See currently open sphinx issue for workaround. sphinx-doc/sphinx#2549
… ; also rework improve the top level documentation for BaseRunner
Sphinx attempts to create cross-references for attribute and variable names... sphinx-doc/sphinx#2549 sphinx-doc/sphinx#3866 This results in numerous warnings of the form... WARNING: more than one target found for cross-reference 'digest' Adapting a patch from the tickets above. Sphinx deprecated override_domain(), so using add_domain() instead... https://www.sphinx-doc.org/en/2.0/extdev/appapi.html#sphinx.application.Sphinx.override_domain
Issue web-platform-tests#23081 This CL made the following changes: [1] Upgrading Sphinx version to 3.3.1 to support python 3.5+ [2] Fixing bugs invoked during Py3 run. a) Replace reference of "index" in checklist.md with relative path for index.md. This is due to "more than one target found for cross-reference" error thrown by Sphinx referring to it. It's a known issue in sphinx (sphinx-doc/sphinx#2549) b) Fix Sphinx in third_party/pywebsocket3. A PR has been sent at GoogleChromeLabs/pywebsocket3#16 Note: Command to run with Python3 is: wpt --py3 build-docs
With Sphinx 3.3, this fixed most of the duplicate crossref warnings for me, but even this wasn't enough in some cases. I had to also add the class name prefix: # pkg.nn.tf_impl.py
class MyRNN(tf.keras.AbstractRNNCell):
"""
:ivar tf.keras.layers.Dense ~MyRNN.layer1: :math:`l_1` layer.
:ivar tf.keras.layers.Dense ~MyRNN.layer2: :math:`l_2` layer.
"""
# pkg.nn.torch_impl.py
class MyRNN(nn.Module):
"""
:ivar torch.nn.Linear ~MyRNN.layer1: :math:`l_1` layer.
:ivar torch.nn.Linear ~MyRNN.layer2: :math:`l_2` layer.
:ivar torch.nn.Linear layer3: :math:`l_3` layer.
""" I suppose this is because the classes have the same name, but are located in different modules. |
Fixes #23081 This CL made the following changes: [1] Upgrading Sphinx version to 2.4.4 to support python 3.5+ [2] Fixing bugs invoked during Py3 run. a) Replace reference of "index" in checklist.md with relative path for index.md. This is due to "more than one target found for cross-reference" error thrown by Sphinx referring to it. It's a known issue in sphinx (sphinx-doc/sphinx#2549) b) Fix Sphinx in third_party/pywebsocket3. A PR has been sent at GoogleChromeLabs/pywebsocket3#16 Note: Command to run with Python3 is: wpt --py3 build-docs Co-authored-by: Robert Ma <[email protected]>
…stonly Automatic update from web-platform-tests Run Sphinx generation in Python 3. (#26574) Fixes #23081 This CL made the following changes: [1] Upgrading Sphinx version to 2.4.4 to support python 3.5+ [2] Fixing bugs invoked during Py3 run. a) Replace reference of "index" in checklist.md with relative path for index.md. This is due to "more than one target found for cross-reference" error thrown by Sphinx referring to it. It's a known issue in sphinx (sphinx-doc/sphinx#2549) b) Fix Sphinx in third_party/pywebsocket3. A PR has been sent at GoogleChromeLabs/pywebsocket3#16 Note: Command to run with Python3 is: wpt --py3 build-docs Co-authored-by: Robert Ma <[email protected]> -- wpt-commits: da46f68d5b82371132b4f877e05b9b457de89af9 wpt-pr: 26574
…stonly Automatic update from web-platform-tests Run Sphinx generation in Python 3. (#26574) Fixes #23081 This CL made the following changes: [1] Upgrading Sphinx version to 2.4.4 to support python 3.5+ [2] Fixing bugs invoked during Py3 run. a) Replace reference of "index" in checklist.md with relative path for index.md. This is due to "more than one target found for cross-reference" error thrown by Sphinx referring to it. It's a known issue in sphinx (sphinx-doc/sphinx#2549) b) Fix Sphinx in third_party/pywebsocket3. A PR has been sent at GoogleChromeLabs/pywebsocket3#16 Note: Command to run with Python3 is: wpt --py3 build-docs Co-authored-by: Robert Ma <[email protected]> -- wpt-commits: da46f68d5b82371132b4f877e05b9b457de89af9 wpt-pr: 26574
Sadly stopped working starting with Sphinx 3.4.0 |
Sorry for inconvenience long. Now #8638 will fix this bug. Thanks, |
This issue was originally described in a stackoverflow post and has gone unanswered for a while. If an
:ivar:
has the same name as a method in a different class, a cross reference is incorrectly created. Furthermore, if two classes have methods of the same name as the:ivar:
, a warning is raised saying:WARNING: more than one target found for cross-reference ...
The text was updated successfully, but these errors were encountered: