Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many themes fail with 'style' is undefined since Sphinx 7.0.0's release #156

Closed
vwheeler63 opened this issue Sep 5, 2024 · 3 comments
Closed

Comments

@vwheeler63
Copy link

vwheeler63 commented Sep 5, 2024

Hello. As I write this it is about 21:00 GMT (15:00 Mountain Daylight Time). About 24-28 hours ago, all of the themes at https://sphinx-themes.org were displaying correctly. However, today I went to look at the list more thoroughly to build some documentation about them for potential future use, and quite a few of them are not displaying correctly. I captured the exception message on attempting to display the hachibee theme. It is below. I hope this is both helpful and timely. Hopefully whatever is causing this one not to display is in common with the others. Probably 50-60% of them WERE displaying correctly.

======================================== stderr ========================================
/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/urllib/parse.py:docstring of urllib.parse.quote:13: ERROR: Unexpected indentation. [docutils]
/home/runner/work/sphinx-themes.org/sphinx-themes.org/sample-docs/kitchen-sink/blocks.rst:138: WARNING: Include file '/home/runner/work/sphinx-themes.org/src/furo/__init__.py' not found or reading it failed [docutils]
/home/runner/work/sphinx-themes.org/sphinx-themes.org/sample-docs/kitchen-sink/lists.rst:202: WARNING: Include file '/home/runner/work/sphinx-themes.org/src/furo/__init__.py' not found or reading it failed [docutils]

Traceback (most recent call last):
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1160, in handle_page
    output = self.templates.render(templatename, ctx)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/jinja2glue.py", line 201, in render
    return self.environment.get_template(template).render(context)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/hachibee_sphinx_theme/hachibee/page.html", line 1, in top-level template code
    {% extends "!layout.html" %}
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/hachibee_sphinx_theme/hachibee/layout.html", line 134, in top-level template code
    {{ css() }}
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/jinja2/sandbox.py", line 394, in call
    return __context.call(__obj, *args, **kwargs)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/jinja2/runtime.py", line 782, in _invoke
    rv = self._func(*arguments)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/hachibee_sphinx_theme/hachibee/layout.html", line 95, in template
    <link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
jinja2.exceptions.UndefinedError: 'style' is undefined

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

Traceback (most recent call last):
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/cmd/build.py", line 337, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/application.py", line 378, in build
    self.builder.build_update()
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 296, in build_update
    self.build(to_build,
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 366, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 613, in write
    self._write_serial(sorted(docnames))
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 623, in _write_serial
    self.write_doc(docname, doctree)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 675, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/home/runner/work/sphinx-themes.org/sphinx-themes.org/build/hachibee-sphinx-theme/lib/python3.10/site-packages/sphinx/builders/html/__init__.py", line 1167, 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 index.
Reason: UndefinedError("'style' is undefined")

Theme error:
An error happened in rendering the page index.
Reason: UndefinedError("'style' is undefined")

Kind regards,
Vic

@pradyunsg
Copy link
Collaborator

The issue is that those themes are not compatible with the latest version of Sphinx and, fundamentally, pip install <that theme package> will result in a failing build with that exact message.

This is not a problem with this site but rather a problem with those projects.

@pradyunsg pradyunsg changed the title About 40% of Sphinx Themes Are Broken at https://sphinx-themes.org Lots of themes fail with 'style' is undefined since Sphinx 7.0.0's release Sep 5, 2024
@pradyunsg
Copy link
Collaborator

I'm gonna go ahead and close this as something that we can't really fix, but I'll also pin this for visibility for the next person who comes wondering about this.

@pradyunsg pradyunsg closed this as not planned Won't fix, can't repro, duplicate, stale Sep 5, 2024
@pradyunsg pradyunsg pinned this issue Sep 5, 2024
@pradyunsg pradyunsg changed the title Lots of themes fail with 'style' is undefined since Sphinx 7.0.0's release Many themes fail with 'style' is undefined since Sphinx 7.0.0's release Sep 5, 2024
@vwheeler63
Copy link
Author

vwheeler63 commented Sep 6, 2024

This is not a problem with this site but rather a problem with those projects.

Ah! Thanks for the clarification! Hopefully the authors will fix them in a hurry! :-)

Also thank you for making the title more accurate. I just realized I could see "Build Failed" in the high-level theme display, and I re-computed my 40% -- should have been 23.5%. 12 out of 51. :-) Anyway you fixed it.

And by the way, https://sphinx-themes.org/ is a brilliant display, especially the Kitchen Sink page groups -- very nice way for people to "shop" before they install.... It must have taken a lot of work to put that together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants