From bdfb2211d906745ac5096110ce770333a00c1e8d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:34:24 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/codespell-project/codespell: v2.4.2 → v2.4.3](https://github.com/codespell-project/codespell/compare/v2.4.2...v2.4.3) - [github.com/astral-sh/ruff-pre-commit: v0.15.20 → v0.16.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.15.20...v0.16.1) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5845e42..373fd4b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -58,7 +58,7 @@ repos: - id: text-unicode-replacement-char - repo: https://github.com/codespell-project/codespell - rev: v2.4.2 + rev: v2.4.3 hooks: - id: codespell name: codespell (add false positives to pyproject.toml) @@ -67,7 +67,7 @@ repos: - tomli - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.15.20 + rev: v0.16.1 hooks: - id: ruff name: ruff (see https://docs.astral.sh/ruff/rules) From 13455d59ee247b2b4015bccfa047c62b4c63ba1e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:34:41 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- docs/conf.py | 2 +- plasmapy_sphinx/__init__.py | 3 +-- plasmapy_sphinx/autodoc/automodapi.py | 11 ++++++----- plasmapy_sphinx/automodsumm/core.py | 4 ++-- plasmapy_sphinx/automodsumm/generate.py | 4 ++-- plasmapy_sphinx/ext/css.py | 2 +- plasmapy_sphinx/utils.py | 8 ++++---- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ad93567..b78a492 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -18,8 +18,8 @@ import os import sys - from datetime import datetime + from packaging.version import Version sys.path.insert(0, os.path.abspath("..")) diff --git a/plasmapy_sphinx/__init__.py b/plasmapy_sphinx/__init__.py index cdefa04..57d9d39 100644 --- a/plasmapy_sphinx/__init__.py +++ b/plasmapy_sphinx/__init__.py @@ -73,11 +73,10 @@ if sys.version_info < (3, 8): # coverage: ignore raise ImportError("plasmapy_sphinx does not support Python < 3.8") -from importlib.metadata import version, PackageNotFoundError +from importlib.metadata import PackageNotFoundError, version from plasmapy_sphinx import autodoc, automodsumm, directives, utils - # define version try: # note: if there's any distribution metadata in your source files, then this diff --git a/plasmapy_sphinx/autodoc/automodapi.py b/plasmapy_sphinx/autodoc/automodapi.py index 77a981d..d6e94b8 100644 --- a/plasmapy_sphinx/autodoc/automodapi.py +++ b/plasmapy_sphinx/autodoc/automodapi.py @@ -304,8 +304,8 @@ import inspect import re import warnings - from collections import OrderedDict + from docutils.parsers.rst import directives from docutils.statemachine import StringList from packaging.version import Version @@ -320,10 +320,11 @@ class RemovedInSphinx50Warning(PendingDeprecationWarning): pass -from sphinx.ext.autodoc import bool_option, ModuleDocumenter +from typing import Any, Callable, Dict, List, Optional, Union + +from sphinx.ext.autodoc import ModuleDocumenter, bool_option from sphinx.locale import __ from sphinx.util import logging -from typing import Any, Callable, Dict, List, Optional, Union from plasmapy_sphinx.automodsumm.core import AutomodsummOptions, option_str_list from plasmapy_sphinx.utils import default_grouping_info @@ -380,7 +381,7 @@ def condition_toctree_option(self): :rst:dir:`automodapi:toctree` and :rst:dir:`automodapi:no-toctree` for additional details.) """ - if "no-toctree" in self.options and self.options["no-toctree"]: + if self.options.get("no-toctree"): if "toctree" in self.options: del self.options["toctree"] elif "toctree" not in self.options: @@ -433,7 +434,7 @@ def condition_group_options(self): :rst:dir:`automodapi:groups`, :rst:dir:`automodapi:exclude-groups`, and :rst:dir:`automodapi:no-groups` for additional details.) """ - if "no-groups" in self.options and self.options["no-groups"]: + if self.options.get("no-groups"): self.options["groups"] = [] if "exclude-groups" in self.options: del self.options["exclude-groups"] diff --git a/plasmapy_sphinx/automodsumm/core.py b/plasmapy_sphinx/automodsumm/core.py index 250787e..34d9ccb 100644 --- a/plasmapy_sphinx/automodsumm/core.py +++ b/plasmapy_sphinx/automodsumm/core.py @@ -206,13 +206,13 @@ ] import os - from importlib import import_module +from typing import Any, Callable, Dict, List, Tuple, Union + from packaging.version import Version from sphinx import __version__ as sphinx_version from sphinx.ext.autosummary import Autosummary from sphinx.util import logging -from typing import Any, Callable, Dict, List, Tuple, Union from plasmapy_sphinx.automodsumm.generate import GenDocsFromAutomodsumm from plasmapy_sphinx.utils import ( diff --git a/plasmapy_sphinx/automodsumm/generate.py b/plasmapy_sphinx/automodsumm/generate.py index eb204e0..d63238c 100644 --- a/plasmapy_sphinx/automodsumm/generate.py +++ b/plasmapy_sphinx/automodsumm/generate.py @@ -6,6 +6,7 @@ import os import re +from typing import Any, Dict, List from jinja2 import TemplateNotFound from packaging.version import Version @@ -20,7 +21,6 @@ from sphinx.locale import __ from sphinx.util import logging from sphinx.util.osutil import ensuredir -from typing import Any, Dict, List from plasmapy_sphinx.utils import templates_dir @@ -255,7 +255,7 @@ def generate_docs( _info = self.logger.info _warn = self.logger.warning - showed_sources = list(sorted(source_filenames)) + showed_sources = sorted(source_filenames) _info( __(f"[automodsumm] generating stub files for {len(showed_sources)} sources") ) diff --git a/plasmapy_sphinx/ext/css.py b/plasmapy_sphinx/ext/css.py index 82a2516..3033483 100644 --- a/plasmapy_sphinx/ext/css.py +++ b/plasmapy_sphinx/ext/css.py @@ -9,7 +9,7 @@ from sphinx.application import Sphinx -from plasmapy_sphinx.utils import static_dir, css_dir +from plasmapy_sphinx.utils import css_dir, static_dir def add_plasmapy_css(app, config): diff --git a/plasmapy_sphinx/utils.py b/plasmapy_sphinx/utils.py index 76eca86..18bb31b 100644 --- a/plasmapy_sphinx/utils.py +++ b/plasmapy_sphinx/utils.py @@ -3,24 +3,24 @@ the core functionality in `plasmapy_sphinx`. """ __all__ = [ + "css_dir", "default_grouping_info", "find_mod_objs", "get_custom_grouping_info", "package_dir", + "static_dir", "templates_dir", "theme_dir", - "css_dir", - "static_dir", ] import inspect - from collections import OrderedDict from importlib import import_module -from sphinx.application import Sphinx from pathlib import Path from typing import Any, Dict +from sphinx.application import Sphinx + package_dir = Path(__file__).parent.absolute() """Absolute path to the `plasmapy_sphinx` package directory."""