Skip to content

Commit 2066e34

Browse files
authored
Build: do not set sphinx_rtd_theme theme automatically (#10638)
We are not installing `sphinx-rtd-theme` automatically on new projects. However, we are setting `sphinx_rtd_theme` automatically on their `docs/conf.py`. This PR removes that magic to auto-set the theme and leave the theme to what the user has defined.
1 parent d2ac8bb commit 2066e34

File tree

3 files changed

+0
-54
lines changed

3 files changed

+0
-54
lines changed

readthedocs/doc_builder/backends/sphinx.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@ def get_config_params(self):
217217
)
218218

219219
data = {
220-
"html_theme": "sphinx_rtd_theme",
221-
"html_theme_import": "sphinx_rtd_theme",
222220
"current_version": self.version.verbose_name,
223221
"project": self.project,
224222
"version": self.version,
@@ -257,9 +255,6 @@ def get_config_params(self):
257255
"docsearch_disabled": self.project.has_feature(
258256
Feature.DISABLE_SERVER_SIDE_SEARCH
259257
),
260-
"skip_html_theme_path": self.project.has_feature(
261-
Feature.SKIP_SPHINX_HTML_THEME_PATH
262-
),
263258
}
264259

265260
finalize_sphinx_context_data.send(

readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -48,48 +48,6 @@ if not 'html_static_path' in globals():
4848
if os.path.exists('_static'):
4949
html_static_path.append('_static')
5050

51-
# Add RTD Theme only if they aren't overriding it already
52-
using_rtd_theme = (
53-
(
54-
'html_theme' in globals() and
55-
html_theme in ['default'] and
56-
# Allow people to bail with a hack of having an html_style
57-
'html_style' not in globals()
58-
) or 'html_theme' not in globals()
59-
)
60-
if using_rtd_theme:
61-
html_theme = '{{ html_theme }}'
62-
html_style = None
63-
html_theme_options = {}
64-
65-
{% comment %}
66-
# Legacy behavior for html_theme_path:
67-
# It is suspected that old builds with sphinx_rtd_theme required an extra
68-
# definition of html_theme_path in order to work.
69-
# This behavior is seen documented for old releases of sphinx_rtd_theme.
70-
# An example of old instructions:
71-
# https://github.com/readthedocs/sphinx_rtd_theme/blob/abd951a9cd98851269b8b5f5e59b1b4d29b1416c/README.rst
72-
# Discussion of issue:
73-
# https://github.com/readthedocs/readthedocs.org/pull/9654
74-
#
75-
# We need to isolate the old legacy behavior because it causes Sphinx
76-
# to skip calling the theme's setup(app) so its initialization never happens.
77-
{% endcomment %}
78-
# This following legacy behavior will gradually be sliced out until its deprecated and removed.
79-
# Skipped for Sphinx 6+
80-
# Skipped by internal Feature flag SKIP_SPHINX_HTML_THEME_PATH
81-
# Skipped by all new projects since SKIP_SPHINX_HTML_THEME_PATH's introduction (jan 2023)
82-
if (
83-
using_rtd_theme
84-
and version_info < (6,0)
85-
and not {{ skip_html_theme_path|yesno:"True,False" }}
86-
):
87-
theme = importlib.import_module('{{ html_theme_import }}')
88-
if 'html_theme_path' in globals():
89-
html_theme_path.append(theme.get_html_theme_path())
90-
else:
91-
html_theme_path = [theme.get_html_theme_path()]
92-
9351
# Define websupport2_base_url and websupport2_static_url
9452
if globals().get('websupport2_base_url', False):
9553
websupport2_base_url = '{{ api_host }}/websupport'

readthedocs/projects/models.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,7 +1925,6 @@ def add_features(sender, **kwargs):
19251925

19261926
# Feature constants - this is not a exhaustive list of features, features
19271927
# may be added by other packages
1928-
SKIP_SPHINX_HTML_THEME_PATH = "skip_sphinx_html_theme_path"
19291928
MKDOCS_THEME_RTD = "mkdocs_theme_rtd"
19301929
API_LARGE_DATA = "api_large_data"
19311930
DONT_SHALLOW_CLONE = "dont_shallow_clone"
@@ -1967,12 +1966,6 @@ def add_features(sender, **kwargs):
19671966
SCALE_IN_PROTECTION = "scale_in_prtection"
19681967

19691968
FEATURES = (
1970-
(
1971-
SKIP_SPHINX_HTML_THEME_PATH,
1972-
_(
1973-
"Sphinx: Do not define html_theme_path on Sphinx < 6.0",
1974-
),
1975-
),
19761969
(
19771970
MKDOCS_THEME_RTD,
19781971
_("MkDocs: Use Read the Docs theme for MkDocs as default theme"),

0 commit comments

Comments
 (0)