docstring-format-checker 1.0.0__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/PKG-INFO +3 -2
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/pyproject.toml +6 -5
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/src/docstring_format_checker/__init__.py +8 -4
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/src/docstring_format_checker/cli.py +91 -103
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/README.md +0 -0
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/src/docstring_format_checker/config.py +0 -0
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/src/docstring_format_checker/core.py +0 -0
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/src/docstring_format_checker/utils/__init__.py +0 -0
- {docstring_format_checker-1.0.0 → docstring_format_checker-1.1.0}/src/docstring_format_checker/utils/exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: docstring-format-checker
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.0
|
|
4
4
|
Summary: A CLI tool to check and validate Python docstring formatting and completeness
|
|
5
5
|
Author: Chris Mahoney
|
|
6
6
|
Author-email: Chris Mahoney <docstring-format-checker@data-science-extensions.com>
|
|
@@ -23,11 +23,12 @@ Requires-Dist: typer>=0.9.0
|
|
|
23
23
|
Requires-Dist: tomli>=2.0.0 ; python_full_version < '3.11'
|
|
24
24
|
Requires-Dist: rich>=13.0.0
|
|
25
25
|
Requires-Dist: toolbox-python==1.*
|
|
26
|
+
Requires-Dist: pyfiglet==1.*
|
|
26
27
|
Maintainer: Chris Mahoney
|
|
27
28
|
Maintainer-email: Chris Mahoney <docstring-format-checker@data-science-extensions.com>
|
|
28
29
|
Requires-Python: >=3.9
|
|
29
30
|
Project-URL: Changelog, https://github.com/data-science-extensions/docstring-format-checker/releases
|
|
30
|
-
Project-URL: Documentation, https://
|
|
31
|
+
Project-URL: Documentation, https://data-science-extensions.com/toolboxes/docstring-format-checker/latest/code/
|
|
31
32
|
Project-URL: Homepage, https://github.com/data-science-extensions/docstring-format-checker
|
|
32
33
|
Project-URL: Issues, https://github.com/data-science-extensions/docstring-format-checker/issues
|
|
33
34
|
Project-URL: Repository, https://github.com/data-science-extensions/docstring-format-checker
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "docstring-format-checker"
|
|
3
|
-
version = "
|
|
3
|
+
version = "1.1.0"
|
|
4
4
|
description = "A CLI tool to check and validate Python docstring formatting and completeness"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -32,11 +32,12 @@ dependencies = [
|
|
|
32
32
|
"tomli>=2.0.0;python_version<'3.11'",
|
|
33
33
|
"rich>=13.0.0",
|
|
34
34
|
"toolbox-python==1.*",
|
|
35
|
+
"pyfiglet==1.*",
|
|
35
36
|
]
|
|
36
37
|
|
|
37
38
|
[project.urls]
|
|
38
39
|
Homepage = "https://github.com/data-science-extensions/docstring-format-checker"
|
|
39
|
-
Documentation = "https://
|
|
40
|
+
Documentation = "https://data-science-extensions.com/toolboxes/docstring-format-checker/latest/code/"
|
|
40
41
|
Repository = "https://github.com/data-science-extensions/docstring-format-checker"
|
|
41
42
|
Changelog = "https://github.com/data-science-extensions/docstring-format-checker/releases"
|
|
42
43
|
Issues = "https://github.com/data-science-extensions/docstring-format-checker/issues"
|
|
@@ -66,7 +67,7 @@ docs = [
|
|
|
66
67
|
"mike==2.*",
|
|
67
68
|
"mkdocs==1.*",
|
|
68
69
|
"mkdocs-autorefs==1.*",
|
|
69
|
-
"mkdocs-coverage==
|
|
70
|
+
"mkdocs-coverage==2.*",
|
|
70
71
|
"mkdocs-material==9.*",
|
|
71
72
|
"mkdocstrings==0.*",
|
|
72
73
|
"mkdocstrings-python==1.*",
|
|
@@ -77,7 +78,7 @@ test = [
|
|
|
77
78
|
"parameterized==0.*",
|
|
78
79
|
"pytest==8.*",
|
|
79
80
|
"pytest-clarity==1.*",
|
|
80
|
-
"pytest-cov==
|
|
81
|
+
"pytest-cov==7.*",
|
|
81
82
|
"pytest-icdiff==0.*",
|
|
82
83
|
"pytest-sugar==1.*",
|
|
83
84
|
"pytest-xdist==3.*",
|
|
@@ -169,5 +170,5 @@ sections = [
|
|
|
169
170
|
]
|
|
170
171
|
|
|
171
172
|
[build-system]
|
|
172
|
-
requires = ["uv_build>=0.
|
|
173
|
+
requires = ["uv_build>=0.8.17,<0.9.0"]
|
|
173
174
|
build-backend = "uv_build"
|
|
@@ -4,16 +4,20 @@ Docstring Format Checker.
|
|
|
4
4
|
A CLI tool to check and validate Python docstring formatting and completeness.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__email__ = "docstring-format-checker@data-science-extensions.com"
|
|
10
|
-
|
|
7
|
+
# ## Python StdLib Imports ----
|
|
8
|
+
from importlib.metadata import metadata
|
|
11
9
|
|
|
12
10
|
# ## Local First Party Imports ----
|
|
13
11
|
from docstring_format_checker.config import DEFAULT_CONFIG, load_config
|
|
14
12
|
from docstring_format_checker.core import DocstringChecker, SectionConfig
|
|
15
13
|
|
|
16
14
|
|
|
15
|
+
_metadata = metadata("docstring-format-checker")
|
|
16
|
+
__name__: str = _metadata["Name"]
|
|
17
|
+
__version__: str = _metadata["Version"]
|
|
18
|
+
__author__: str = _metadata["Author"]
|
|
19
|
+
__email__: str = _metadata.get("Email", "")
|
|
20
|
+
|
|
17
21
|
__all__: list[str] = [
|
|
18
22
|
"DocstringChecker",
|
|
19
23
|
"SectionConfig",
|
|
@@ -43,12 +43,14 @@
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
# ## Python StdLib Imports ----
|
|
46
|
+
import os
|
|
46
47
|
from functools import partial
|
|
47
48
|
from pathlib import Path
|
|
48
49
|
from textwrap import dedent
|
|
49
50
|
from typing import Optional
|
|
50
51
|
|
|
51
52
|
# ## Python Third Party Imports ----
|
|
53
|
+
import pyfiglet
|
|
52
54
|
from rich.console import Console
|
|
53
55
|
from rich.panel import Panel
|
|
54
56
|
from rich.table import Table
|
|
@@ -160,29 +162,6 @@ def _version_callback(ctx: Context, param: CallbackParam, value: bool) -> None:
|
|
|
160
162
|
raise Exit()
|
|
161
163
|
|
|
162
164
|
|
|
163
|
-
def _help_callback_main(ctx: Context, param: CallbackParam, value: bool) -> None:
|
|
164
|
-
"""
|
|
165
|
-
!!! note "Summary"
|
|
166
|
-
Show help and exit.
|
|
167
|
-
|
|
168
|
-
Params:
|
|
169
|
-
ctx (Context):
|
|
170
|
-
The context object.
|
|
171
|
-
param (CallbackParam):
|
|
172
|
-
The parameter object.
|
|
173
|
-
value (bool):
|
|
174
|
-
The boolean value indicating if the flag was set.
|
|
175
|
-
|
|
176
|
-
Returns:
|
|
177
|
-
(None):
|
|
178
|
-
Nothing is returned.
|
|
179
|
-
"""
|
|
180
|
-
if not value or ctx.resilient_parsing:
|
|
181
|
-
return
|
|
182
|
-
echo(ctx.get_help())
|
|
183
|
-
raise Exit()
|
|
184
|
-
|
|
185
|
-
|
|
186
165
|
def _example_callback(ctx: Context, param: CallbackParam, value: Optional[str]) -> None:
|
|
187
166
|
"""
|
|
188
167
|
!!! note "Summary"
|
|
@@ -211,6 +190,7 @@ def _example_callback(ctx: Context, param: CallbackParam, value: Optional[str])
|
|
|
211
190
|
else:
|
|
212
191
|
console.print(_red(f"Error: Invalid example type '{value}'. Use 'config' or 'usage'."))
|
|
213
192
|
raise Exit(1)
|
|
193
|
+
raise Exit()
|
|
214
194
|
|
|
215
195
|
|
|
216
196
|
def _show_usage_examples_callback() -> None:
|
|
@@ -233,30 +213,31 @@ def _show_usage_examples_callback() -> None:
|
|
|
233
213
|
|
|
234
214
|
examples_content: str = dedent(
|
|
235
215
|
f"""
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
{
|
|
239
|
-
{
|
|
240
|
-
{
|
|
241
|
-
{
|
|
242
|
-
{
|
|
243
|
-
{
|
|
244
|
-
{
|
|
245
|
-
{
|
|
246
|
-
{
|
|
216
|
+
Execute the below commands in any terminal after installing the package.
|
|
217
|
+
|
|
218
|
+
{_blue("dfc myfile.py")} {_green("# Check a single Python file (list output)")}
|
|
219
|
+
{_blue("dfc src/")} {_green("# Check all Python files in src/ directory")}
|
|
220
|
+
{_blue("dfc --output=table myfile.py")} {_green("# Check with table output format")}
|
|
221
|
+
{_blue("dfc -o list myfile.py")} {_green("# Check with list output format (default)")}
|
|
222
|
+
{_blue("dfc --check myfile.py")} {_green("# Check and exit with error if issues found")}
|
|
223
|
+
{_blue("dfc --quiet myfile.py")} {_green("# Check quietly, only show pass/fail")}
|
|
224
|
+
{_blue("dfc --quiet --check myfile.py")} {_green("# Check quietly and exit with error if issues found")}
|
|
225
|
+
{_blue("dfc . --exclude '*/tests/*'")} {_green("# Check current directory, excluding tests")}
|
|
226
|
+
{_blue("dfc . -c custom.toml")} {_green("# Use custom configuration file")}
|
|
227
|
+
{_blue("dfc --example=config")} {_green("# Show example configuration")}
|
|
228
|
+
{_blue("dfc -e usage")} {_green("# Show usage examples (this help)")}
|
|
247
229
|
"""
|
|
248
230
|
).strip()
|
|
249
231
|
|
|
250
232
|
panel = Panel(
|
|
251
233
|
examples_content,
|
|
252
|
-
title="Examples",
|
|
234
|
+
title="Usage Examples",
|
|
253
235
|
title_align="left",
|
|
254
236
|
border_style="dim",
|
|
255
237
|
padding=(0, 1),
|
|
256
238
|
)
|
|
257
239
|
|
|
258
240
|
console.print(panel)
|
|
259
|
-
raise Exit()
|
|
260
241
|
|
|
261
242
|
|
|
262
243
|
def _show_config_example_callback() -> None:
|
|
@@ -278,73 +259,84 @@ def _show_config_example_callback() -> None:
|
|
|
278
259
|
"""
|
|
279
260
|
|
|
280
261
|
example_config: str = dedent(
|
|
281
|
-
"""
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
[tool.
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
[[
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
type = "free_text"
|
|
300
|
-
admonition = "info"
|
|
301
|
-
prefix = "???+"
|
|
302
|
-
required = false
|
|
303
|
-
|
|
304
|
-
[[tool.dfc.sections]]
|
|
305
|
-
order = 3
|
|
306
|
-
name = "params"
|
|
307
|
-
type = "list_name_and_type"
|
|
308
|
-
required = true
|
|
309
|
-
|
|
310
|
-
[[tool.dfc.sections]]
|
|
311
|
-
order = 4
|
|
312
|
-
name = "returns"
|
|
313
|
-
type = "list_name_and_type"
|
|
314
|
-
required = false
|
|
315
|
-
|
|
316
|
-
[[tool.dfc.sections]]
|
|
317
|
-
order = 5
|
|
318
|
-
name = "yields"
|
|
319
|
-
type = "list_type"
|
|
320
|
-
required = false
|
|
321
|
-
|
|
322
|
-
[[tool.dfc.sections]]
|
|
323
|
-
order = 6
|
|
324
|
-
name = "raises"
|
|
325
|
-
type = "list_type"
|
|
326
|
-
required = false
|
|
327
|
-
|
|
328
|
-
[[tool.dfc.sections]]
|
|
329
|
-
order = 7
|
|
330
|
-
name = "examples"
|
|
331
|
-
type = "free_text"
|
|
332
|
-
admonition = "example"
|
|
333
|
-
prefix = "???+"
|
|
334
|
-
required = false
|
|
335
|
-
|
|
336
|
-
[[tool.dfc.sections]]
|
|
337
|
-
order = 8
|
|
338
|
-
name = "notes"
|
|
339
|
-
type = "free_text"
|
|
340
|
-
admonition = "note"
|
|
341
|
-
prefix = "???"
|
|
342
|
-
required = false
|
|
262
|
+
r"""
|
|
263
|
+
Place the below config in your `pyproject.toml` file.
|
|
264
|
+
|
|
265
|
+
[blue]\[tool.dfc][/blue]
|
|
266
|
+
[green]# or \[tool.docstring-format-checker][/green]
|
|
267
|
+
[blue]allow_undefined_sections = false[/blue]
|
|
268
|
+
[blue]require_docstrings = true[/blue]
|
|
269
|
+
[blue]check_private = true[/blue]
|
|
270
|
+
[blue]sections = [[/blue]
|
|
271
|
+
[blue]{ order = 1, name = "summary", type = "free_text", required = true, admonition = "note", prefix = "!!!" },[/blue]
|
|
272
|
+
[blue]{ order = 2, name = "details", type = "free_text", required = false, admonition = "abstract", prefix = "???+" },[/blue]
|
|
273
|
+
[blue]{ order = 3, name = "params", type = "list_name_and_type", required = false },[/blue]
|
|
274
|
+
[blue]{ order = 4, name = "raises", type = "list_type", required = false },[/blue]
|
|
275
|
+
[blue]{ order = 5, name = "returns", type = "list_name_and_type", required = false },[/blue]
|
|
276
|
+
[blue]{ order = 6, name = "yields", type = "list_type", required = false },[/blue]
|
|
277
|
+
[blue]{ order = 7, name = "examples", type = "free_text", required = false, admonition = "example", prefix = "???+" },[/blue]
|
|
278
|
+
[blue]{ order = 8, name = "notes", type = "free_text", required = false, admonition = "note", prefix = "???" },[/blue]
|
|
279
|
+
[blue]][/blue]
|
|
343
280
|
"""
|
|
344
281
|
).strip()
|
|
345
282
|
|
|
283
|
+
panel = Panel(
|
|
284
|
+
example_config,
|
|
285
|
+
title="Configuration Example",
|
|
286
|
+
title_align="left",
|
|
287
|
+
border_style="dim",
|
|
288
|
+
padding=(0, 1),
|
|
289
|
+
)
|
|
290
|
+
|
|
346
291
|
# Print without Rich markup processing to avoid bracket interpretation
|
|
347
|
-
console.print(
|
|
292
|
+
console.print(panel)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
def _help_callback_main(ctx: Context, param: CallbackParam, value: bool) -> None:
|
|
296
|
+
"""
|
|
297
|
+
!!! note "Summary"
|
|
298
|
+
Show help and exit.
|
|
299
|
+
|
|
300
|
+
Params:
|
|
301
|
+
ctx (Context):
|
|
302
|
+
The context object.
|
|
303
|
+
param (CallbackParam):
|
|
304
|
+
The parameter object.
|
|
305
|
+
value (bool):
|
|
306
|
+
The boolean value indicating if the flag was set.
|
|
307
|
+
|
|
308
|
+
Returns:
|
|
309
|
+
(None):
|
|
310
|
+
Nothing is returned.
|
|
311
|
+
"""
|
|
312
|
+
|
|
313
|
+
# Early exit if help flag is set
|
|
314
|
+
if not value or ctx.resilient_parsing:
|
|
315
|
+
return
|
|
316
|
+
|
|
317
|
+
# Determine terminal width for ASCII art
|
|
318
|
+
try:
|
|
319
|
+
terminal_width: int = os.get_terminal_size().columns
|
|
320
|
+
except OSError:
|
|
321
|
+
terminal_width = 80
|
|
322
|
+
|
|
323
|
+
# Determine title based on terminal width
|
|
324
|
+
title: str = "dfc" if terminal_width < 130 else "docstring-format-checker"
|
|
325
|
+
|
|
326
|
+
# Print ASCII art title
|
|
327
|
+
console.print(
|
|
328
|
+
pyfiglet.figlet_format(title, font="standard", justify="left", width=140),
|
|
329
|
+
style="magenta",
|
|
330
|
+
markup=False,
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
# Show help message
|
|
334
|
+
echo(ctx.get_help())
|
|
335
|
+
|
|
336
|
+
# Show usage and config examples
|
|
337
|
+
_show_usage_examples_callback()
|
|
338
|
+
_show_config_example_callback()
|
|
339
|
+
|
|
348
340
|
raise Exit()
|
|
349
341
|
|
|
350
342
|
|
|
@@ -704,7 +696,3 @@ def entry_point() -> None:
|
|
|
704
696
|
Entry point for the CLI scripts defined in pyproject.toml.
|
|
705
697
|
"""
|
|
706
698
|
app()
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
if __name__ == "__main__":
|
|
710
|
-
app()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|