Skip to content

Commit c47758c

Browse files
A5rocksjakkdl
andauthored
Handle RTD enabling addons (#3103)
* Handle RTD enabling addons * Remove unnecessary theme call * Update docs/source/conf.py Co-authored-by: John Litborn <11260241+jakkdl@users.noreply.github.com> --------- Co-authored-by: John Litborn <11260241+jakkdl@users.noreply.github.com>
1 parent feb74a7 commit c47758c

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

docs-requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
sphinx >= 6.0
44
jinja2
55
# >= is necessary to prevent `uv` from selecting a `Sphinx` version this does not support
6-
sphinx_rtd_theme >= 2
6+
sphinx_rtd_theme >= 3
77
sphinxcontrib-jquery
88
sphinxcontrib-trio
99
towncrier

docs-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ sphinx-codeautolink==0.15.2
7979
# via -r docs-requirements.in
8080
sphinx-hoverxref==1.4.1
8181
# via -r docs-requirements.in
82-
sphinx-rtd-theme==2.0.0
82+
sphinx-rtd-theme==3.0.0
8383
# via -r docs-requirements.in
8484
sphinxcontrib-applehelp==2.0.0
8585
# via sphinx

docs/source/conf.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ def setup(app: Sphinx) -> None:
201201
app.connect("source-read", on_read_source)
202202

203203

204+
# Our docs use the READTHEDOCS variable, so copied from:
205+
# https://about.readthedocs.com/blog/2024/07/addons-by-default/
206+
if os.environ.get("READTHEDOCS", "") == "True":
207+
if "html_context" not in globals():
208+
html_context = {}
209+
html_context["READTHEDOCS"] = True
210+
204211
# -- General configuration ------------------------------------------------
205212

206213
# If your documentation needs a minimal Sphinx version, state it here.
@@ -374,10 +381,7 @@ def add_mapping(
374381
# We have to set this ourselves, not only because it's useful for local
375382
# testing, but also because if we don't then RTD will throw away our
376383
# html_theme_options.
377-
import sphinx_rtd_theme
378-
379384
html_theme = "sphinx_rtd_theme"
380-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
381385

382386
# Theme options are theme-specific and customize the look and feel of a theme
383387
# further. For a list of options available for each theme, see the

0 commit comments

Comments
 (0)