jupyter-widgets / ipywidgets

Interactive Widgets for the Jupyter Notebook
https://ipywidgets.readthedocs.io
BSD 3-Clause "New" or "Revised" License
3.13k stars 950 forks source link

Intersphinx warning: multiple definitions for std:label:examples/Widget Layout.ipynb#display #3930

Open maxnoe opened 1 month ago

maxnoe commented 1 month ago

Description

The intersphinx inventory contains duplicated definitions

Reproduce

Include ipywidgets in the intersphinx config, build documentation.

The build warns about duplicated definitions:

loading intersphinx inventory 'ipywidgets' from https://ipywidgets.readthedocs.io/en/stable/objects.inv...
WARNING: inventory <https://ipywidgets.readthedocs.io/en/stable/> contains multiple definitions for std:label:examples/Widget Layout.ipynb#display

Expected behavior

No duplicated object definitions, no warnings

maxnoe commented 1 month ago

To reproduce quickly:

❯ python -m sphinx.ext.intersphinx https://ipywidgets.readthedocs.io/en/stable/objects.inv | grep 'Widget Layout.ipynb#display'
WARNING:sphinx.sphinx.util.inventory:inventory <> contains multiple definitions for std:label:examples/Widget Layout.ipynb#display
    examples/Widget Layout.ipynb#display     display                                 : examples/Widget%20Layout.html#id1
douglas-raillard-arm commented 1 month ago

Hitting this as well: https://gitlab.arm.com/tooling/lisa/-/jobs/71175/raw:

loading intersphinx inventory 'IPython' from https://ipython.readthedocs.io/en/stable/objects.inv...
WARNING: inventory <https://ipywidgets.readthedocs.io/en/latest/> contains multiple definitions for std:label:examples/Widget Layout.ipynb#display

with latest sphinx on python 3.9

maxnoe commented 1 month ago

See here for a quick fix: https://github.com/sphinx-doc/sphinx/issues/12585#issuecomment-2228420035

E.g. see our fix here: https://github.com/cta-observatory/ctapipe/blob/fix_intersphinx_warning/docs/conf.py#L417-L419

douglas-raillard-arm commented 1 month ago

That's what I did, but it has the unfortunate side effect that sphinx will now never complain about any broken intersphinx cross reference, even for the packages that have a working inventory. I'm relying on that in the CI to ensure we don't make typos and accidentally break links