Skip to content

Commit 29ca74d

Browse files
authored
Fix Read the Docs build (#1668)
1 parent 56832d8 commit 29ca74d

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

.readthedocs.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
3+
build:
4+
os: ubuntu-22.04
5+
tools:
6+
python: "3"
7+
8+
python:
9+
install:
10+
- method: pip
11+
path: .
12+
extra_requirements:
13+
- develop
14+
15+
sphinx:
16+
fail_on_warning: true

docs/conf.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
# serve to show the default.
2929

3030
import datetime
31-
import os
31+
32+
import sphinx_rtd_theme
3233

3334
import elasticsearch_dsl
3435

@@ -116,13 +117,8 @@
116117
# The theme to use for HTML and HTML Help pages. See the documentation for
117118
# a list of builtin themes.
118119

119-
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
120-
121-
if not on_rtd: # only import and set the theme if we're building docs locally
122-
import sphinx_rtd_theme
123-
124-
html_theme = "sphinx_rtd_theme"
125-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
120+
html_theme = "sphinx_rtd_theme"
121+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
126122

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

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ def lint(session):
7373

7474
@nox.session()
7575
def docs(session):
76-
session.install(".[develop]", "sphinx-rtd-theme")
76+
session.install(".[develop]")
7777

78-
session.run("sphinx-build", "docs/", "docs/_build", "-b", "html")
78+
session.run("sphinx-build", "docs/", "docs/_build", "-b", "html", "-W")

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
"pytest-mock",
3939
"pytz",
4040
"coverage",
41-
"sphinx",
42-
"sphinx_rtd_theme",
41+
# Override Read the Docs default (sphinx<2 and sphinx-rtd-theme<0.5)
42+
"sphinx>2",
43+
"sphinx-rtd-theme>0.5",
4344
]
4445

4546
setup(

0 commit comments

Comments
 (0)