Skip to content

Commit

Permalink
BUG: fix for pydata-sphinx-theme>=0.13.3 (#714)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakevdp authored Mar 31, 2023
1 parent 6601a2f commit 78bde16
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ readme = "README.md"
requires-python = ">=3.7"
dependencies = [
"sphinx>=4,<7",
"pydata-sphinx-theme>=0.13.0",
"pydata-sphinx-theme>=0.13.3",
]

license = { file = "LICENSE" }
Expand Down
8 changes: 4 additions & 4 deletions src/sphinx_book_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sphinx.application import Sphinx
from sphinx.locale import get_translation
from sphinx.util import logging
from pydata_sphinx_theme import _get_theme_options
from pydata_sphinx_theme.utils import get_theme_options_dict

from .nodes import SideNoteNode
from .header_buttons import (
Expand Down Expand Up @@ -67,7 +67,7 @@ def add_metadata_to_page(app, pagename, templatename, context, doctree):
context["translate"] = translation

# If search text hasn't been manually specified, use a shorter one here
theme_options = _get_theme_options(app)
theme_options = get_theme_options_dict(app)
if "search_bar_text" not in theme_options:
context["theme_search_bar_text"] = translation("Search") + "..."

Expand Down Expand Up @@ -122,7 +122,7 @@ def hash_html_assets(app, pagename, templatename, context, doctree):

def update_mode_thebe_config(app):
"""Update thebe configuration with SBT-specific values"""
theme_options = _get_theme_options(app)
theme_options = get_theme_options_dict(app)
if theme_options.get("launch_buttons", {}).get("thebe") is True:
# In case somebody specifies they want thebe in a launch button
# but has not activated the sphinx_thebe extension.
Expand Down Expand Up @@ -161,7 +161,7 @@ def check_deprecation_keys(app):

deprecated_config_list = ["single_page"]
for key in deprecated_config_list:
if key in _get_theme_options(app):
if key in get_theme_options_dict(app):
SPHINX_LOGGER.warning(
f"'{key}' was deprecated from version 0.3.4 onwards. See the CHANGELOG for more information: https://github.com/executablebooks/sphinx-book-theme/blob/master/CHANGELOG.md" # noqa: E501
f"[{DEFAULT_LOG_TYPE}]",
Expand Down
4 changes: 2 additions & 2 deletions src/sphinx_book_theme/_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Any
from docutils import nodes as docutil_nodes
from sphinx import addnodes as sphinx_nodes
from pydata_sphinx_theme import _get_theme_options
from pydata_sphinx_theme.utils import get_theme_options_dict
from .nodes import SideNoteNode


Expand All @@ -13,7 +13,7 @@ class HandleFootnoteTransform(SphinxPostTransform):
formats = ("html",)

def run(self, **kwargs: Any) -> None:
theme_options = _get_theme_options(self.app)
theme_options = get_theme_options_dict(self.app)
if theme_options.get("use_sidenotes", False) is False:
return None
# Cycle through footnote references, and move their content next to the
Expand Down
8 changes: 4 additions & 4 deletions src/sphinx_book_theme/header_buttons/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Generate metadata for header buttons."""
from sphinx.errors import SphinxError
from sphinx.locale import get_translation
from pydata_sphinx_theme import _config_provided_by_user, _get_theme_options
from pydata_sphinx_theme.utils import config_provided_by_user, get_theme_options_dict

from sphinx.util import logging

Expand Down Expand Up @@ -50,7 +50,7 @@ def prep_header_buttons(app, pagename, templatename, context, doctree):

def add_header_buttons(app, pagename, templatename, context, doctree):
"""Add basic and general header buttons, we'll add source/launch later."""
opts = _get_theme_options(app)
opts = get_theme_options_dict(app)
pathto = context["pathto"]
header_buttons = context["header_buttons"]

Expand Down Expand Up @@ -127,7 +127,7 @@ def update_sourcename(app):
# the user manually specifies an html_source_suffix, default to an empty string.
# _raw_config is the configuration as provided by the user.
# If a key isn't in it, then the user didn't provide it
if not _config_provided_by_user(app, "html_sourcelink_suffix"):
if not config_provided_by_user(app, "html_sourcelink_suffix"):
app.config.html_sourcelink_suffix = ""


Expand All @@ -138,7 +138,7 @@ def update_context_with_repository_info(app):
while the PST uses a collection of {provider}_{key} pairs in html_context.
So here we insert those context variables on our own.
"""
opts = _get_theme_options(app)
opts = get_theme_options_dict(app)
context = app.config.html_context

# This is the way to give repository info. If it doesn't exist, do nothing.
Expand Down
4 changes: 2 additions & 2 deletions src/sphinx_book_theme/header_buttons/source.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Source file buttons that point to the online repository."""

from pydata_sphinx_theme import _get_theme_options
from pydata_sphinx_theme.utils import get_theme_options_dict
from sphinx.locale import get_translation
from sphinx.util import logging

Expand All @@ -13,7 +13,7 @@

def add_source_buttons(app, pagename, templatename, context, doctree):
"""Add the source repository buttons."""
opts = _get_theme_options(app)
opts = get_theme_options_dict(app)
header_buttons = context["header_buttons"]
# If we have a suffix, then we have a source file
suff = context.get("page_source_suffix")
Expand Down

0 comments on commit 78bde16

Please sign in to comment.