From b94c5c259bbae6c9b2ae088047fd75f4207fd723 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 6 Sep 2023 22:45:00 +0400 Subject: [PATCH 1/2] Fix Read the Docs build --- .readthedocs.yaml | 16 ++++++++++++++++ docs/conf.py | 9 +++------ noxfile.py | 4 ++-- setup.py | 5 +++-- 4 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 000000000..2302702f3 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,16 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3" + +python: + install: + - method: pip + path: . + extra_requirements: + - develop + +sphinx: + fail_on_warning: true diff --git a/docs/conf.py b/docs/conf.py index c3513936f..211ba5029 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -116,13 +116,10 @@ # 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" +import sphinx_rtd_theme -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 diff --git a/noxfile.py b/noxfile.py index 8017b39bc..5a5880522 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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") diff --git a/setup.py b/setup.py index 9dc52a2e0..517ad5546 100644 --- a/setup.py +++ b/setup.py @@ -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( From bd7621ca5c0cd55c45a229451ea43adea9ff8a70 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 6 Sep 2023 22:52:39 +0400 Subject: [PATCH 2/2] Fix lint --- docs/conf.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 211ba5029..c770dd805 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -28,7 +28,8 @@ # serve to show the default. import datetime -import os + +import sphinx_rtd_theme import elasticsearch_dsl @@ -116,8 +117,6 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -import sphinx_rtd_theme - html_theme = "sphinx_rtd_theme" html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]