From 9befb6c03cd648d88bbdd210d03d46f780e9301e Mon Sep 17 00:00:00 2001 From: Chris Holdgraf Date: Wed, 23 Feb 2022 13:39:27 -0800 Subject: [PATCH] Use ReadTheDocs variable for version match --- docs/conf.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 2a4fe3bdc..f4d416c23 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,8 +24,6 @@ import pydata_sphinx_theme -release = pydata_sphinx_theme.__version__ -version = release.replace("dev0", "") # -- General configuration --------------------------------------------------- @@ -80,10 +78,17 @@ html_theme = "pydata_sphinx_theme" # html_logo = "_static/pandas.svg" # For testing -if "dev" in release: - version_match = "dev" +# Define the version we use for matching in the version switcher. +if os.environ.get("READTHEDOCS_VERSION"): + # If we detect a READTHEDOCS version, just use this. + version_match = os.environ.get("READTHEDOCS_VERSION") else: - version_match = "v" + release + # For local development, infer the version to match from the package. + release = pydata_sphinx_theme.__version__ + if "dev" in release: + version_match = "latest" + else: + version_match = "v" + release html_theme_options = { "external_links": [