From 4292d960cb486fc36b5d7f0c922a0f99fc2e0a88 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Jul 2026 12:33:43 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Refresh=20dev/docs=20p?= =?UTF-8?q?ins,=20group=20dependabot=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - theme extras: furo ~=2025.12, pydata-sphinx-theme ~=0.20.0, sphinx-rtd-theme ~=3.1, sphinx-book-theme ~=1.2, sphinx-immaterial ~=0.13.9 - code-style: allow pre-commit v4 - dependency-groups: sync mypy (2.1.0) and ruff (0.15.20) with the pre-commit revs bumped in #262 - fix mypy 2.1 errors: add **kwargs to SphinxPostTransform.run overrides, targeted type-ignores for the add_directive capture and env attribute - dependabot: group actions/pip updates into single PRs --- .github/dependabot.yml | 6 ++++++ pyproject.toml | 17 +++++++++-------- sphinx_design/dropdown.py | 4 +++- sphinx_design/extension.py | 10 +++++----- sphinx_design/tabs.py | 4 +++- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a30a1ea4..3abfbafb 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,9 +11,15 @@ updates: prefix: ⬆️ schedule: interval: monthly + groups: + actions: + patterns: ["*"] - package-ecosystem: pip directory: / commit-message: prefix: ⬆️ schedule: interval: monthly + groups: + python-deps: + patterns: ["*"] diff --git a/pyproject.toml b/pyproject.toml index a9b0fdb3..c08b2d48 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ Homepage = "https://github.com/executablebooks/sphinx-design" Documentation = "https://sphinx-design.readthedocs.io" [project.optional-dependencies] -code-style = ["pre-commit>=3,<4"] +code-style = ["pre-commit>=3,<5"] rtd = ["myst-parser>=4,<6"] testing = [ "myst-parser>=4,<6", @@ -50,15 +50,16 @@ testing-no-myst = [ "defusedxml", ] -theme-furo = ["furo~=2024.7.18"] -theme-pydata = ["pydata-sphinx-theme~=0.15.2"] -theme-rtd = ["sphinx-rtd-theme~=2.0"] -theme-sbt = ["sphinx-book-theme~=1.1"] -theme-im = ["sphinx-immaterial~=0.12.2"] +theme-furo = ["furo~=2025.12"] +theme-pydata = ["pydata-sphinx-theme~=0.20.0"] +theme-rtd = ["sphinx-rtd-theme~=3.1"] +theme-sbt = ["sphinx-book-theme~=1.2"] +theme-im = ["sphinx-immaterial~=0.13.9"] [dependency-groups] -mypy = ["mypy==1.19.1"] -ruff = ["ruff==0.14.11"] +# keep in sync with the mirrors-mypy / ruff-pre-commit revs in .pre-commit-config.yaml +mypy = ["mypy==2.1.0"] +ruff = ["ruff==0.15.20"] [tool.flit.sdist] exclude = [ diff --git a/sphinx_design/dropdown.py b/sphinx_design/dropdown.py index 17d4d04e..7a2ad8e0 100644 --- a/sphinx_design/dropdown.py +++ b/sphinx_design/dropdown.py @@ -1,5 +1,7 @@ """Originally Adapted from sphinxcontrib.details.directive""" +from typing import Any + from docutils import nodes from docutils.parsers.rst import directives from sphinx.application import Sphinx @@ -148,7 +150,7 @@ class DropdownHtmlTransform(SphinxPostTransform): default_priority = 199 formats = ("html",) - def run(self) -> None: + def run(self, **kwargs: Any) -> None: """Run the transform""" document: nodes.document = self.document for node in findall(document)(lambda node: is_component(node, "dropdown")): diff --git a/sphinx_design/extension.py b/sphinx_design/extension.py index 9dd5f286..fe69349a 100644 --- a/sphinx_design/extension.py +++ b/sphinx_design/extension.py @@ -71,15 +71,15 @@ def _add_directive(name, directive, **kwargs): directive_map[name] = directive add_directive(name, directive, **kwargs) - app.add_directive = _add_directive + app.add_directive = _add_directive # type: ignore[assignment,method-assign] yield directive_map - app.add_directive = add_directive + app.add_directive = add_directive # type: ignore[method-assign] def update_css_js(app: Sphinx): """Copy the CSS to the build directory.""" # reset changed identifier - app.env.sphinx_design_css_changed = False + app.env.sphinx_design_css_changed = False # type: ignore[attr-defined] # setup up new static path in output dir static_path = (Path(app.outdir) / "_sphinx_design_static").absolute() static_existed = static_path.exists() @@ -105,7 +105,7 @@ def update_css_js(app: Sphinx): if css_path.exists(): return if static_existed: - app.env.sphinx_design_css_changed = True + app.env.sphinx_design_css_changed = True # type: ignore[attr-defined] for path in static_path.glob("*.css"): path.unlink() css_path.write_text(content, encoding="utf8") @@ -113,7 +113,7 @@ def update_css_js(app: Sphinx): def update_css_links(app: Sphinx, env: BuildEnvironment): """If CSS has changed, all files must be re-written, to include the correct stylesheets.""" - if env.sphinx_design_css_changed: + if env.sphinx_design_css_changed: # type: ignore[attr-defined] return list(env.all_docs.keys()) diff --git a/sphinx_design/tabs.py b/sphinx_design/tabs.py index 9e1083aa..0edd6df6 100644 --- a/sphinx_design/tabs.py +++ b/sphinx_design/tabs.py @@ -1,3 +1,5 @@ +from typing import Any + from docutils import nodes from docutils.parsers.rst import directives from sphinx.application import Sphinx @@ -215,7 +217,7 @@ class TabSetHtmlTransform(SphinxPostTransform): default_priority = 200 formats = ("html",) - def run(self) -> None: + def run(self, **kwargs: Any) -> None: """Run the transform.""" # setup id generators From 22485cf5bf1318af33e9dd8884b9a4bf5d98ce61 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 12 Jul 2026 12:40:22 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=A7=20Install=20sphinx=20in=20pre-?= =?UTF-8?q?commit=20mypy=20hook?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aligns the hook environment with tox -e mypy: without sphinx installed, the mirror's default --ignore-missing-imports makes Sphinx types Any, so ignores required by the fully-typed run are reported as unused. --- .pre-commit-config.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fe946c9..f01b9ea0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,9 @@ repos: rev: v2.1.0 hooks: - id: mypy - additional_dependencies: [] + # install sphinx so the hook type-checks with real types, + # matching the tox mypy environment (which installs the package) + additional_dependencies: [sphinx] - repo: local hooks: