Skip to content

Commit fd7b96b

Browse files
committed
Replace docformatter with pydocstringformatter
- Replace docformatter==1.7.7 with pydocstringformatter==0.7.3 - Replace [tool.docformatter] with [tool.pydocstringformatter] config - Update ruff ignore comments (D200 -> D205/D212) - Don't use linewrap-full-docstring to avoid breaking URLs (DanielNoord/pydocstringformatter#540)
1 parent 1d69713 commit fd7b96b

8 files changed

Lines changed: 31 additions & 35 deletions

File tree

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ci:
99
- check-manifest
1010
- deptry
1111
- doc8
12-
- docformatter
12+
- pydocstringformatter
1313
- docs
1414
- interrogate
1515
- interrogate-docs
@@ -103,9 +103,9 @@ repos:
103103
additional_dependencies: [uv==0.9.5]
104104
stages: [pre-commit]
105105

106-
- id: docformatter
107-
name: docformatter
108-
entry: uv run --extra=dev -m docformatter --in-place
106+
- id: pydocstringformatter
107+
name: pydocstringformatter
108+
entry: uv run --extra=dev pydocstringformatter
109109
language: python
110110
types_or: [python]
111111
additional_dependencies: [uv==0.9.5]

conftest.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Setup for test suite.
3-
"""
1+
"""Setup for test suite."""
42

53
import uuid
64
from collections.abc import Generator
@@ -63,9 +61,7 @@ def fixture_mock_vws(
6361

6462
@beartype
6563
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
66-
"""
67-
Apply the beartype decorator to all collected test functions.
68-
"""
64+
"""Apply the beartype decorator to all collected test functions."""
6965
for item in items:
7066
if isinstance(item, pytest.Function):
7167
item.obj = beartype(obj=item.obj)

docs/source/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
Documentation.
3-
"""
1+
"""Documentation."""

docs/source/conf.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python3
2-
"""
3-
Configuration for Sphinx.
4-
"""
2+
"""Configuration for Sphinx."""
53

64
import importlib.metadata
75
from pathlib import Path

pyproject.toml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ optional-dependencies.dev = [
3838
"deptry==0.24.0",
3939
"doc8==2.0.0",
4040
"doccmd==2026.1.23.4",
41-
"docformatter==1.7.7",
4241
"freezegun==1.5.5",
4342
"furo==2025.12.19",
4443
"interrogate==1.7.0",
4544
"mypy[faster-cache]==1.19.1",
4645
"mypy-strict-kwargs==2026.1.12",
4746
"prek==0.3.0",
47+
"pydocstringformatter==0.7.3",
4848
"pylint[spelling]==4.0.4",
4949
"pylint-per-file-ignores==3.2.0",
5050
"pyproject-fmt==2.11.1",
@@ -112,8 +112,8 @@ lint.select = [
112112
lint.ignore = [
113113
# Ruff warns that this conflicts with the formatter.
114114
"COM812",
115-
# Allow our chosen docstring line-style - no one-line summary.
116-
"D200",
115+
# Allow our chosen docstring line-style - pydocstringformatter handles formatting
116+
# but doesn't enforce D205 (blank line after summary) or D212 (summary on first line).
117117
"D205",
118118
"D212",
119119
# Ruff warns that this conflicts with the formatter.
@@ -124,6 +124,9 @@ lint.ignore = [
124124
]
125125

126126
lint.per-file-ignores."doccmd_*.py" = [
127+
# Allow our chosen docstring line-style - pydocstringformatter handles
128+
# formatting but docstrings in docs may not match this style.
129+
"D200",
127130
# Allow asserts in docs.
128131
"S101",
129132
]
@@ -264,9 +267,6 @@ spelling-private-dict-file = 'spelling_private_dict.txt'
264267
# --spelling-private-dict-file option instead of raising a message.
265268
spelling-store-unknown-words = 'no'
266269

267-
[tool.docformatter]
268-
make-summary-multi-line = true
269-
270270
[tool.check-manifest]
271271

272272
ignore = [
@@ -331,6 +331,12 @@ enableTypeIgnoreComments = false
331331
reportUnnecessaryTypeIgnoreComment = true
332332
typeCheckingMode = "strict"
333333

334+
[tool.pydocstringformatter]
335+
write = true
336+
split-summary-body = false
337+
max-line-length = 75
338+
linewrap-full-docstring = true
339+
334340
[tool.interrogate]
335341
fail-under = 100
336342
omit-covered-files = true

src/vws_auth_tools/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Authorization helpers.
3-
"""
1+
"""Authorization helpers."""
42

53
import base64
64
import email.utils
@@ -13,7 +11,8 @@
1311
@beartype
1412
def _compute_hmac_base64(key: bytes, data: bytes) -> bytes:
1513
"""
16-
Return the Base64 encoded HMAC-SHA1 hash of `data` using the `key`.
14+
Return the Base64 encoded HMAC-SHA1 hash of `data` using the
15+
`key`.
1716
"""
1817
hashed = hmac.new(key=key, msg=None, digestmod=hashlib.sha1)
1918
hashed.update(msg=data)
@@ -22,7 +21,8 @@ def _compute_hmac_base64(key: bytes, data: bytes) -> bytes:
2221

2322
@beartype
2423
def rfc_1123_date() -> str:
25-
"""Return the date formatted as per RFC 2616, section 3.3.1, rfc1123-date.
24+
"""Return the date formatted as per RFC 2616, section 3.3.1,
25+
rfc1123-date.
2626
2727
This is the date needed by the VWS API, as described in
2828
https://developer.vuforia.com/library/web-api/vuforia-web-api-authentication.

tests/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
Tests for authorization tools.
3-
"""
1+
"""Tests for authorization tools."""

tests/test_vws_auth_tools.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
Tests for authorization tools.
3-
"""
1+
"""Tests for authorization tools."""
42

53
import datetime
64
from zoneinfo import ZoneInfo
@@ -12,7 +10,8 @@
1210

1311

1412
def test_rfc_1123_date() -> None:
15-
"""The date is returned in the format described in the VWS documentation.
13+
"""The date is returned in the format described in the VWS
14+
documentation.
1615
1716
See https://developer.vuforia.com/library/web-api/vuforia-web-api-authentication:
1817
@@ -74,7 +73,8 @@ def test_authorization_header(content: bytes | str) -> None:
7473
@pytest.mark.parametrize(argnames="content", argvalues=[b"", None])
7574
def test_authorization_header_none_content(content: bytes | None) -> None:
7675
"""
77-
The Authorization header is the same whether the content is None or b"".
76+
The Authorization header is the same whether the content is None or
77+
b"".
7878
"""
7979
access_key = "my_access_key"
8080
# Ignore "Possible hardcoded password" as it is appropriate here.

0 commit comments

Comments
 (0)