seaborn
seaborn copied to clipboard
Doc build failing with sphinx 6
Going to pin the doc dependencies for now but will need to look into this...
Traceback (most recent call last):
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1100, in handle_page
output = self.templates.render(templatename, ctx)
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/jinja2glue.py", line 196, in render
return self.environment.get_template(template).render(context)
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/themes/basic/page.html", line 10, in top-level template code
{%- extends "layout.html" %}
File "/Users/mwaskom/code/seaborn/doc/_templates/layout.html", line 1, in top-level template code
{% extends "!layout.html" %}
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html", line 25, in top-level template code
{% set remove_sidebar_secondary = (meta is defined and meta is not none
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/themes/basic/../basic/layout.html", line 170, in top-level template code
{%- block content %}
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html", line 75, in block 'content'
{% block docs_navbar %}
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/layout.html", line 77, in block 'docs_navbar'
{%- include "sections/header.html" %}
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/sections/header.html", line 7, in top-level template code
{% include navbar_item %}
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/pydata_sphinx_theme/theme/pydata_sphinx_theme/components/navbar-logo.html", line 15, in top-level template code
{% set image_light = image_light if image_light.startswith("http") else pathto('_static/' + image_light, 1) %}
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/jinja2/sandbox.py", line 326, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'logo' is undefined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/cmd/build.py", line 284, in build_main
app.build(args.force_all, args.filenames)
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/application.py", line 347, in build
self.builder.build_update()
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 311, in build_update
self.build(to_build,
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 377, in build
self.write(docnames, list(updated_docnames), method)
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 579, in write
self._write_serial(sorted(docnames))
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 589, in _write_serial
self.write_doc(docname, doctree)
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 677, in write_doc
self.handle_page(docname, ctx, event_arg=doctree)
File "/Users/mwaskom/miniconda/envs/py310/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1107, in handle_page
raise ThemeError(__("An error happened in rendering the page %s.\nReason: %r") %
sphinx.errors.ThemeError: An error happened in rendering the page api.
Reason: UndefinedError("'logo' is undefined")
Theme error:
An error happened in rendering the page api.
Reason: UndefinedError("'logo' is undefined")
I looked into this. The error stems from incompatibility between the pinned version of pydata_sphinx_theme (0.10.0rc2) and sphinx6 and is described here. If an update to the pinned theme version is considered, updating to pydata_sphinx_theme to 0.13.0 and above solves this. Another option suggested in the linked issue is to add a "logo" entry to the sphinx configuration file, and it works as well:
html_theme_options = {
"logo": {
"image_light": "logo-wide-lightbg.png",
"image_dark": "logo-wide-darkbg.png",
}