Skip to content

Commit

Permalink
Fix Read the Docs build (#1668)
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin committed Sep 7, 2023
1 parent d437a4d commit 9c9eee6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
12 changes: 5 additions & 7 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"

sphinx:
configuration: docs/conf.py
python: "3"

python:
install:
- method: pip
path: .
extra_requirements:
- docs
- method: pip
path: sphinx-rtd-theme
- develop

sphinx:
fail_on_warning: true
12 changes: 4 additions & 8 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
# serve to show the default.

import datetime
import os

import sphinx_rtd_theme

import elasticsearch_dsl

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

on_rtd = os.environ.get("READTHEDOCS", None) == "True"

if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme

html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
html_theme = "sphinx_rtd_theme"
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
4 changes: 2 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ def lint(session):

@nox.session()
def docs(session):
session.install(".[develop]", "sphinx-rtd-theme")
session.install(".[develop]")

session.run("sphinx-build", "docs/", "docs/_build", "-b", "html")
session.run("sphinx-build", "docs/", "docs/_build", "-b", "html", "-W")
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@
"pytest-mock",
"pytz",
"coverage",
"sphinx",
"sphinx_rtd_theme",
# Override Read the Docs default (sphinx<2 and sphinx-rtd-theme<0.5)
"sphinx>2",
"sphinx-rtd-theme>0.5",
]

setup(
Expand Down

0 comments on commit 9c9eee6

Please sign in to comment.