diff --git a/docs/_static/switcher.json b/docs/_static/switcher.json index 90a58e18b..7ecf5aab3 100644 --- a/docs/_static/switcher.json +++ b/docs/_static/switcher.json @@ -1,51 +1,36 @@ [ { - "name": "v0.7.1 (stable)", - "version": "0.7.1" + "name": "dev", + "version": "latest", + "extra_classes": ["dev"] }, { - "version": "0.7.0" + "name": "0.8.0 (stable)", + "version": "stable", + "extra_classes": ["stable"] }, { - "version": "0.6.3" + "name": "0.8.0", + "version": "v0.8.0" }, { - "version": "0.6.2" + "name": "0.7.2", + "version": "v0.7.2" }, { - "version": "0.6.1" + "name": "0.6.3", + "version": "v0.6.3" }, { - "version": "0.6.0" + "name": "0.5.2", + "version": "v0.5.2" }, { - "version": "0.5.2" + "name": "0.4.3", + "version": "v0.4.3" }, { - "version": "0.5.1" - }, - { - "version": "0.5.0" - }, - { - "version": "0.4.3" - }, - { - "version": "0.4.2" - }, - { - "version": "0.4.1" - }, - { - "version": "0.4.0" - }, - { - "version": "0.3.2" - }, - { - "version": "0.3.1" - }, - { - "version": "0.3.0" + "name": "0.3.2", + "version": "v0.3.2" } ] diff --git a/docs/conf.py b/docs/conf.py index 59a60d849..87ac521c2 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,6 +78,18 @@ html_theme = "pydata_sphinx_theme" # html_logo = "_static/pandas.svg" # For testing +# Define the version we use for matching in the version switcher. +version_match = os.environ.get("READTHEDOCS_VERSION") +# If READTHEDOCS_VERSION doesn't exist, we're not on RTD +# If it is an integer, we're in a PR build and the version isn't correct. +if not version_match or version_match.isdigit(): + # 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": [ { @@ -116,8 +126,8 @@ "switcher": { # "json_url": "/_static/switcher.json", "json_url": "https://pydata-sphinx-theme.readthedocs.io/en/latest/_static/switcher.json", - "url_template": "https://pydata-sphinx-theme.readthedocs.io/en/v{version}/", - "version_match": version, + "url_template": "https://pydata-sphinx-theme.readthedocs.io/en/{version}/", + "version_match": version_match, }, } diff --git a/src/pydata_sphinx_theme/__init__.py b/src/pydata_sphinx_theme/__init__.py index 639e591a7..c194ede6c 100644 --- a/src/pydata_sphinx_theme/__init__.py +++ b/src/pydata_sphinx_theme/__init__.py @@ -13,7 +13,7 @@ from .bootstrap_html_translator import BootstrapHTML5Translator -__version__ = "0.8.0" +__version__ = "0.9.0.dev0" logger = logging.getLogger(__name__)