From b92ebb4daf3a3e3ead7f81701812737a915c5a8d Mon Sep 17 00:00:00 2001 From: gencurrent Date: Tue, 12 May 2026 00:05:49 +0200 Subject: [PATCH] chore: bump docformatter to v1.7.8 v1.7.8 drops the unmaintained `untokenize` dependency (replaced by stdlib `tokenize`), which was failing to install on Python 3.12+ runners due to `ast.Constant.s` removal. This unblocks pre-commit.ci without the `ci.skip: [docformatter]` workaround added in #376. v1.7.8 also introduces stricter docstring decisions that conflict with ruff-format on a few patterns (see PyCQA/docformatter#354): - blank lines after docstring-only function bodies (prometheus.py) - blank lines between module docstring and first class (clients.py) - multi-line string literals used as `exec()` arguments that docformatter mistakes for docstrings (test_varargs.py) The 3 affected files are excluded from docformatter via a regex `exclude:` in the hook config until upstream reconciles the conventions or the patterns are restructured. The cosmetic docstring/comment cleanup that v1.7.8's defaults surface on already-conformant files was merged separately in #385. --- .pre-commit-config.yaml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d11b9688..b4a95c99 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,12 +6,6 @@ ci: autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions" autoupdate_schedule: quarterly # submodules: true - # docformatter v1.7.7 transitively pulls `untokenize`, whose setup.py - # uses `ast.Constant.s` (removed in Python 3.12+) and fails to install - # on pre-commit.ci's runners. The `pre-commit` GitHub Actions job still - # runs docformatter, so coverage isn't lost. Remove this once docformatter - # ships v1.7.8 (which drops the untokenize dep). - skip: [docformatter] repos: - repo: https://github.com/pre-commit/pre-commit-hooks @@ -36,11 +30,23 @@ repos: args: [] - repo: https://github.com/PyCQA/docformatter - rev: v1.7.7 + rev: v1.7.8 hooks: - id: docformatter additional_dependencies: [tomli] args: ["--in-place"] + # docformatter v1.7.8 disagrees with ruff-format on these files + # (blank lines after docstring-only function bodies, blank lines + # between module docstring and first class, and a multi-line + # string literal used as an `exec()` argument that docformatter + # incorrectly treats as a docstring). Exclude until upstream + # reconciles the conventions or the patterns are restructured. + exclude: | + (?x)^( + src/cachier/exporters/prometheus\.py| + tests/mongo_tests/clients\.py| + tests/test_varargs\.py + )$ - repo: https://github.com/executablebooks/mdformat rev: 1.0.0