docstring-format-checker 0.1.0__tar.gz → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docstring-format-checker
3
- Version: 0.1.0
3
+ Version: 0.2.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>
@@ -1,217 +1,217 @@
1
- [project]
2
- name = "docstring-format-checker"
3
- version = "0.1.0"
4
- description = "A CLI tool to check and validate Python docstring formatting and completeness"
5
- readme = "README.md"
6
- license = "MIT"
7
- authors = [
8
- { name="Chris Mahoney", email="docstring-format-checker@data-science-extensions.com" },
9
- ]
10
- maintainers = [
11
- { name="Chris Mahoney", email="docstring-format-checker@data-science-extensions.com" },
12
- ]
13
- classifiers = [
14
- "Development Status :: 4 - Beta",
15
- "License :: OSI Approved :: MIT License",
16
- "Topic :: Software Development :: Quality Assurance",
17
- "Topic :: Software Development :: Libraries :: Python Modules",
18
- "Topic :: Software Development :: Testing :: Unit",
19
- "Topic :: Utilities",
20
- "Programming Language :: Python :: 3",
21
- "Programming Language :: Python :: 3.9",
22
- "Programming Language :: Python :: 3.10",
23
- "Programming Language :: Python :: 3.11",
24
- "Programming Language :: Python :: 3.12",
25
- "Programming Language :: Python :: 3.13",
26
- "Intended Audience :: Developers",
27
- "Environment :: Console",
28
- ]
29
- requires-python = ">=3.9"
30
- dependencies = [
31
- "typer>=0.9.0",
32
- "tomli>=2.0.0;python_version<'3.11'",
33
- "rich>=13.0.0",
34
- "toolbox-python==1.*",
35
- ]
36
-
37
- [project.urls]
38
- Homepage = "https://github.com/data-science-extensions/docstring-format-checker"
39
- Documentation = "https://github.com/data-science-extensions/docstring-format-checker/blob/main/README.md"
40
- Repository = "https://github.com/data-science-extensions/docstring-format-checker"
41
- Changelog = "https://github.com/data-science-extensions/docstring-format-checker/releases"
42
- Issues = "https://github.com/data-science-extensions/docstring-format-checker/issues"
43
-
44
- [project.scripts]
45
- docstring-format-checker = "docstring_format_checker.cli:entry_point"
46
- dfc = "docstring_format_checker.cli:entry_point"
47
-
48
- [dependency-groups]
49
- dev = [
50
- "black==25.*",
51
- "blacken-docs==1.*",
52
- "codespell==2.*",
53
- "ipykernel==6.*",
54
- "isort==6.*",
55
- "pre-commit==4.*",
56
- "pycln==2.*",
57
- "pylint==3.*",
58
- "pyupgrade==3.*",
59
- "uv==0.*",
60
- "pip==25.*",
61
- ]
62
- docs = [
63
- "black==25.*",
64
- "docstring-inheritance==2.*",
65
- "livereload==2.*",
66
- "mike==2.*",
67
- "mkdocs==1.*",
68
- "mkdocs-autorefs==1.*",
69
- "mkdocs-coverage==1.*",
70
- "mkdocs-material==9.*",
71
- "mkdocstrings==0.*",
72
- "mkdocstrings-python==1.*",
73
- "pygithub==2.*",
74
- ]
75
- test = [
76
- "mypy==1.*,!=1.17.*",
77
- "parameterized==0.*",
78
- "pytest==8.*",
79
- "pytest-clarity==1.*",
80
- "pytest-cov==6.*",
81
- "pytest-icdiff==0.*",
82
- "pytest-sugar==1.*",
83
- "pytest-xdist==3.*",
84
- "requests==2.*",
85
- ]
86
-
87
- [tool.black]
88
- line-length = 120
89
- color = true
90
- exclude = '''
91
- /(
92
- \.git
93
- | \.hg
94
- | \.mypy_cache
95
- | \.tox
96
- | \.venv
97
- | _build
98
- | buck-out
99
- | build
100
- | dist
101
- | env
102
- | venv
103
- )/
104
- '''
105
-
106
- [tool.pytest.ini_options]
107
- filterwarnings = [
108
- # "ignore::typeguard.InstrumentationWarning",
109
- "ignore::DeprecationWarning",
110
- ]
111
- addopts = [
112
- "--verbose",
113
- "--verbose",
114
- "--cov=src/docstring_format_checker",
115
- "--cov-report=term",
116
- "--cov-report=html:cov-report/html",
117
- "--cov-report=xml:cov-report/xml/cov-report.xml",
118
- ]
119
- testpaths = [
120
- "src/tests",
121
- ]
122
- python_files = ["test_*.py"]
123
- python_classes = ["Test*"]
124
- python_functions = ["test_*"]
125
-
126
- [tool.mypy]
127
- ignore_missing_imports = true
128
- pretty = true
129
- disable_error_code = [
130
- "valid-type",
131
- "attr-defined",
132
- "no-redef",
133
- ]
134
-
135
- [tool.isort]
136
- import_heading_future = "## Future Python Library Imports ----"
137
- import_heading_stdlib = "## Python StdLib Imports ----"
138
- import_heading_thirdparty = "## Python Third Party Imports ----"
139
- import_heading_firstparty = "## Local First Party Imports ----"
140
- import_heading_localfolder = "## Local Module Imports ----"
141
- profile = "black"
142
- split_on_trailing_comma = true
143
- combine_as_imports = true
144
- lines_after_imports = 2
145
-
146
- [tool.codespell]
147
- ignore-words-list = "demog"
148
-
149
- [tool.bump_version.replacements]
150
- files = [
151
- { file = "src/docstring_format_checker/__init__.py", pattern = "__version__ = \"{VERSION}\"" },
152
- { file = "src/tests/test_version.py", pattern = "__version__ = \"{VERSION}\"" },
153
- { file = "pyproject.toml", pattern = "version = \"{VERSION}\"" },
154
- ]
155
-
156
- [tool.dfc]
157
- # Default configuration for docstring format checker
158
-
159
- [[tool.dfc.sections]]
160
- order = 1
161
- name = "summary"
162
- type = "free_text"
163
- admonition = "note"
164
- prefix = "!!!"
165
- required = true
166
-
167
- [[tool.dfc.sections]]
168
- order = 2
169
- name = "details"
170
- type = "free_text"
171
- admonition = "info"
172
- prefix = "???+"
173
- required = false
174
-
175
- [[tool.dfc.sections]]
176
- order = 3
177
- name = "params"
178
- type = "list_name_and_type"
179
- required = true
180
-
181
- [[tool.dfc.sections]]
182
- order = 4
183
- name = "returns"
184
- type = "list_name_and_type"
185
- required = false
186
-
187
- [[tool.dfc.sections]]
188
- order = 5
189
- name = "yields"
190
- type = "list_type"
191
- required = false
192
-
193
- [[tool.dfc.sections]]
194
- order = 6
195
- name = "raises"
196
- type = "list_type"
197
- required = false
198
-
199
- [[tool.dfc.sections]]
200
- order = 7
201
- name = "examples"
202
- type = "free_text"
203
- admonition = "example"
204
- prefix = "???+"
205
- required = false
206
-
207
- [[tool.dfc.sections]]
208
- order = 8
209
- name = "notes"
210
- type = "free_text"
211
- admonition = "note"
212
- prefix = "???"
213
- required = false
214
-
215
- [build-system]
216
- requires = ["uv_build>=0.7.19,<0.8.0"]
217
- build-backend = "uv_build"
1
+ [project]
2
+ name = "docstring-format-checker"
3
+ version = "v0.2.0"
4
+ description = "A CLI tool to check and validate Python docstring formatting and completeness"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ authors = [
8
+ { name="Chris Mahoney", email="docstring-format-checker@data-science-extensions.com" },
9
+ ]
10
+ maintainers = [
11
+ { name="Chris Mahoney", email="docstring-format-checker@data-science-extensions.com" },
12
+ ]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Topic :: Software Development :: Quality Assurance",
17
+ "Topic :: Software Development :: Libraries :: Python Modules",
18
+ "Topic :: Software Development :: Testing :: Unit",
19
+ "Topic :: Utilities",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.9",
22
+ "Programming Language :: Python :: 3.10",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Intended Audience :: Developers",
27
+ "Environment :: Console",
28
+ ]
29
+ requires-python = ">=3.9"
30
+ dependencies = [
31
+ "typer>=0.9.0",
32
+ "tomli>=2.0.0;python_version<'3.11'",
33
+ "rich>=13.0.0",
34
+ "toolbox-python==1.*",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/data-science-extensions/docstring-format-checker"
39
+ Documentation = "https://github.com/data-science-extensions/docstring-format-checker/blob/main/README.md"
40
+ Repository = "https://github.com/data-science-extensions/docstring-format-checker"
41
+ Changelog = "https://github.com/data-science-extensions/docstring-format-checker/releases"
42
+ Issues = "https://github.com/data-science-extensions/docstring-format-checker/issues"
43
+
44
+ [project.scripts]
45
+ docstring-format-checker = "docstring_format_checker.cli:entry_point"
46
+ dfc = "docstring_format_checker.cli:entry_point"
47
+
48
+ [dependency-groups]
49
+ dev = [
50
+ "black==25.*",
51
+ "blacken-docs==1.*",
52
+ "codespell==2.*",
53
+ "ipykernel==6.*",
54
+ "isort==6.*",
55
+ "pre-commit==4.*",
56
+ "pycln==2.*",
57
+ "pylint==3.*",
58
+ "pyupgrade==3.*",
59
+ "uv==0.*",
60
+ "pip==25.*",
61
+ ]
62
+ docs = [
63
+ "black==25.*",
64
+ "docstring-inheritance==2.*",
65
+ "livereload==2.*",
66
+ "mike==2.*",
67
+ "mkdocs==1.*",
68
+ "mkdocs-autorefs==1.*",
69
+ "mkdocs-coverage==1.*",
70
+ "mkdocs-material==9.*",
71
+ "mkdocstrings==0.*",
72
+ "mkdocstrings-python==1.*",
73
+ "pygithub==2.*",
74
+ ]
75
+ test = [
76
+ "mypy==1.*,!=1.17.*",
77
+ "parameterized==0.*",
78
+ "pytest==8.*",
79
+ "pytest-clarity==1.*",
80
+ "pytest-cov==6.*",
81
+ "pytest-icdiff==0.*",
82
+ "pytest-sugar==1.*",
83
+ "pytest-xdist==3.*",
84
+ "requests==2.*",
85
+ ]
86
+
87
+ [tool.black]
88
+ line-length = 120
89
+ color = true
90
+ exclude = '''
91
+ /(
92
+ \.git
93
+ | \.hg
94
+ | \.mypy_cache
95
+ | \.tox
96
+ | \.venv
97
+ | _build
98
+ | buck-out
99
+ | build
100
+ | dist
101
+ | env
102
+ | venv
103
+ )/
104
+ '''
105
+
106
+ [tool.pytest.ini_options]
107
+ filterwarnings = [
108
+ # "ignore::typeguard.InstrumentationWarning",
109
+ "ignore::DeprecationWarning",
110
+ ]
111
+ addopts = [
112
+ "--verbose",
113
+ "--verbose",
114
+ "--cov=src/docstring_format_checker",
115
+ "--cov-report=term",
116
+ "--cov-report=html:cov-report/html",
117
+ "--cov-report=xml:cov-report/xml/cov-report.xml",
118
+ ]
119
+ testpaths = [
120
+ "src/tests",
121
+ ]
122
+ python_files = ["test_*.py"]
123
+ python_classes = ["Test*"]
124
+ python_functions = ["test_*"]
125
+
126
+ [tool.mypy]
127
+ ignore_missing_imports = true
128
+ pretty = true
129
+ disable_error_code = [
130
+ "valid-type",
131
+ "attr-defined",
132
+ "no-redef",
133
+ ]
134
+
135
+ [tool.isort]
136
+ import_heading_future = "## Future Python Library Imports ----"
137
+ import_heading_stdlib = "## Python StdLib Imports ----"
138
+ import_heading_thirdparty = "## Python Third Party Imports ----"
139
+ import_heading_firstparty = "## Local First Party Imports ----"
140
+ import_heading_localfolder = "## Local Module Imports ----"
141
+ profile = "black"
142
+ split_on_trailing_comma = true
143
+ combine_as_imports = true
144
+ lines_after_imports = 2
145
+
146
+ [tool.codespell]
147
+ ignore-words-list = "demog"
148
+
149
+ [tool.bump_version.replacements]
150
+ files = [
151
+ { file = "src/docstring_format_checker/__init__.py", pattern = "__version__ = \"{VERSION}\"" },
152
+ { file = "src/tests/test_version.py", pattern = "__version__ = \"{VERSION}\"" },
153
+ { file = "pyproject.toml", pattern = "version = \"{VERSION}\"" },
154
+ ]
155
+
156
+ [tool.dfc]
157
+ # Default configuration for docstring format checker
158
+
159
+ [[tool.dfc.sections]]
160
+ order = 1
161
+ name = "summary"
162
+ type = "free_text"
163
+ admonition = "note"
164
+ prefix = "!!!"
165
+ required = true
166
+
167
+ [[tool.dfc.sections]]
168
+ order = 2
169
+ name = "details"
170
+ type = "free_text"
171
+ admonition = "info"
172
+ prefix = "???+"
173
+ required = false
174
+
175
+ [[tool.dfc.sections]]
176
+ order = 3
177
+ name = "params"
178
+ type = "list_name_and_type"
179
+ required = true
180
+
181
+ [[tool.dfc.sections]]
182
+ order = 4
183
+ name = "returns"
184
+ type = "list_name_and_type"
185
+ required = false
186
+
187
+ [[tool.dfc.sections]]
188
+ order = 5
189
+ name = "yields"
190
+ type = "list_type"
191
+ required = false
192
+
193
+ [[tool.dfc.sections]]
194
+ order = 6
195
+ name = "raises"
196
+ type = "list_type"
197
+ required = false
198
+
199
+ [[tool.dfc.sections]]
200
+ order = 7
201
+ name = "examples"
202
+ type = "free_text"
203
+ admonition = "example"
204
+ prefix = "???+"
205
+ required = false
206
+
207
+ [[tool.dfc.sections]]
208
+ order = 8
209
+ name = "notes"
210
+ type = "free_text"
211
+ admonition = "note"
212
+ prefix = "???"
213
+ required = false
214
+
215
+ [build-system]
216
+ requires = ["uv_build>=0.7.19,<0.8.0"]
217
+ build-backend = "uv_build"
@@ -1,22 +1,22 @@
1
- """
2
- Docstring Format Checker.
3
-
4
- A CLI tool to check and validate Python docstring formatting and completeness.
5
- """
6
-
7
- __version__ = "0.1.0"
8
- __author__ = "Chris Mahoney"
9
- __email__ = "docstring-format-checker@data-science-extensions.com"
10
-
11
-
12
- # ## Local First Party Imports ----
13
- from docstring_format_checker.config import DEFAULT_CONFIG, load_config
14
- from docstring_format_checker.core import DocstringChecker, SectionConfig
15
-
16
-
17
- __all__: list[str] = [
18
- "DocstringChecker",
19
- "SectionConfig",
20
- "load_config",
21
- "DEFAULT_CONFIG",
22
- ]
1
+ """
2
+ Docstring Format Checker.
3
+
4
+ A CLI tool to check and validate Python docstring formatting and completeness.
5
+ """
6
+
7
+ __version__ = "v0.2.0"
8
+ __author__ = "Chris Mahoney"
9
+ __email__ = "docstring-format-checker@data-science-extensions.com"
10
+
11
+
12
+ # ## Local First Party Imports ----
13
+ from docstring_format_checker.config import DEFAULT_CONFIG, load_config
14
+ from docstring_format_checker.core import DocstringChecker, SectionConfig
15
+
16
+
17
+ __all__: list[str] = [
18
+ "DocstringChecker",
19
+ "SectionConfig",
20
+ "load_config",
21
+ "DEFAULT_CONFIG",
22
+ ]
@@ -242,6 +242,28 @@ class DocstringChecker:
242
242
 
243
243
  return results
244
244
 
245
+ def _is_overload_function(self, node: Union[ast.FunctionDef, ast.AsyncFunctionDef]) -> bool:
246
+ """
247
+ !!! note "Summary"
248
+ Check if a function definition is decorated with @overload.
249
+
250
+ Params:
251
+ node (Union[ast.FunctionDef, ast.AsyncFunctionDef]):
252
+ The function node to check for @overload decorator.
253
+
254
+ Returns:
255
+ (bool):
256
+ True if the function has @overload decorator, False otherwise.
257
+ """
258
+ for decorator in node.decorator_list:
259
+ # Handle direct name reference: @overload
260
+ if isinstance(decorator, ast.Name) and decorator.id == "overload":
261
+ return True
262
+ # Handle attribute reference: @typing.overload
263
+ elif isinstance(decorator, ast.Attribute) and decorator.attr == "overload":
264
+ return True
265
+ return False
266
+
245
267
  def _extract_items(self, tree: ast.AST) -> list[FunctionAndClassDetails]:
246
268
  """
247
269
  !!! note "Summary"
@@ -260,8 +282,9 @@ class DocstringChecker:
260
282
 
261
283
  class ItemVisitor(ast.NodeVisitor):
262
284
 
263
- def __init__(self) -> None:
285
+ def __init__(self, checker: DocstringChecker) -> None:
264
286
  self.class_stack: list[str] = []
287
+ self.checker: DocstringChecker = checker
265
288
 
266
289
  def visit_ClassDef(self, node: ast.ClassDef) -> None:
267
290
  if not node.name.startswith("_"): # Skip private classes
@@ -288,23 +311,27 @@ class DocstringChecker:
288
311
 
289
312
  def _visit_function(self, node: Union[ast.FunctionDef, ast.AsyncFunctionDef]) -> None:
290
313
  """Visit function definition node (sync or async)."""
291
- if not node.name.startswith("_"): # Skip private functions
292
- item_type: Literal["function", "method"] = "method" if self.class_stack else "function"
293
- parent_class: Optional[str] = self.class_stack[-1] if self.class_stack else None
294
314
 
295
- items.append(
296
- FunctionAndClassDetails(
297
- item_type=item_type,
298
- name=node.name,
299
- node=node,
300
- lineno=node.lineno,
301
- parent_class=parent_class,
315
+ if not node.name.startswith("_"): # Skip private functions
316
+ # Skip @overload functions - they don't need docstrings
317
+
318
+ if not self.checker._is_overload_function(node):
319
+ item_type: Literal["function", "method"] = "method" if self.class_stack else "function"
320
+ parent_class: Optional[str] = self.class_stack[-1] if self.class_stack else None
321
+
322
+ items.append(
323
+ FunctionAndClassDetails(
324
+ item_type=item_type,
325
+ name=node.name,
326
+ node=node,
327
+ lineno=node.lineno,
328
+ parent_class=parent_class,
329
+ )
302
330
  )
303
- )
304
331
 
305
332
  self.generic_visit(node)
306
333
 
307
- visitor = ItemVisitor()
334
+ visitor = ItemVisitor(self)
308
335
  visitor.visit(tree)
309
336
 
310
337
  return items