diff --git a/docs/.gitignore b/docs/.gitignore index d842403086..5c0b35828a 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -1,2 +1,3 @@ _build -api/ \ No newline at end of file +api/ +_static/fig/ diff --git a/docs/_templates/brand.html b/docs/_templates/brand.html deleted file mode 100644 index fe6efe31a4..0000000000 --- a/docs/_templates/brand.html +++ /dev/null @@ -1,19 +0,0 @@ - diff --git a/docs/_templates/page.html b/docs/_templates/page.html deleted file mode 100644 index 8e105f7efd..0000000000 --- a/docs/_templates/page.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "!page.html" %} -{% block body %} -{% if versions and versions.current_version != versions.stable_version %} -
- -
-{% endif %} -{{ super() }} -{% endblock %}% diff --git a/docs/conf.py b/docs/conf.py index c7a48ffd0d..20975fe68d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,7 +12,6 @@ import sys from pkg_resources import get_distribution, parse_version -from sphinx_simpleversion import get_current_branch from sphinx.util.logging import getLogger sys.path.insert(0, os.path.abspath("_gen_figures")) @@ -23,6 +22,7 @@ current_release = parse_version(get_distribution("wildboar").version) release = current_release.public version = f"{current_release.major}.{current_release.minor}.{current_release.micro}" +major_version = f"{current_release.major}.{current_release.minor}" # -- Project information ----------------------------------------------------- @@ -31,6 +31,16 @@ copyright = "2023, Isak Samsten" author = "Isak Samsten" + +def get_current_branch(): + return ( + subprocess.run("git branch --show-current", stdout=subprocess.PIPE, shell=True) + .stdout.decode() + .strip() + ) + + +current_branch_name = get_current_branch() # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be @@ -92,20 +102,24 @@ "inherited-members", ] -html_theme = "furo" +html_theme = "pydata_sphinx_theme" html_theme_options = { - "light_logo": "logo.png", - "dark_logo": "logo.png", + "logo": { + "text": "Wildboar", + "image_light": "logo.png", + "image_dark": "logo.png", + }, + "show_version_warning_banner": True, + "navbar_start": ["navbar-logo", "version-switcher"], + "switcher": { + "json_url": "https://wildboar.dev/_versions.json", + "version_match": "dev" if current_branch_name == "master" else major_version, + }, + "check_switcher": False, } -html_sidebars = { - "**": [ - "sidebar/scroll-start.html", - "brand.html", - "sidebar/search.html", - "sidebar/navigation.html", - "versions.html", - "sidebar/scroll-end.html", - ], + +html_context = { + "default_mode": "auto", } html_static_path = ["_static"] @@ -113,7 +127,6 @@ "css/custom.css", "css/pygments-override.css", ] -current_branch_name = get_current_branch() rst_prolog = """ .. role:: python(code) diff --git a/docs/requirements.txt b/docs/requirements.txt index 29bd05f379..663b4ce009 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ accessible-pygments>=0.0.4 -furo>=2023.9.10 +pydata-sphinx-theme>=0.15.2 matplotlib>=3.6.0 numpydoc>=1.5.0 sphinx>=6.2.0 @@ -8,6 +8,5 @@ sphinx-copybutton>=0.5.0 sphinx-design>=0.5.0 sphinx-inline-tabs>=2023.4.21 sphinx-toggleprompt>=0.4.0 -sphinx_simpleversion @ git+https://github.com/isaksamsten/sphinx_simpleversion.git@main nbsphinx>=0.9.0 jupyter>=1.0.0