Closed adam-grant-hendry closed 5 months ago
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
Describe the bug
As noted in:
pydata-sphinx-theme
: Puttingversion-switcher
in Primary Sidebar results in Extension Error #1511utilizing template overrides with the
sphinx-book-theme
results in the error:The root cause was identified as PR #691, which reverted the following changes to
__init__.py
in PR #566:app.connect("config-inited", update_general_config)
changed toapp.connect("builder-inited", update_general_config)
update_general_config
parameterconfig
removed (config-inited
events issue two parameters)The
Sphinx
class (fromsphinx-docs
) callsconfig.init_values()
after thesphinx-book-theme
extension is loaded, causingtemplates_path
to be overridden and the path tosphinx_book_theme/theme/sphinx_book_theme/components
lost.Reproduce the bug
sphinx-book-theme
add add it toconf.py
extensions
sphinx-build -b html src build
Results in the following (see also
pydata-sphinx-theme
Issue #1511):traceback:
Traceback (most recent call last): File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\events.py", line 96, in emit results.append(listener.handler(self.app, *args)) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\pydata_sphinx_theme\__init__.py", line 224, in update_and_remove_templates context[section] = list(filter(_remove_empty_templates, context[section])) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\pydata_sphinx_theme\__init__.py", line 219, in _remove_empty_templates rendered = app.builder.templates.render(tname, context) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\jinja2glue.py", line 196, in render return self.environment.get_template(template).render(context) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\jinja2\environment.py", line 1010, in get_template return self._load_template(name, globals) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\jinja2\environment.py", line 969, in _load_template template = self.loader.load(self, name, self.make_globals(globals)) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\jinja2\loaders.py", line 126, in load source, filename, uptodate = self.get_source(environment, name) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\jinja2glue.py", line 217, in get_source raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: toggle-primary-sidebar.html The above exception was the direct cause of the following exception: Traceback (most recent call last): File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\cmd\build.py", line 285, in build_main app.build(args.force_all, args.filenames) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\application.py", line 353, in build self.builder.build_update() File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\builders\__init__.py", line 311, in build_update self.build(to_build, File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\builders\__init__.py", line 378, in build self.write(docnames, list(updated_docnames), method) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\builders\__init__.py", line 586, in write self._write_serial(sorted(docnames)) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\builders\__init__.py", line 596, in _write_serial self.write_doc(docname, doctree) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\builders\html\__init__.py", line 672, in write_doc self.handle_page(docname, ctx, event_arg=doctree) File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\builders\html\__init__.py", line 1076, in handle_page newtmpl = self.app.emit_firstresult('html-page-context', pagename, File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\application.py", line 481, in emit_firstresult return self.events.emit_firstresult(event, *args, File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\events.py", line 117, in emit_firstresult for result in self.emit(name, *args, allowed_exceptions=allowed_exceptions): File "C:\Users\hendra11\Code\external\poetry_plugin_constrain\.venv\lib\site-packages\sphinx\events.py", line 107, in emit raise ExtensionError(__("Handler %r for event %r threw an exception") % sphinx.errors.ExtensionError: HandlerList your environment
OS:
Windows 10, 20H2
python:3.8.10
Sphinx:6.2.1
jinja2:3.1.2
sphinx-book-theme:1.0.1
pydata-sphinx-theme:0.14.1