Skip to content

Commit c9992c9

Browse files
committed
Changed import condition of Sphinx theme to satisfy readthedocs
1 parent f1a26c5 commit c9992c9

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

docs/conf.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@
1414

1515
import sys
1616
import os
17-
import sphinx_rtd_theme
17+
18+
# on_rtd is whether we are on readthedocs.org, this line of code grabbed
19+
# from docs.readthedocs.org
20+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
21+
22+
if not on_rtd: # only import and set the theme if we're building docs locally
23+
import sphinx_rtd_theme
24+
html_theme = 'sphinx_rtd_theme'
25+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
26+
27+
# otherwise, readthedocs.org uses their theme by default, so no need to
28+
# specify it
1829

1930
sys.path = [os.path.abspath("..")] + sys.path
2031
from stdlib_list import __version__
@@ -105,9 +116,7 @@
105116

106117
# The theme to use for HTML and HTML Help pages. See the documentation for
107118
# a list of builtin themes.
108-
html_theme = "sphinx_rtd_theme"
109-
110-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
119+
# html_theme = "default"
111120

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

0 commit comments

Comments
 (0)