diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a30a1ea..3abfbaf 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/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1fe946c..f01b9ea 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: diff --git a/pyproject.toml b/pyproject.toml index a9b0fdb..c08b2d4 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 17d4d04..7a2ad8e 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 9dd5f28..fe69349 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 9e1083a..0edd6df 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