Skip to content

Commit a7d317e

Browse files
committed
[deps/fix] Upgraded docstrfmt and coverage
Also fixed non-unique docstrfmt adornments. Removed unsupported Python 3.9. Updated docstrfmt calls in releaser tool.
1 parent d19466e commit a7d317e

File tree

7 files changed

+30
-32
lines changed

7 files changed

+30
-32
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
python-version:
23-
- "3.9"
2423
- "3.10"
2524
- "3.11"
2625
- "3.12"
@@ -31,13 +30,6 @@ jobs:
3130
- django~=5.1.0
3231
- django~=5.2.0
3332
exclude:
34-
# Django 5.0+ requires Python >=3.10
35-
- python-version: "3.9"
36-
django-version: django~=5.0.0
37-
- python-version: "3.9"
38-
django-version: django~=5.1.0
39-
- python-version: "3.9"
40-
django-version: django~=5.2.0
4133
# Python 3.13 supported only in Django >=5.1.3
4234
- python-version: "3.13"
4335
django-version: django~=4.2.0

openwisp-qa-check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ runflake8() {
118118
}
119119

120120
runrstcheck() {
121-
cmd="docstrfmt --no-docstring-trailing-line --ignore-cache --check --line-length 74 ."
121+
cmd="docstrfmt --no-docstring-trailing-line -i -c -l 74 -s =-~+^\"\'.: ."
122122
$($cmd --quiet) &&
123123
echo "SUCCESS: ReStructuredText check successful!" ||
124124
{

openwisp-qa-format

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ set -e
33

44
isort .
55
black .
6-
docstrfmt --no-docstring-trailing-line --ignore-cache --line-length 74 .
6+
docstrfmt --no-docstring-trailing-line --ignore-cache \
7+
--section-adornments "=-~+^\"\'.:" \
8+
--line-length 74 .
79

810
if which prettier > /dev/null; then
911
prettier --write "**/*.+(yml|yaml|md|js|json|css)" --print-width 88

openwisp_utils/releaser/changelog.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import questionary
99

10+
from .utils import _call_docstrfmt
11+
1012

1113
def find_cliff_config():
1214
# Locates the cliff.toml file packaged within 'openwisp_utils'.
@@ -155,19 +157,7 @@ def format_rst_block(content):
155157
temp_file_path = tf.name
156158
tf.write(content_with_header)
157159

158-
subprocess.run(
159-
[
160-
"docstrfmt",
161-
"--no-docstring-trailing-line",
162-
"--ignore-cache",
163-
"--line-length",
164-
"74",
165-
temp_file_path,
166-
],
167-
check=True,
168-
capture_output=True,
169-
text=True,
170-
)
160+
_call_docstrfmt(temp_file_path)
171161

172162
with open(temp_file_path, "r") as tf:
173163
formatted_full_content = tf.read()

openwisp_utils/releaser/tests/test_utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ def test_format_file_with_docstrfmt_success(mock_print, mock_subprocess):
113113
expected_command = [
114114
"docstrfmt",
115115
"--ignore-cache",
116+
"--section-adornments",
117+
"=-~+^\"'.:",
116118
"--line-length",
117119
"74",
118120
file_path,

openwisp_utils/releaser/utils.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,29 @@ def rst_to_markdown(text):
9393
).strip()
9494

9595

96+
def _call_docstrfmt(file_path):
97+
return subprocess.run(
98+
[
99+
"docstrfmt",
100+
"--ignore-cache",
101+
"--section-adornments",
102+
"=-~+^\"'.:",
103+
"--line-length",
104+
"74",
105+
file_path,
106+
],
107+
check=True,
108+
capture_output=True,
109+
text=True,
110+
encoding="utf-8",
111+
)
112+
113+
96114
def format_file_with_docstrfmt(file_path):
97115
"""Format a file using `docstrfmt`."""
98116
while True:
99117
try:
100-
subprocess.run(
101-
["docstrfmt", "--ignore-cache", "--line-length", "74", file_path],
102-
check=True,
103-
capture_output=True,
104-
text=True,
105-
encoding="utf-8",
106-
)
118+
_call_docstrfmt(file_path)
107119
print(f"✅ Formatted {file_path} successfully.")
108120
break
109121
except subprocess.CalledProcessError as e:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@
3737
"black>=25.1,<25.10",
3838
"flake8~=7.3.0",
3939
"isort>=6.0.1,<7.1.0",
40-
"coverage~=7.10.6",
40+
"coverage>=7.10.0,<7.13.0",
4141
"tblib~=3.1.0",
42-
"docstrfmt~=1.11.1",
42+
"docstrfmt>=2.0.0,<2.1.0",
4343
],
4444
"rest": [
4545
"djangorestframework~=3.16.0",

0 commit comments

Comments
 (0)