Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

really drop python<=3.8 support #844

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions src/sphinx_book_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@ def update_mode_thebe_config(app):
# but has not activated the sphinx_thebe extension.
if not hasattr(app.env.config, "thebe_config"):
SPHINX_LOGGER.warning(
(
"Thebe is activated but not added to extensions list. "
"Add `sphinx_thebe` to your site's extensions list."
)
"Thebe is activated but not added to extensions list. "
"Add `sphinx_thebe` to your site's extensions list."
)
return
# Will be empty if it doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion src/sphinx_book_theme/_compat.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from docutils.nodes import Element
from typing import Iterator
from collections.abc import Iterator


def findall(node: Element, *args, **kwargs) -> Iterator[Element]:
Expand Down
6 changes: 2 additions & 4 deletions src/sphinx_book_theme/header_buttons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,8 @@ def update_context_with_repository_info(app):
# If provider is still empty, raise an error because we don't recognize it
if provider == "":
raise SphinxError(
(
f"Provider not recognized in repository url {repo_url}. "
"If you're using a custom provider URL, specify `repository_provider`"
)
f"Provider not recognized in repository url {repo_url}. "
"If you're using a custom provider URL, specify `repository_provider`"
)

# Update the context because this is what the get_edit_url function uses.
Expand Down
12 changes: 5 additions & 7 deletions src/sphinx_book_theme/header_buttons/launch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Launch buttons for Binder / Thebe / Colab / etc."""

from pathlib import Path
from typing import Any, Dict, Optional
from typing import Any, Optional
from urllib.parse import urlencode, quote

from docutils.nodes import document
Expand All @@ -23,7 +23,7 @@ def add_launch_buttons(
app: Sphinx,
pagename: str,
templatename: str,
context: Dict[str, Any],
context: dict[str, Any],
doctree: Optional[document],
):
"""Builds a binder link and inserts it in HTML context for use in templating.
Expand Down Expand Up @@ -89,11 +89,9 @@ def add_launch_buttons(
notebook_interface = launch_buttons.get("notebook_interface", "classic")
if notebook_interface not in notebook_interface_prefixes:
raise ValueError(
(
"Notebook UI for Binder/JupyterHub links must be one"
f"of {tuple(notebook_interface_prefixes.keys())},"
f"not {notebook_interface}"
)
"Notebook UI for Binder/JupyterHub links must be one"
f"of {tuple(notebook_interface_prefixes.keys())},"
f"not {notebook_interface}"
)
ui_pre = notebook_interface_prefixes[notebook_interface]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_build_book(sphinx_build_factory, file_regression):
for filename, kernel in kernels_expected.items():
ntbk_html = sphinx_build.html_tree("section1", filename)
thebe_config = ntbk_html.find("script", attrs={"type": "text/x-thebe-config"})
kernel_name = 'name: "{}",'.format(kernel)
kernel_name = f'name: "{kernel}",'
if kernel_name not in thebe_config.prettify():
raise AssertionError(f"{kernel_name} not in {kernels_expected}")

Expand Down
Loading