From 20bd99f6910e9a1f8204c05261534f9da23384d8 Mon Sep 17 00:00:00 2001 From: Bryon Tjanaka <38124174+btjanaka@users.noreply.github.com> Date: Tue, 16 Jul 2024 20:03:39 -0700 Subject: [PATCH] Fix documentation conf for readthedocs deprecations (#485) ## Description See https://about.readthedocs.com/blog/2024/07/addons-by-default/ ## Status - [x] I have read the guidelines in [CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md) - [x] I have formatted my code using `yapf` - [x] I have tested my code by running `pytest` - [x] I have linted my code with `pylint` - [x] I have added a one-line description of my change to the changelog in `HISTORY.md` - [x] This PR is ready to go --- HISTORY.md | 1 + docs/conf.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index 4d67ba325..c74fb7b1f 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -20,6 +20,7 @@ #### Documentation +- Fix documentation conf for readthedocs deprecations ({pr}`485`) - Add novelty search with CMA-ES to sphere example ({pr}`478`, {pr}`482`) #### Improvements diff --git a/docs/conf.py b/docs/conf.py index e1d9b6570..3a1fbcf9f 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,6 +29,9 @@ sys.path.insert(0, os.path.abspath("..")) # Detect ribs. sys.path.append(os.path.abspath("./_ext")) # Detect extensions. +# Set canonical URL from the Read the Docs Domain +html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") + DEV_MODE = os.environ.get("DOCS_MODE", "regular") == "dev" READTHEDOCS_VERSION = os.environ.get("READTHEDOCS_VERSION", "stable") READTHEDOCS_LANGUAGE = os.environ.get("READTHEDOCS_LANGUAGE", "en") @@ -136,6 +139,10 @@ html_title = (f"pyribs (stable - v{version})" if READTHEDOCS_VERSION == "stable" else f"pyribs ({READTHEDOCS_VERSION})") +# Tell Jinja2 templates the build is running on Read the Docs +if os.environ.get("READTHEDOCS", "") == "True": + html_context["READTHEDOCS"] = True + # material theme options (see theme.conf for more information) html_theme_options = { "nav_title": "pyribs",