pydata / pydata-sphinx-theme

A clean, three-column Sphinx theme with Bootstrap for the PyData community
https://pydata-sphinx-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
618 stars 321 forks source link

Error when building docs: 'dict object' has no attribute 'image_relative' #1392

Open Seniatical opened 1 year ago

Seniatical commented 1 year ago

After updating to the latest version, i've been getting a new error which I cannot seem to resolve.

Traceback

Traceback (most recent call last):
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\sphinx\events.py", line 96, in emit
    results.append(listener.handler(self.app, *args))
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\pydata_sphinx_theme\__init__.py", line 223, in update_and_remove_templates
    context[section] = list(filter(_remove_empty_templates, context[section]))
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\pydata_sphinx_theme\__init__.py", line 218, in _remove_empty_templates
    rendered = app.builder.templates.render(tname, context)
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\sphinx\jinja2glue.py", line 196, in render
    return self.environment.get_template(template).render(context)
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\jinja2\environment.py", line 1304, in render
    self.environment.handle_exception()
  File "c:\users\isa\appdata\local\programs\python\python39\lib\site-packages\jinja2\environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "C:\Users\Isa\AppData\Local\Programs\Python\Python39\Lib\site-packages\pydata_sphinx_theme\theme\pydata_sphinx_theme\components\navbar-logo.html", line 13, in top-level template code
    {% set is_logo = "light" in theme_logo["image_relative"] %}
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'image_relative'

The above exception was the direct cause of the following exception: ...

Extension error (pydata_sphinx_theme):
Handler <function update_and_remove_templates at 0x000001CA9046AEE0> for event 'html-page-context' threw an exception (exception: 'dict object' has no attribute 'image_relative')

Pydata Sphinx Theme Version

Sphinx Version

Python Version

mlange-42 commented 1 year ago

Getting the same error, using Pydata Sphinx Theme v0.13.0 and Sphinx v6.1.3

12rambau commented 1 year ago

@Seniatical , For the first issue I think the problem is coming from the Version 7 of Sphinx. this has been solved since then in main but I would suggest to pin version of Sphinx for the time being.

@mlange-42, Could you update your version to the latest one (0.13.4) I remember working on this issue some time ago, it should be available now.

mlange-42 commented 1 year ago

v0.13.4 is not available via pip, and the repo also has no such tag. Installing from the main branch of the repo does not solve the issue.

12rambau commented 1 year ago

my bad it's 0.13.3 but if you still face it with main it's an issue.

Would you mind sharing your conf.py ?

12rambau commented 1 year ago

I've just release v0.14.0 you can give it a try but I guess it won't change anything from your side as you already checked with main. Would you minde sharing your conf.py so I see what parameter you use ? or even better the repository you are working with so I can make a fork for testing purposes.

adam-grant-hendry commented 1 year ago

I have this error with pydata_sphinx_theme==0.14.1, but I am unsure if this is due to sphinx-multiversion or pydata_sphinx_theme. Link to the full error, including system info and MRE here.

12rambau commented 1 year ago

@adam-grant-hendry your error seems to be related to sphinx-multiversion only. you should try to run the call that is raising the rror to get a more meaningful traceback.

This issue is only focusing on the management of the image_relative that seems broken for some of our users.