pycodecommenter 2.0.3__py3-none-any.whl

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.
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycodecommenter
3
+ Version: 2.0.3
4
+ Summary: Automatically generate, validate, and maintain Google-style docstrings for Python code
5
+ Author-email: Amos Quety <amosnabasa4@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/AmosQuety/PyCodeCommenter
8
+ Project-URL: Documentation, https://github.com/AmosQuety/PyCodeCommenter/blob/main/README.md
9
+ Project-URL: Repository, https://github.com/AmosQuety/PyCodeCommenter
10
+ Project-URL: Bug Tracker, https://github.com/AmosQuety/PyCodeCommenter/issues
11
+ Keywords: documentation,docstring,validation,coverage,python
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Software Development :: Documentation
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0; extra == "dev"
28
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
29
+ Requires-Dist: black>=23.0; extra == "dev"
30
+ Requires-Dist: flake8>=6.0; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ # PyCodeCommenter 🚀
34
+
35
+ [![PyPI version](https://badge.fury.io/py/pycodecommenter.svg)](https://pypi.org/project/pycodecommenter/)
36
+ [![Python Support](https://img.shields.io/pypi/pyversions/pycodecommenter.svg)](https://pypi.org/project/pycodecommenter/)
37
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
38
+ [![GitHub](https://img.shields.io/github/stars/AmosQuety/PyCodeCommenter?style=social)](https://github.com/AmosQuety/PyCodeCommenter)
39
+
40
+ **The Python documentation tool that developers actually want to use.**
41
+
42
+ PyCodeCommenter automatically generates, validates, and maintains Google-style docstrings for your Python code. Unlike AI-based tools, it provides **deterministic, rule-based validation** that catches documentation issues AI might miss.
43
+
44
+ ## Why PyCodeCommenter?
45
+
46
+ ### The Problem
47
+ - AI tools generate inconsistent documentation
48
+ - No way to validate existing docstrings against code
49
+ - Documentation drift as code evolves
50
+ - No coverage metrics for documentation quality
51
+
52
+ ### The Solution
53
+ - **Generate** professional docstrings automatically
54
+ - **Validate** existing docs against actual code signatures
55
+ - **Track** documentation coverage across projects
56
+ - **Integrate** with CI/CD pipelines
57
+
58
+ ### Terminal Usage
59
+ ```bash
60
+ # Generate docstrings for a file
61
+ pycodecommenter generate main.py -i
62
+
63
+ # Validate documentation
64
+ pycodecommenter validate main.py
65
+
66
+ # Check project coverage
67
+ pycodecommenter coverage .
68
+ ```
69
+
70
+ ## Features
71
+
72
+ ### Comprehensive Validation
73
+ Six types of validation checks:
74
+ - **Signature Matching**: Params in code match docstring
75
+ - **Type Consistency**: Type hints match documented types
76
+ - **Exception Documentation**: Raised exceptions are documented
77
+ - **Return Documentation**: Return values properly documented
78
+ - **Format Compliance**: Follows Google-style guidelines
79
+ - **Content Quality**: No placeholders or TODOs
80
+
81
+ ### Coverage Reporting
82
+ - Per-file coverage metrics
83
+ - Project-wide statistics
84
+ - Export to JSON, Markdown, or console
85
+ - CI/CD integration ready
86
+
87
+ ### Modern Python Support
88
+ - Python 3.8+ support
89
+ - Async functions (`async def`)
90
+ - Complex type hints (`Union`, `Optional`, `Generic`)
91
+ - PEP 604 unions (`int | str`)
92
+ - PEP 585 generics (`list[int]`)
93
+
94
+ ### Developer-Friendly
95
+ - Beautiful console output
96
+ - Actionable error messages
97
+ - Multiple export formats
98
+ - Fast AST-based analysis (no API calls)
99
+
100
+ ## Usage Examples
101
+
102
+ ### Example 1: Basic Generation
103
+ ```python
104
+ from PyCodeCommenter import PyCodeCommenter
105
+
106
+ code = """
107
+ def calculate_discount(price: float, rate: float = 0.1) -> float:
108
+ return price * (1 - rate)
109
+ """
110
+
111
+ commenter = PyCodeCommenter().from_string(code)
112
+ docstrings = commenter.generate_docstrings()
113
+ print(commenter.get_patched_code())
114
+ ```
115
+
116
+ **Output:**
117
+ ```python
118
+ def calculate_discount(price: float, rate: float = 0.1) -> float:
119
+ """Calculate discount.
120
+
121
+ Calculates the discount.
122
+
123
+ Args:
124
+ price (float): Price of the object.
125
+ rate (float): Rate of the object. (default: 0.1)
126
+
127
+ Returns:
128
+ float: Description of the return value.
129
+ """
130
+ return price * (1 - rate)
131
+ ```
132
+
133
+ ### Example 2: Validation in CI/CD
134
+ ```python
135
+ # validate_docs.py
136
+ import sys
137
+ from PyCodeCommenter import PyCodeCommenter
138
+
139
+ commenter = PyCodeCommenter().from_file("src/main.py")
140
+ report = commenter.validate()
141
+
142
+ if report.stats.errors > 0:
143
+ report.print_summary()
144
+ sys.exit(1) # Fail CI build
145
+
146
+ print(f"✓ Documentation validated: {report.stats.coverage_percentage:.1f}% coverage")
147
+ ```
148
+
149
+ ### Example 3: Coverage Enforcement
150
+ ```python
151
+ from PyCodeCommenter import CoverageAnalyzer
152
+
153
+ analyzer = CoverageAnalyzer()
154
+ project = analyzer.analyze_directory("./src", exclude_patterns=['tests'])
155
+
156
+ if project.total_coverage < 80.0:
157
+ print(f"❌ Coverage {project.total_coverage:.1f}% below threshold 80%")
158
+ project.print_report()
159
+ sys.exit(1)
160
+
161
+ print(f"✓ Coverage {project.total_coverage:.1f}% meets threshold")
162
+ ```
163
+
164
+ ### Example 4: Export Reports
165
+ ```python
166
+ import json
167
+ from PyCodeCommenter import PyCodeCommenter
168
+
169
+ commenter = PyCodeCommenter().from_file("mycode.py")
170
+ report = commenter.validate()
171
+
172
+ # JSON export
173
+ with open("validation_report.json", "w") as f:
174
+ json.dump(report.to_dict(), f, indent=2)
175
+
176
+ # Markdown export
177
+ with open("validation_report.md", "w") as f:
178
+ f.write(report.to_markdown())
179
+ ```
180
+
181
+ ## Configuration
182
+ Create `.pycodecommenter.yaml` in your project root:
183
+ ```yaml
184
+ style: google # or 'numpy', 'sphinx'
185
+ validation:
186
+ level: strict # or 'moderate', 'lenient'
187
+ check_types: true
188
+ check_exceptions: true
189
+ coverage:
190
+ threshold: 80
191
+ fail_below: true
192
+ exclude:
193
+ - "*/tests/*"
194
+ - "*/migrations/*"
195
+ - "*/__pycache__/*"
196
+ ```
197
+
198
+ ## Use Cases
199
+ ### For Individual Developers
200
+ - Generate documentation for new functions quickly
201
+ - Validate docs before committing
202
+ - Track documentation coverage
203
+
204
+ ### For Teams
205
+ - Enforce documentation standards in CI/CD
206
+ - Prevent PRs with undocumented code
207
+ - Maintain consistent documentation style
208
+
209
+ ### For Open Source Projects
210
+ - Welcome contributors with clear doc requirements
211
+ - Automated documentation checks in PRs
212
+ - Public coverage badges
213
+
214
+ ## Integration
215
+
216
+ ### Pre-commit Hook
217
+ ```yaml
218
+ # .pre-commit-config.yaml
219
+ repos:
220
+ - repo: local
221
+ hooks:
222
+ - id: validate-docstrings
223
+ name: Validate Docstrings
224
+ entry: pycodecommenter validate .
225
+ language: system
226
+ types: [python]
227
+ ```
228
+
229
+ ### GitHub Actions
230
+ ```yaml
231
+ # .github/workflows/docs.yml
232
+ name: Documentation Check
233
+
234
+ on: [push, pull_request]
235
+
236
+ jobs:
237
+ validate:
238
+ runs-on: ubuntu-latest
239
+ steps:
240
+ - uses: actions/checkout@v2
241
+ - name: Set up Python
242
+ uses: actions/setup-python@v2
243
+ with:
244
+ python-version: '3.9'
245
+ - name: Install dependencies
246
+ run: pip install pycodecommenter
247
+ - name: Validate documentation
248
+ run: pycodecommenter validate .
249
+ ```
250
+
251
+ ## Documentation
252
+ - **User Guide** - Comprehensive usage guide
253
+ - **API Reference** - Complete API documentation
254
+ - **Configuration** - Configuration options
255
+ - **Contributing** - How to contribute
256
+
257
+ ## Known Limitations
258
+ - Does not support Python 2.x (EOL)
259
+ - Match statements (Python 3.10+) have basic support
260
+ - Complex decorators may affect docstring placement
261
+
262
+ ## Roadmap
263
+ - [ ] VS Code extension
264
+ - [ ] Smart docstring updates (preserve human content)
265
+ - [ ] AI-powered generation (optional)
266
+ - [ ] NumPy and Sphinx style support
267
+ - [ ] GitHub Action for automated PRs
268
+
269
+ ## License
270
+ MIT License - see [LICENSE](LICENSE) file for details.
271
+
272
+ ## Contributing
273
+ Contributions welcome! Please read `CONTRIBUTING.md` first.
274
+
275
+ ## Show Your Support
276
+ If PyCodeCommenter helped you, please star the repo! It helps others discover the project.
277
+
278
+ ## Contact
279
+ - **Issues**: [GitHub Issues](https://github.com/AmosQuety/PyCodeCommenter/issues)
280
+ - **Discussions**: [GitHub Discussions](https://github.com/AmosQuety/PyCodeCommenter/discussions)
281
+
@@ -0,0 +1,15 @@
1
+ PyCodeCommenter/__init__.py,sha256=lWNtYjXr-Foe4Bu9ShKeXddqTjU0lPtOp9fUS5knZyI,800
2
+ PyCodeCommenter/cli.py,sha256=Seog190BKtumAfwiqH8TgpMYTCpgzHzGqE5VzfZAtMo,2878
3
+ PyCodeCommenter/commenter.py,sha256=iO1kcOu4-qG_T7rQNceB6NwEOwT7qPN5oCw9UwBvqy8,18383
4
+ PyCodeCommenter/coverage.py,sha256=EWOHo4CPyEyjy76n4zrJBkROydJari-ek0uNNEY7ICU,4721
5
+ PyCodeCommenter/docstring_parser.py,sha256=yImIYPgy7ZTuhVfL837vCGpMkvTiJkbbgmroi92iqDo,4600
6
+ PyCodeCommenter/parameter_descriptions.py,sha256=QTc9ZpRxP6s8xmdMUiLEyW16uC2edC49fHaMri-mUSs,2530
7
+ PyCodeCommenter/templates.py,sha256=NVQ7owE9kKOu0aJwl2VFBoJw2Wy5Hei4bm4bSQVo4iA,5932
8
+ PyCodeCommenter/type_analyzer.py,sha256=Kpvphb88egpWZQ324IJ-OCHtxCGF0ob29Lik0sZ34cI,6949
9
+ PyCodeCommenter/validator.py,sha256=1HnWuVDZjgp4XKjQ2msjUMrU0keD3-AzSp91nOBtrJc,23424
10
+ pycodecommenter-2.0.3.dist-info/licenses/LICENSE,sha256=8p3TvU2B1FY__xFIPqYBoGk_-qckZGLROyHwwySc-0I,1087
11
+ pycodecommenter-2.0.3.dist-info/METADATA,sha256=UaCrriTmU0g0351ytYJLUHjtvWF1JeIys4tYF1imQJM,8590
12
+ pycodecommenter-2.0.3.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
13
+ pycodecommenter-2.0.3.dist-info/entry_points.txt,sha256=T5dBrm6mltFaGL7OaZMSj1Uw3Jv8PLkQZGb9O4WN7iM,61
14
+ pycodecommenter-2.0.3.dist-info/top_level.txt,sha256=J0aVA0MqttB-7SkjFw5qSuGVhyhfWUVMs61_HU-rhBA,16
15
+ pycodecommenter-2.0.3.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.10.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pycodecommenter = PyCodeCommenter.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AmosQuety
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ PyCodeCommenter