Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

DOC Sphinx global var style removed in Sphinx 7.0.0 #26599

Copy link
Copy link
Closed
@lucyleeow

Description

@lucyleeow
Issue body actions

Describe the issue linked to the documentation

Following the doc contribution guide to build docs, the latest Sphinx version (7.0.1) is installed but upon build the following error occurs:

Error message
Traceback (most recent call last):
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/builders/html/__init__.py", line 1093, in handle_page
    output = self.templates.render(templatename, ctx)
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/jinja2glue.py", line 196, in render
    return self.environment.get_template(template).render(context)
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/themes/basic/page.html", line 10, in top-level template code
    {%- extends "layout.html" %}
  File "/home/<usr>/Documents/scikit-learn/doc/themes/scikit-learn-modern/layout.html", line 36, in top-level template code
    <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/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/cmd/build.py", line 285, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/application.py", line 351, in build
    self.builder.build_update()
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 294, in build_update
    self.build(to_build,
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 361, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 566, in write
    self._write_parallel(sorted(docnames),
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 593, in _write_parallel
    self.write_doc(firstname, doctree)
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/builders/html/__init__.py", line 667, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/home/<usr>/miniconda3/envs/sklearn-env/lib/python3.9/site-packages/sphinx/builders/html/__init__.py", line 1100, 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 about.
Reason: UndefinedError("'style' is undefined")

It seems read the docs has the same error: readthedocs/readthedocs.org#10279

There is a PR to fix: readthedocs/sphinx_rtd_theme#1464

Can't quite tell how this fixes the problem, note the stylesheet section of their 'layout.html' is guarded by version conditional, see: readthedocs/sphinx_rtd_theme#1464 (comment)

Suggest a potential alternative/fix

🤔

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.