Issue
When building the Bokeh docs, things expode:
Traceback (most recent call last):
File "/Users/bryan/anaconda/envs/dev-311/lib/python3.11/site-packages/sphinx/events.py", line 94, in emit
results.append(listener.handler(self.app, *args))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bryan/anaconda/envs/dev-311/lib/python3.11/site-packages/sphinx_codeautolink/extension/__init__.py", line 42, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/bryan/anaconda/envs/dev-311/lib/python3.11/site-packages/sphinx_codeautolink/extension/__init__.py", line 176, in create_references
self.filter_and_resolve(transforms, skipped, doc)
File "/Users/bryan/anaconda/envs/dev-311/lib/python3.11/site-packages/sphinx_codeautolink/extension/__init__.py", line 200, in filter_and_resolve
key = resolve_location(name, self.inventory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bryan/anaconda/envs/dev-311/lib/python3.11/site-packages/sphinx_codeautolink/extension/resolve.py", line 36, in resolve_location
cursor = locate_type(cursor, tuple(comps), inventory)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/bryan/anaconda/envs/dev-311/lib/python3.11/site-packages/sphinx_codeautolink/extension/resolve.py", line 92, in locate_type
for val in previous.value.mro():
^^^^^^^^^^^^^^^^^^^^
TypeError: unbound method type.mro() needs an argument
The proximate cause turns out to be that previous.value
is builtins.type
at this point:
(Pdb) previous
Cursor(location='builtins.type', value=<class 'type'>, instance=False)
Bokeh is a cross-runtime library and uses a fair amount of meta-programming to automate management of that complexity. That might be why this unexpected values ends up here.
Expected behavior
Completed successful build
Steps to reproduce
I am a maintainer for Bokeh and encountered this while building the Bokeh docs. I am afraid I have not been able to isolate a simpler MRE. Dev guide for building Bokeh docs is here:
https://docs.bokeh.org/en/latest/docs/dev_guide/documentation.html#setting-up-and-building-bokeh-s-documentation
environment:
pydata-sphinx-theme 0.9.0 pypi_0 pypi
sphinx 5.3.0 pypi_0 pypi
sphinx-codeautolink 0.12.1 pypi_0 pypi
sphinx-copybutton 0.5.0 pypi_0 pypi
sphinx-design 0.3.0 pypi_0 pypi
sphinxcontrib-applehelp 1.0.2 pypi_0 pypi
sphinxcontrib-devhelp 1.0.2 pypi_0 pypi
sphinxcontrib-htmlhelp 2.0.0 pypi_0 pypi
sphinxcontrib-jsmath 1.0.1 pypi_0 pypi
sphinxcontrib-qthelp 1.0.3 pypi_0 pypi
sphinxcontrib-serializinghtml 1.1.5 pypi_0 pypi
sphinxext-opengraph 0.7.2 pypi_0 pypi
Patch?
Changing the condition in resolve.py
to exclude type
allows the build to complete "successfully":
if isclass(previous.value) and previous.value is not type and cursor.location not in inventory:
however then there are hundreds of other warnings, so this does not seem like a complete solution:
.. autolink-examples:: bokeh.plotting.figure.ref :collapse:.
None:4:<autosummary>:1: ERROR: Error in "autolink-examples" directive:
maximum 1 argument(s) allowed, 2 supplied.
.. autolink-examples:: bokeh.plotting.figure.plot :collapse:.
None:4:<autosummary>:1: ERROR: Error in "autolink-examples" directive:
maximum 1 argument(s) allowed, 2 supplied.
.. autolink-examples:: bokeh.plotting.figure.coordinates :collapse:.
/Users/bryan/work/bokeh/src/bokeh/plotting/_figure.py:docstring of bokeh.plotting._figure.figure:1: WARNING: Explicit markup ends without a blank line; unexpected unindent.
Without auto-link extension the doc build is 100% warning clean.
bug