Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions python/doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,17 @@ def setup(app):

html_theme = "pydata_sphinx_theme"

# FIXME: Implement a version switch like NumPy.
# Set up the version switcher. The versions.json is stored in the doc repo.
# if os.environ.get('CIRCLE_JOB', False) and \
# os.environ.get('CIRCLE_BRANCH', '') != 'main':
# # For PR, name is set to its ref
# switcher_version = os.environ['CIRCLE_BRANCH']
# elif ".9999" in version:
# switcher_version = "devdocs"
# else:
# switcher_version = f"{version}"
# Use the version switcher metadata maintained in the gh-pages branch.
# Pull request builds use the PR ref so preview pages are not labelled as a
# released version.
if os.environ.get("GITHUB_ACTIONS") and os.environ.get("GITHUB_HEAD_REF"):
switcher_version = os.environ["GITHUB_HEAD_REF"]
elif ".dev" in version:
switcher_version = "dev"
else:
switcher_version = version

switcher_json_url = f"{html_site_root}versions.json"

html_theme_options = {
"collapse_navigation": True,
Expand All @@ -169,8 +170,7 @@ def setup(app):
},
"navbar_align": "content",
# Add light/dark mode and documentation version switcher:
# "navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"],
"navbar_end": ["theme-switcher", "navbar-icon-links"],
"navbar_end": ["theme-switcher", "version-switcher", "navbar-icon-links"],
"navbar_start": ["navbar-logo"],
"navigation_with_keys": False,
# https://sphinx-gallery.github.io/stable/advanced.html#using-sphinx-gallery-sidebar-components
Expand All @@ -180,6 +180,10 @@ def setup(app):
"sg_launcher_links",
],
"show_prev_next": True,
"switcher": {
"json_url": switcher_json_url,
"version_match": switcher_version,
},
"show_toc_level": 2, # On this page sidebar
"sidebar_includehidden": True,
"use_edit_page_button": True,
Expand Down