Skip to content

[Docs] Switch documentation theme to sphinx-book-theme#19862

Open
spectrometerHBH wants to merge 1 commit into
apache:mainfrom
spectrometerHBH:tirx-docs-book-theme
Open

[Docs] Switch documentation theme to sphinx-book-theme#19862
spectrometerHBH wants to merge 1 commit into
apache:mainfrom
spectrometerHBH:tirx-docs-book-theme

Conversation

@spectrometerHBH

Copy link
Copy Markdown
Contributor

Switches the documentation theme from sphinx_rtd_theme to sphinx-book-theme
(already installed in the CI image via docker/install/ubuntu_install_sphinx.sh,
added in #19835).

  • html_theme default → sphinx_book_theme; TVM_THEME=rtd still selects RTD.
  • Book-theme html_theme_options (repo buttons, nav/toc depth); RTD keeps logo_only.
  • The tlcpack-sphinx-addon template/static overrides assume the RTD layout, so they
    are now applied only when the RTD theme is active.
  • Small _static/css/tirx_theme.css (dark-mode logo backing) loaded for the book theme.

Opening to verify the docs build/check_sphinx_warnings pass on the book theme.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the default documentation theme from 'rtd' to 'sphinx_book_theme', adding specific configuration options and a custom CSS file (tirx_theme.css) to ensure the TVM logo displays correctly in dark mode. Additionally, the application of tlcpack_sphinx_addon overrides is restricted to RTD themes. The reviewer identified a potential issue where checking only for 'sphinx_rtd_theme' might miss cases where the theme is set to 'rtd' on Read the Docs, and suggested checking for both values to ensure the overrides are correctly applied.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread docs/conf.py
# add additional overrides. The tlcpack templates override layout.html for the
# RTD theme (and assume its header/footer html_context); only apply them when the
# RTD theme is active so they don't clobber another theme's own layout.
if html_theme == "sphinx_rtd_theme":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

On Read the Docs (on_rtd = True), if TVM_THEME is set to "rtd", html_theme remains "rtd" because the local normalization block on line 361 does not execute. Checking only html_theme == "sphinx_rtd_theme" will evaluate to False in this case, preventing the tlcpack_sphinx_addon templates and static overrides from being applied. We should check for both "sphinx_rtd_theme" and "rtd" to ensure correctness.

Suggested change
if html_theme == "sphinx_rtd_theme":
if html_theme in ("sphinx_rtd_theme", "rtd"):

@spectrometerHBH spectrometerHBH force-pushed the tirx-docs-book-theme branch 5 times, most recently from 19cfd49 to ec3f985 Compare June 22, 2026 07:11
- docs/conf.py: default html_theme -> sphinx-book-theme (book-theme options;
  tlcpack layout overrides scoped to the RTD theme); docs/_static/css/tirx_theme.css
  for the dark-mode logo backing.
- tests/scripts/task_python_docs.sh: install sphinx-book-theme==1.1.4 at docs-build
  time. It is already declared in docker/install/ubuntu_install_sphinx.sh, but the
  currently-published ci-gpu image predates that dependency, so install it in the
  docs job until the CI image is refreshed.

sphinx-book-theme 1.1.4 builds cleanly under Sphinx 8.1.3.
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

Successfully merging this pull request may close these issues.

1 participant