Skip to content

Commit 45600f2

Browse files
Merge pull request #2793 from VWS-Python/switch-to-pydocstringformatter
Switch from docformatter to pydocstringformatter
2 parents 6115e7e + 7f33021 commit 45600f2

22 files changed

+179
-307
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ci:
1313
- check-manifest
1414
- deptry
1515
- doc8
16-
- docformatter
16+
- pydocstringformatter
1717
- docs
1818
- interrogate
1919
- interrogate-docs
@@ -104,9 +104,9 @@ repos:
104104
additional_dependencies: [uv==0.9.5]
105105
stages: [pre-commit]
106106

107-
- id: docformatter
108-
name: docformatter
109-
entry: uv run --extra=dev -m docformatter --in-place
107+
- id: pydocstringformatter
108+
name: pydocstringformatter
109+
entry: uv run --extra=dev pydocstringformatter
110110
language: python
111111
types_or: [python]
112112
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 Sybil.
3-
"""
1+
"""Setup for Sybil."""
42

53
import io
64
import uuid
@@ -21,9 +19,7 @@
2119

2220

2321
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
24-
"""
25-
Apply the beartype decorator to all collected test functions.
26-
"""
22+
"""Apply the beartype decorator to all collected test functions."""
2723
for item in items:
2824
if isinstance(item, pytest.Function):
2925
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
@@ -42,13 +42,13 @@ optional-dependencies.dev = [
4242
"deptry==0.24.0",
4343
"doc8==2.0.0",
4444
"doccmd==2026.1.22.1",
45-
"docformatter==1.7.7",
4645
"freezegun==1.5.5",
4746
"furo==2025.12.19",
4847
"interrogate==1.7.0",
4948
"mypy[faster-cache]==1.19.1",
5049
"mypy-strict-kwargs==2026.1.12",
5150
"prek==0.3.0",
51+
"pydocstringformatter==0.7.3",
5252
"pydocstyle==6.3",
5353
"pygments==2.19.2",
5454
"pylint[spelling]==4.0.4",
@@ -119,8 +119,8 @@ lint.select = [
119119
lint.ignore = [
120120
# Ruff warns that this conflicts with the formatter.
121121
"COM812",
122-
# Allow our chosen docstring line-style - no one-line summary.
123-
"D200",
122+
# Allow our chosen docstring line-style - pydocstringformatter handles formatting
123+
# but doesn't enforce D205 (blank line after summary) or D212 (summary on first line).
124124
"D205",
125125
"D212",
126126
# Ruff warns that this conflicts with the formatter.
@@ -274,9 +274,6 @@ spelling-private-dict-file = 'spelling_private_dict.txt'
274274
# --spelling-private-dict-file option instead of raising a message.
275275
spelling-store-unknown-words = 'no'
276276

277-
[tool.docformatter]
278-
make-summary-multi-line = true
279-
280277
[tool.check-manifest]
281278

282279
ignore = [
@@ -346,6 +343,15 @@ enableTypeIgnoreComments = false
346343
reportUnnecessaryTypeIgnoreComment = true
347344
typeCheckingMode = "strict"
348345

346+
[tool.pydocstringformatter]
347+
write = true
348+
split-summary-body = false
349+
# Use a lower line length than ruff (79) to avoid conflicts with D200 -
350+
# pydocstringformatter would otherwise split docstrings at exactly 79 chars
351+
# which ruff considers should stay on one line.
352+
max-line-length = 75
353+
linewrap-full-docstring = true
354+
349355
[tool.interrogate]
350356
fail-under = 100
351357
omit-covered-files = true

src/vws/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""
2-
A library for Vuforia Web Services.
3-
"""
1+
"""A library for Vuforia Web Services."""
42

53
from .query import CloudRecoService
64
from .vws import VWS

src/vws/exceptions/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
"""
2-
Custom exceptions raised by this package.
3-
"""
1+
"""Custom exceptions raised by this package."""

src/vws/exceptions/base_exceptions.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
2-
Base exceptions for errors returned by Vuforia Web Services or the Vuforia
2+
Base exceptions for errors returned by Vuforia Web Services or the
3+
Vuforia
34
Cloud Recognition Web API.
45
"""
56

@@ -10,9 +11,7 @@
1011

1112
@beartype
1213
class CloudRecoError(Exception):
13-
"""
14-
Base class for Vuforia Cloud Recognition Web API exceptions.
15-
"""
14+
"""Base class for Vuforia Cloud Recognition Web API exceptions."""
1615

1716
def __init__(self, response: Response) -> None:
1817
"""
@@ -24,9 +23,7 @@ def __init__(self, response: Response) -> None:
2423

2524
@property
2625
def response(self) -> Response:
27-
"""
28-
The response returned by Vuforia which included this error.
29-
"""
26+
"""The response returned by Vuforia which included this error."""
3027
return self._response
3128

3229

@@ -48,7 +45,5 @@ def __init__(self, response: Response) -> None:
4845

4946
@property
5047
def response(self) -> Response:
51-
"""
52-
The response returned by Vuforia which included this error.
53-
"""
48+
"""The response returned by Vuforia which included this error."""
5449
return self._response
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
"""
2-
Exceptions which match errors raised by the Vuforia Cloud Recognition Web APIs.
1+
"""Exceptions which match errors raised by the Vuforia Cloud Recognition
2+
Web
3+
APIs.
34
"""
45

56
from beartype import beartype
@@ -17,31 +18,27 @@ class MaxNumResultsOutOfRangeError(CloudRecoError):
1718

1819
@beartype
1920
class InactiveProjectError(CloudRecoError):
20-
"""
21-
Exception raised when Vuforia returns a response with a result code
21+
"""Exception raised when Vuforia returns a response with a result code
2222
'InactiveProject'.
2323
"""
2424

2525

2626
@beartype
2727
class BadImageError(CloudRecoError):
28-
"""
29-
Exception raised when Vuforia returns a response with a result code
28+
"""Exception raised when Vuforia returns a response with a result code
3029
'BadImage'.
3130
"""
3231

3332

3433
@beartype
3534
class AuthenticationFailureError(CloudRecoError):
36-
"""
37-
Exception raised when Vuforia returns a response with a result code
35+
"""Exception raised when Vuforia returns a response with a result code
3836
'AuthenticationFailure'.
3937
"""
4038

4139

4240
@beartype
4341
class RequestTimeTooSkewedError(CloudRecoError):
44-
"""
45-
Exception raised when Vuforia returns a response with a result code
42+
"""Exception raised when Vuforia returns a response with a result code
4643
'RequestTimeTooSkewed'.
4744
"""
Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"""
2-
Exceptions which do not map to errors at
1+
"""Exceptions which do not map to errors at the following URL, or simple
2+
errors given by the cloud recognition service.
3+
34
https://developer.vuforia.com/library/web-api/cloud-targets-web-services-api#result-codes
4-
or simple errors given by the cloud recognition service.
55
"""
66

77
from beartype import beartype
@@ -11,9 +11,7 @@
1111

1212
@beartype
1313
class RequestEntityTooLargeError(Exception):
14-
"""
15-
Exception raised when the given image is too large.
16-
"""
14+
"""Exception raised when the given image is too large."""
1715

1816
def __init__(self, response: Response) -> None:
1917
"""
@@ -25,24 +23,20 @@ def __init__(self, response: Response) -> None:
2523

2624
@property
2725
def response(self) -> Response:
28-
"""
29-
The response returned by Vuforia which included this error.
30-
"""
26+
"""The response returned by Vuforia which included this error."""
3127
return self._response
3228

3329

3430
@beartype
3531
class TargetProcessingTimeoutError(Exception):
36-
"""
37-
Exception raised when waiting for a target to be processed times out.
32+
"""Exception raised when waiting for a target to be processed times
33+
out.
3834
"""
3935

4036

4137
@beartype
4238
class ServerError(Exception): # pragma: no cover
43-
"""
44-
Exception raised when VWS returns a server error.
45-
"""
39+
"""Exception raised when VWS returns a server error."""
4640

4741
def __init__(self, response: Response) -> None:
4842
"""
@@ -54,7 +48,5 @@ def __init__(self, response: Response) -> None:
5448

5549
@property
5650
def response(self) -> Response:
57-
"""
58-
The response returned by Vuforia which included this error.
59-
"""
51+
"""The response returned by Vuforia which included this error."""
6052
return self._response

0 commit comments

Comments
 (0)