code2docs 0.2.1__tar.gz → 0.2.10__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.
- code2docs-0.2.10/PKG-INFO +830 -0
- code2docs-0.2.10/README.md +780 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/__init__.py +1 -1
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/analyzers/docstring_extractor.py +31 -10
- code2docs-0.2.10/code2docs/base.py +46 -0
- code2docs-0.2.10/code2docs/cli.py +316 -0
- code2docs-0.2.10/code2docs/config.py +296 -0
- code2docs-0.2.10/code2docs/examples/advanced_usage.py +90 -0
- code2docs-0.2.10/code2docs/examples/quickstart.py +50 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/__init__.py +8 -2
- code2docs-0.2.10/code2docs/generators/_registry_adapters.py +251 -0
- code2docs-0.2.10/code2docs/generators/_source_links.py +76 -0
- code2docs-0.2.10/code2docs/generators/api_reference_gen.py +163 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/architecture_gen.py +122 -20
- code2docs-0.2.10/code2docs/generators/code2llm_gen.py +206 -0
- code2docs-0.2.10/code2docs/generators/config_docs_gen.py +125 -0
- code2docs-0.2.10/code2docs/generators/contributing_gen.py +136 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/coverage_gen.py +32 -13
- code2docs-0.2.10/code2docs/generators/examples_gen.py +399 -0
- code2docs-0.2.10/code2docs/generators/getting_started_gen.py +166 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/mkdocs_gen.py +4 -13
- code2docs-0.2.10/code2docs/generators/module_docs_gen.py +198 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/readme_gen.py +206 -3
- code2docs-0.2.10/code2docs/llm_helper.py +161 -0
- code2docs-0.2.10/code2docs/registry.py +39 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/sync/updater.py +7 -33
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/templates/module_doc.md.j2 +1 -1
- code2docs-0.2.10/code2docs/templates/readme.md.j2 +294 -0
- code2docs-0.2.10/code2docs.egg-info/PKG-INFO +830 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs.egg-info/SOURCES.txt +13 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs.egg-info/requires.txt +13 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/pyproject.toml +7 -1
- {code2docs-0.2.1 → code2docs-0.2.10}/tests/test_cli.py +26 -3
- {code2docs-0.2.1 → code2docs-0.2.10}/tests/test_generators.py +164 -88
- code2docs-0.2.10/tests/test_llm_helper.py +273 -0
- code2docs-0.2.10/tests/test_registry.py +218 -0
- code2docs-0.2.1/PKG-INFO +0 -335
- code2docs-0.2.1/README.md +0 -295
- code2docs-0.2.1/code2docs/cli.py +0 -269
- code2docs-0.2.1/code2docs/config.py +0 -158
- code2docs-0.2.1/code2docs/generators/api_reference_gen.py +0 -162
- code2docs-0.2.1/code2docs/generators/examples_gen.py +0 -198
- code2docs-0.2.1/code2docs/generators/module_docs_gen.py +0 -220
- code2docs-0.2.1/code2docs/templates/readme.md.j2 +0 -85
- code2docs-0.2.1/code2docs.egg-info/PKG-INFO +0 -335
- {code2docs-0.2.1 → code2docs-0.2.10}/LICENSE +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/__main__.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/analyzers/__init__.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/analyzers/dependency_scanner.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/analyzers/endpoint_detector.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/analyzers/project_scanner.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/formatters/__init__.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/formatters/badges.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/formatters/markdown.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/formatters/toc.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/api_changelog_gen.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/changelog_gen.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/generators/depgraph_gen.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/sync/__init__.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/sync/differ.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/sync/watcher.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/templates/api_module.md.j2 +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/templates/architecture.md.j2 +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/templates/example_usage.py.j2 +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs/templates/index.md.j2 +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs.egg-info/dependency_links.txt +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs.egg-info/entry_points.txt +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/code2docs.egg-info/top_level.txt +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/setup.cfg +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/tests/test_analyzers.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/tests/test_code2docs.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/tests/test_config.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/tests/test_formatters.py +0 -0
- {code2docs-0.2.1 → code2docs-0.2.10}/tests/test_sync.py +0 -0
|
@@ -0,0 +1,830 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code2docs
|
|
3
|
+
Version: 0.2.10
|
|
4
|
+
Summary: Auto-generate and sync project documentation from source code analysis
|
|
5
|
+
Author-email: Tom Sapletta <tom@sapletta.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/wronai/code2docs
|
|
8
|
+
Project-URL: Repository, https://github.com/wronai/code2docs
|
|
9
|
+
Project-URL: Issues, https://github.com/wronai/code2docs/issues
|
|
10
|
+
Keywords: documentation,auto-docs,readme-generator,api-reference,code-analysis,static-analysis,markdown
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
20
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: code2llm>=0.5.0
|
|
25
|
+
Requires-Dist: jinja2>=3.1
|
|
26
|
+
Requires-Dist: click>=8.0
|
|
27
|
+
Requires-Dist: pyyaml>=6.0
|
|
28
|
+
Requires-Dist: rich>=13.0
|
|
29
|
+
Provides-Extra: llm
|
|
30
|
+
Requires-Dist: litellm>=1.0; extra == "llm"
|
|
31
|
+
Requires-Dist: python-dotenv>=1.0; extra == "llm"
|
|
32
|
+
Provides-Extra: git
|
|
33
|
+
Requires-Dist: gitpython>=3.1; extra == "git"
|
|
34
|
+
Provides-Extra: watch
|
|
35
|
+
Requires-Dist: watchdog>=3.0; extra == "watch"
|
|
36
|
+
Provides-Extra: mkdocs
|
|
37
|
+
Requires-Dist: mkdocs>=1.5; extra == "mkdocs"
|
|
38
|
+
Requires-Dist: mkdocs-material>=9.0; extra == "mkdocs"
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
42
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
43
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
44
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
45
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
46
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
47
|
+
Provides-Extra: all
|
|
48
|
+
Requires-Dist: code2docs[git,llm,mkdocs,watch]; extra == "all"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# code2docs
|
|
52
|
+
|
|
53
|
+
  
|
|
54
|
+
|
|
55
|
+
> Auto-generate and sync project documentation from source code analysis.
|
|
56
|
+
|
|
57
|
+
**code2docs** uses [code2llm](https://github.com/wronai/code2llm)'s `AnalysisResult` to produce human-readable documentation: README.md, API references, module docs, usage examples, and architecture diagrams.
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
code2llm → AnalysisResult → .toon / .mmd / context.md (for LLM)
|
|
61
|
+
code2docs → AnalysisResult → README.md / docs/ / examples/ (for humans)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install code2docs
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Or from source:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/wronai/code2docs
|
|
74
|
+
cd code2docs
|
|
75
|
+
pip install -e .
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Optional extras
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pip install code2docs[watch] # file watcher (watchdog)
|
|
82
|
+
pip install code2docs[mkdocs] # MkDocs integration
|
|
83
|
+
pip install code2docs[dev] # development tools
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Quick Start
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Generate full documentation for a project
|
|
90
|
+
code2docs ./my-project
|
|
91
|
+
|
|
92
|
+
# Generate only README
|
|
93
|
+
code2docs ./my-project --readme-only
|
|
94
|
+
|
|
95
|
+
# Sync (regenerate only changed modules)
|
|
96
|
+
code2docs sync ./my-project
|
|
97
|
+
|
|
98
|
+
# Watch mode (auto-resync on file changes)
|
|
99
|
+
code2docs watch ./my-project
|
|
100
|
+
|
|
101
|
+
# Initialize config file
|
|
102
|
+
code2docs init ./my-project
|
|
103
|
+
|
|
104
|
+
# Dry-run (show what would be generated)
|
|
105
|
+
code2docs ./my-project --dry-run
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Python API
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from code2docs import generate_readme, generate_docs, Code2DocsConfig
|
|
112
|
+
|
|
113
|
+
# Generate README
|
|
114
|
+
generate_readme("./my-project", output="README.md")
|
|
115
|
+
|
|
116
|
+
# Generate full docs with custom config
|
|
117
|
+
config = Code2DocsConfig(project_name="mylib", verbose=True)
|
|
118
|
+
docs = generate_docs("./my-project", config=config)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Generated Output
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
<project>/
|
|
125
|
+
├── README.md # Main README (auto-generated sections)
|
|
126
|
+
├── docs/
|
|
127
|
+
│ ├── index.md # Documentation index
|
|
128
|
+
│ ├── architecture.md # Architecture + Mermaid diagrams
|
|
129
|
+
│ ├── api/
|
|
130
|
+
│ │ ├── index.md # API overview
|
|
131
|
+
│ │ ├── module_analyzer.md # Per-module API reference
|
|
132
|
+
│ │ └── ...
|
|
133
|
+
│ └── modules/
|
|
134
|
+
│ ├── analyzer.md # Detailed module documentation
|
|
135
|
+
│ └── ...
|
|
136
|
+
├── examples/
|
|
137
|
+
│ ├── basic_usage.py # Auto-generated usage example
|
|
138
|
+
│ ├── class_examples.py # Class usage examples
|
|
139
|
+
│ └── ...
|
|
140
|
+
└── code2docs.yaml # Generator configuration
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Configuration
|
|
144
|
+
|
|
145
|
+
Create `code2docs.yaml` in your project root (or run `code2docs init`):
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
project:
|
|
149
|
+
name: my-project
|
|
150
|
+
source: ./
|
|
151
|
+
output: ./docs/
|
|
152
|
+
|
|
153
|
+
readme:
|
|
154
|
+
sections:
|
|
155
|
+
- overview
|
|
156
|
+
- install
|
|
157
|
+
- quickstart
|
|
158
|
+
- api
|
|
159
|
+
- structure
|
|
160
|
+
- endpoints
|
|
161
|
+
badges:
|
|
162
|
+
- version
|
|
163
|
+
- python
|
|
164
|
+
- coverage
|
|
165
|
+
- complexity
|
|
166
|
+
sync_markers: true
|
|
167
|
+
|
|
168
|
+
docs:
|
|
169
|
+
api_reference: true
|
|
170
|
+
module_docs: true
|
|
171
|
+
architecture: true
|
|
172
|
+
changelog: true
|
|
173
|
+
|
|
174
|
+
examples:
|
|
175
|
+
auto_generate: true
|
|
176
|
+
from_entry_points: true
|
|
177
|
+
|
|
178
|
+
sync:
|
|
179
|
+
strategy: markers # markers | full | git-diff
|
|
180
|
+
watch: false
|
|
181
|
+
ignore:
|
|
182
|
+
- "tests/"
|
|
183
|
+
- "__pycache__"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Sync Markers
|
|
187
|
+
|
|
188
|
+
code2docs can update only specific sections of an existing README using markers:
|
|
189
|
+
|
|
190
|
+
```markdown
|
|
191
|
+
<!-- code2docs:start --># code2docs
|
|
192
|
+
|
|
193
|
+
   
|
|
194
|
+
> **276** functions | **57** classes | **51** files | CC̄ = 3.8
|
|
195
|
+
|
|
196
|
+
> Auto-generated project documentation from source code analysis.
|
|
197
|
+
|
|
198
|
+
**Author:** Tom Sapletta
|
|
199
|
+
**License:** Apache-2.0[(LICENSE)](./LICENSE)
|
|
200
|
+
**Repository:** [https://github.com/wronai/code2docs](https://github.com/wronai/code2docs)
|
|
201
|
+
|
|
202
|
+
## Installation
|
|
203
|
+
|
|
204
|
+
### From PyPI
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
pip install code2docs
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### From Source
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
git clone https://github.com/wronai/code2docs
|
|
214
|
+
cd code2docs
|
|
215
|
+
pip install -e .
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Optional Extras
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
pip install code2docs[llm] # LLM integration (litellm)
|
|
222
|
+
pip install code2docs[git] # Git integration (GitPython)
|
|
223
|
+
pip install code2docs[watch] # file watcher (watchdog)
|
|
224
|
+
pip install code2docs[mkdocs] # MkDocs integration
|
|
225
|
+
pip install code2docs[dev] # development tools
|
|
226
|
+
pip install code2docs[all] # all optional features
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Quick Start
|
|
230
|
+
|
|
231
|
+
### CLI Usage
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Generate full documentation for your project
|
|
235
|
+
code2docs ./my-project
|
|
236
|
+
|
|
237
|
+
# Only regenerate README
|
|
238
|
+
code2docs ./my-project --readme-only
|
|
239
|
+
|
|
240
|
+
# Preview what would be generated (no file writes)
|
|
241
|
+
code2docs ./my-project --dry-run
|
|
242
|
+
|
|
243
|
+
# Check documentation health
|
|
244
|
+
code2docs check ./my-project
|
|
245
|
+
|
|
246
|
+
# Sync — regenerate only changed modules
|
|
247
|
+
code2docs sync ./my-project
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Python API
|
|
251
|
+
|
|
252
|
+
```python
|
|
253
|
+
from code2docs import generate_readme, generate_docs, Code2DocsConfig
|
|
254
|
+
|
|
255
|
+
# Quick: generate README
|
|
256
|
+
generate_readme("./my-project")
|
|
257
|
+
|
|
258
|
+
# Full: generate all documentation
|
|
259
|
+
config = Code2DocsConfig(project_name="mylib", verbose=True)
|
|
260
|
+
docs = generate_docs("./my-project", config=config)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## Generated Output
|
|
264
|
+
|
|
265
|
+
When you run `code2docs`, the following files are produced:
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
<project>/
|
|
269
|
+
├── README.md # Main project README (auto-generated sections)
|
|
270
|
+
├── docs/
|
|
271
|
+
│ ├── api.md # Consolidated API reference
|
|
272
|
+
│ ├── modules.md # Module documentation with metrics
|
|
273
|
+
│ ├── architecture.md # Architecture overview with diagrams
|
|
274
|
+
│ ├── dependency-graph.md # Module dependency graphs
|
|
275
|
+
│ ├── coverage.md # Docstring coverage report
|
|
276
|
+
│ ├── getting-started.md # Getting started guide
|
|
277
|
+
│ ├── configuration.md # Configuration reference
|
|
278
|
+
│ └── api-changelog.md # API change tracking
|
|
279
|
+
├── examples/
|
|
280
|
+
│ ├── quickstart.py # Basic usage examples
|
|
281
|
+
│ └── advanced_usage.py # Advanced usage examples
|
|
282
|
+
├── CONTRIBUTING.md # Contribution guidelines
|
|
283
|
+
└── mkdocs.yml # MkDocs site configuration
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Configuration
|
|
287
|
+
|
|
288
|
+
Create `code2docs.yaml` in your project root (or run `code2docs init`):
|
|
289
|
+
|
|
290
|
+
```yaml
|
|
291
|
+
project:
|
|
292
|
+
name: my-project
|
|
293
|
+
source: ./
|
|
294
|
+
output: ./docs/
|
|
295
|
+
|
|
296
|
+
readme:
|
|
297
|
+
sections:
|
|
298
|
+
- overview
|
|
299
|
+
- install
|
|
300
|
+
- quickstart
|
|
301
|
+
- api
|
|
302
|
+
- structure
|
|
303
|
+
badges:
|
|
304
|
+
- version
|
|
305
|
+
- python
|
|
306
|
+
- coverage
|
|
307
|
+
sync_markers: true
|
|
308
|
+
|
|
309
|
+
docs:
|
|
310
|
+
api_reference: true
|
|
311
|
+
module_docs: true
|
|
312
|
+
architecture: true
|
|
313
|
+
changelog: true
|
|
314
|
+
|
|
315
|
+
examples:
|
|
316
|
+
auto_generate: true
|
|
317
|
+
from_entry_points: true
|
|
318
|
+
|
|
319
|
+
sync:
|
|
320
|
+
strategy: markers # markers | full | git-diff
|
|
321
|
+
watch: false
|
|
322
|
+
ignore:
|
|
323
|
+
- "tests/"
|
|
324
|
+
- "__pycache__"
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Sync Markers
|
|
328
|
+
|
|
329
|
+
code2docs can update only specific sections of an existing README using HTML comment markers:
|
|
330
|
+
|
|
331
|
+
```markdown
|
|
332
|
+
<!-- code2docs:start -->
|
|
333
|
+
# Project Title
|
|
334
|
+
... auto-generated content ...
|
|
335
|
+
<!-- code2docs:end -->
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Content outside the markers is preserved when regenerating. Enable this with `sync_markers: true` in your configuration.
|
|
339
|
+
|
|
340
|
+
## Architecture
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
code2docs/
|
|
344
|
+
├── registry ├── llm_helper├── code2docs/ ├── __main__ ├── 04_sync_and_watch ├── 05_custom_generators ├── quickstart ├── 06_formatters ├── advanced_usage ├── 03_programmatic_api ├── entry_points ├── 07_web_frameworks ├── class_examples ├── basic_usage ├── 01_cli_usage ├── 02_configuration ├── updater ├── sync/ ├── watcher ├── base ├── quickstart ├── advanced_usage ├── markdown ├── badges ├── toc ├── formatters/ ├── differ ├── coverage_gen ├── _source_links ├── depgraph_gen ├── getting_started_gen ├── config_docs_gen ├── changelog_gen ├── generators/ ├── code2llm_gen ├── module_docs_gen ├── api_reference_gen ├── examples_gen ├── mkdocs_gen ├── config ├── api_changelog_gen ├── _registry_adapters ├── readme_gen ├── contributing_gen ├── analyzers/ ├── dependency_scanner ├── endpoint_detector ├── architecture_gen ├── project_scanner ├── docstring_extractor ├── cli```
|
|
345
|
+
|
|
346
|
+
## API Overview
|
|
347
|
+
|
|
348
|
+
### Classes
|
|
349
|
+
|
|
350
|
+
- **`GeneratorRegistry`** — Registry of documentation generators.
|
|
351
|
+
- **`LLMHelper`** — Thin wrapper around litellm for documentation generation.
|
|
352
|
+
- **`MetricsReportGenerator`** — Generate a metrics report from code analysis.
|
|
353
|
+
- **`APIChangelogGenerator`** — Generate changelog based on API changes.
|
|
354
|
+
- **`CustomGenerator`** — Example of extending the base generator class.
|
|
355
|
+
- **`Updater`** — Apply selective documentation updates based on detected changes.
|
|
356
|
+
- **`GenerateContext`** — Shared context passed to all generators during a run.
|
|
357
|
+
- **`BaseGenerator`** — Abstract base for all documentation generators.
|
|
358
|
+
- **`MarkdownFormatter`** — Helper for constructing Markdown documents.
|
|
359
|
+
- **`ChangeInfo`** — Describes a detected change.
|
|
360
|
+
- **`Differ`** — Detect changes between current source and previous state.
|
|
361
|
+
- **`CoverageGenerator`** — Generate docs/coverage.md — docstring coverage report.
|
|
362
|
+
- **`SourceLinker`** — Build source-code links (relative paths + optional GitHub/GitLab URLs).
|
|
363
|
+
- **`DepGraphGenerator`** — Generate docs/dependency-graph.md with Mermaid diagrams.
|
|
364
|
+
- **`GettingStartedGenerator`** — Generate docs/getting-started.md from entry points and dependencies.
|
|
365
|
+
- **`ConfigDocsGenerator`** — Generate docs/configuration.md from Code2DocsConfig dataclass.
|
|
366
|
+
- **`ChangelogEntry`** — A single changelog entry.
|
|
367
|
+
- **`ChangelogGenerator`** — Generate CHANGELOG.md from git log and analysis diff.
|
|
368
|
+
- **`Code2LlmGenerator`** — Generate code2llm analysis files in project/ directory.
|
|
369
|
+
- **`ModuleDocsGenerator`** — Generate docs/modules.md — consolidated module documentation.
|
|
370
|
+
- **`ApiReferenceGenerator`** — Generate docs/api.md — consolidated API reference.
|
|
371
|
+
- **`ExamplesGenerator`** — Generate examples/ — usage examples from public API signatures.
|
|
372
|
+
- **`MkDocsGenerator`** — Generate mkdocs.yml from the docs/ directory structure.
|
|
373
|
+
- **`ReadmeConfig`** — Configuration for README generation.
|
|
374
|
+
- **`DocsConfig`** — Configuration for docs/ generation.
|
|
375
|
+
- **`ExamplesConfig`** — Configuration for examples/ generation.
|
|
376
|
+
- **`SyncConfig`** — Configuration for synchronization.
|
|
377
|
+
- **`Code2LlmConfig`** — Configuration for code2llm analysis generation.
|
|
378
|
+
- **`LLMConfig`** — Configuration for optional LLM-assisted documentation generation.
|
|
379
|
+
- **`Code2DocsConfig`** — Main configuration for code2docs.
|
|
380
|
+
- **`ApiChange`** — A single API change between two analysis snapshots.
|
|
381
|
+
- **`ApiChangelogGenerator`** — Generate API changelog by diffing current analysis with a saved snapshot.
|
|
382
|
+
- **`ReadmeGeneratorAdapter`** — —
|
|
383
|
+
- **`ApiReferenceAdapter`** — —
|
|
384
|
+
- **`ModuleDocsAdapter`** — —
|
|
385
|
+
- **`ArchitectureAdapter`** — —
|
|
386
|
+
- **`DepGraphAdapter`** — —
|
|
387
|
+
- **`CoverageAdapter`** — —
|
|
388
|
+
- **`ApiChangelogAdapter`** — —
|
|
389
|
+
- **`ExamplesAdapter`** — —
|
|
390
|
+
- **`MkDocsAdapter`** — —
|
|
391
|
+
- **`GettingStartedAdapter`** — —
|
|
392
|
+
- **`ConfigDocsAdapter`** — —
|
|
393
|
+
- **`ContributingAdapter`** — —
|
|
394
|
+
- **`Code2LlmAdapter`** — Adapter for code2llm analysis generation.
|
|
395
|
+
- **`ReadmeGenerator`** — Generate README.md from AnalysisResult.
|
|
396
|
+
- **`ContributingGenerator`** — Generate CONTRIBUTING.md by detecting dev tools from pyproject.toml.
|
|
397
|
+
- **`DependencyInfo`** — Information about a project dependency.
|
|
398
|
+
- **`ProjectDependencies`** — All detected project dependencies.
|
|
399
|
+
- **`DependencyScanner`** — Scan and parse project dependency files.
|
|
400
|
+
- **`Endpoint`** — Represents a detected web endpoint.
|
|
401
|
+
- **`EndpointDetector`** — Detects web endpoints from decorator patterns in source code.
|
|
402
|
+
- **`ArchitectureGenerator`** — Generate docs/architecture.md — architecture overview with diagrams.
|
|
403
|
+
- **`ProjectScanner`** — Wraps code2llm's ProjectAnalyzer with code2docs-specific defaults.
|
|
404
|
+
- **`DocstringInfo`** — Parsed docstring with sections.
|
|
405
|
+
- **`DocstringExtractor`** — Extract and parse docstrings from AnalysisResult.
|
|
406
|
+
- **`DefaultGroup`** — Click Group that routes unknown subcommands to 'generate'.
|
|
407
|
+
|
|
408
|
+
### Functions
|
|
409
|
+
|
|
410
|
+
- `detect_changes_example(project_path)` — Detect what files have changed since last documentation generation.
|
|
411
|
+
- `update_docs_incrementally(project_path)` — Update only the parts of docs that need changing.
|
|
412
|
+
- `force_full_regeneration(project_path)` — Force full regeneration of all documentation.
|
|
413
|
+
- `watch_and_auto_regenerate(project_path, interval)` — Watch for file changes and auto-regenerate documentation.
|
|
414
|
+
- `custom_watcher_with_hooks(project_path)` — Set up a custom watcher with pre/post generation hooks.
|
|
415
|
+
- `sync_with_git_changes(project_path)` — Only regenerate docs for files changed in git.
|
|
416
|
+
- `generate_custom_report(project_path)` — Generate a custom metrics report.
|
|
417
|
+
- `markdown_formatting_examples()` — Demonstrate markdown formatting utilities.
|
|
418
|
+
- `generate_complex_document()` — Generate a complex markdown document using the formatter.
|
|
419
|
+
- `badge_examples()` — Generate various badge examples.
|
|
420
|
+
- `toc_examples()` — Demonstrate table of contents generation.
|
|
421
|
+
- `build_custom_readme()` — Build a custom README using formatters.
|
|
422
|
+
- `generate_readme_simple(project_path)` — Generate README.md content from a project.
|
|
423
|
+
- `generate_full_documentation(project_path)` — Generate complete documentation for a project.
|
|
424
|
+
- `custom_documentation_pipeline(project_path)` — Create a custom documentation pipeline.
|
|
425
|
+
- `inspect_project_structure(project_path)` — Inspect project structure from analysis.
|
|
426
|
+
- `generate_docs_if_needed(project_path, force)` — Only generate docs if code has changed.
|
|
427
|
+
- `detect_flask_endpoints(project_path)` — Detect Flask endpoints in a project.
|
|
428
|
+
- `detect_fastapi_endpoints(project_path)` — Detect FastAPI endpoints in a project.
|
|
429
|
+
- `generate_api_docs_from_endpoints(project_path, output_dir)` — Generate API documentation from detected endpoints.
|
|
430
|
+
- `create_example_web_apps(target_dir)` — Create example Flask and FastAPI apps for testing.
|
|
431
|
+
- `document_web_project(project_path)` — Complete workflow: detect endpoints and generate docs.
|
|
432
|
+
- `run_cli_basic(project_path)` — Run code2docs CLI programmatically.
|
|
433
|
+
- `run_cli_with_config(project_path, config_path)` — Run with custom configuration.
|
|
434
|
+
- `create_basic_config()` — Create a basic configuration.
|
|
435
|
+
- `create_advanced_config()` — Create advanced configuration with all options.
|
|
436
|
+
- `save_yaml_config_example(path)` — Save example YAML config to file.
|
|
437
|
+
- `load_config_from_yaml(path)` — Load configuration from YAML file.
|
|
438
|
+
- `start_watcher(project_path, config)` — Start watching project for file changes and auto-resync docs.
|
|
439
|
+
- `generate_badges(project_name, badge_types, stats, deps)` — Generate shields.io badge Markdown strings.
|
|
440
|
+
- `generate_toc(markdown_content, max_depth)` — Generate a table of contents from Markdown headings.
|
|
441
|
+
- `extract_headings(content, max_depth)` — Extract headings from Markdown content.
|
|
442
|
+
- `generate_docs(project_path, config)` — High-level function to generate all documentation.
|
|
443
|
+
- `generate_code2llm_analysis(project_path, config)` — Convenience function to generate code2llm analysis.
|
|
444
|
+
- `generate_readme(project_path, output, sections, sync_markers)` — Convenience function to generate a README.
|
|
445
|
+
- `analyze_and_document(project_path, config)` — Convenience function: analyze a project in one call.
|
|
446
|
+
- `main()` — code2docs — Auto-generate project documentation from source code.
|
|
447
|
+
- `generate(project_path, config_path, readme_only, sections)` — Generate documentation (default command).
|
|
448
|
+
- `sync(project_path, config_path, verbose, dry_run)` — Synchronize documentation with source code changes.
|
|
449
|
+
- `watch(project_path, config_path, verbose)` — Watch for file changes and auto-regenerate docs.
|
|
450
|
+
- `init(project_path, output)` — Initialize code2docs.yaml configuration file.
|
|
451
|
+
- `check(project_path, config_path, target)` — Health check — verify documentation completeness.
|
|
452
|
+
- `diff(project_path, config_path)` — Preview what would change without writing anything.
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
## Project Structure
|
|
456
|
+
|
|
457
|
+
📦 `code2docs` (1 functions)
|
|
458
|
+
📄 `code2docs.__main__`
|
|
459
|
+
📦 `code2docs.analyzers`
|
|
460
|
+
📄 `code2docs.analyzers.dependency_scanner` (6 functions, 3 classes)
|
|
461
|
+
📄 `code2docs.analyzers.docstring_extractor` (10 functions, 2 classes)
|
|
462
|
+
📄 `code2docs.analyzers.endpoint_detector` (3 functions, 2 classes)
|
|
463
|
+
📄 `code2docs.analyzers.project_scanner` (4 functions, 1 classes)
|
|
464
|
+
📄 `code2docs.base` (3 functions, 2 classes)
|
|
465
|
+
📄 `code2docs.cli` (14 functions, 1 classes)
|
|
466
|
+
📄 `code2docs.config` (5 functions, 7 classes)
|
|
467
|
+
📄 `code2docs.examples.advanced_usage`
|
|
468
|
+
📄 `code2docs.examples.quickstart`
|
|
469
|
+
📦 `code2docs.formatters`
|
|
470
|
+
📄 `code2docs.formatters.badges` (2 functions)
|
|
471
|
+
📄 `code2docs.formatters.markdown` (13 functions, 1 classes)
|
|
472
|
+
📄 `code2docs.formatters.toc` (3 functions)
|
|
473
|
+
📦 `code2docs.generators` (1 functions)
|
|
474
|
+
📄 `code2docs.generators._registry_adapters` (26 functions, 13 classes)
|
|
475
|
+
📄 `code2docs.generators._source_links` (6 functions, 1 classes)
|
|
476
|
+
📄 `code2docs.generators.api_changelog_gen` (9 functions, 2 classes)
|
|
477
|
+
📄 `code2docs.generators.api_reference_gen` (7 functions, 1 classes)
|
|
478
|
+
📄 `code2docs.generators.architecture_gen` (10 functions, 1 classes)
|
|
479
|
+
📄 `code2docs.generators.changelog_gen` (6 functions, 2 classes)
|
|
480
|
+
📄 `code2docs.generators.code2llm_gen` (5 functions, 1 classes)
|
|
481
|
+
📄 `code2docs.generators.config_docs_gen` (4 functions, 1 classes)
|
|
482
|
+
📄 `code2docs.generators.contributing_gen` (8 functions, 1 classes)
|
|
483
|
+
📄 `code2docs.generators.coverage_gen` (7 functions, 1 classes)
|
|
484
|
+
📄 `code2docs.generators.depgraph_gen` (9 functions, 1 classes)
|
|
485
|
+
📄 `code2docs.generators.examples_gen` (14 functions, 1 classes)
|
|
486
|
+
📄 `code2docs.generators.getting_started_gen` (8 functions, 1 classes)
|
|
487
|
+
📄 `code2docs.generators.mkdocs_gen` (4 functions, 1 classes)
|
|
488
|
+
📄 `code2docs.generators.module_docs_gen` (9 functions, 1 classes)
|
|
489
|
+
📄 `code2docs.generators.readme_gen` (18 functions, 1 classes)
|
|
490
|
+
📄 `code2docs.llm_helper` (7 functions, 1 classes)
|
|
491
|
+
📄 `code2docs.registry` (4 functions, 1 classes)
|
|
492
|
+
📦 `code2docs.sync`
|
|
493
|
+
📄 `code2docs.sync.differ` (7 functions, 2 classes)
|
|
494
|
+
📄 `code2docs.sync.updater` (2 functions, 1 classes)
|
|
495
|
+
📄 `code2docs.sync.watcher` (1 functions)
|
|
496
|
+
📄 `examples.01_cli_usage` (2 functions)
|
|
497
|
+
📄 `examples.02_configuration` (4 functions)
|
|
498
|
+
📄 `examples.03_programmatic_api` (5 functions)
|
|
499
|
+
📄 `examples.04_sync_and_watch` (6 functions)
|
|
500
|
+
📄 `examples.05_custom_generators` (13 functions, 3 classes)
|
|
501
|
+
📄 `examples.06_formatters` (5 functions)
|
|
502
|
+
📄 `examples.07_web_frameworks` (5 functions)
|
|
503
|
+
📄 `examples.advanced_usage`
|
|
504
|
+
📄 `examples.basic_usage`
|
|
505
|
+
📄 `examples.class_examples`
|
|
506
|
+
📄 `examples.entry_points`
|
|
507
|
+
📄 `examples.quickstart`
|
|
508
|
+
|
|
509
|
+
## Requirements
|
|
510
|
+
|
|
511
|
+
- Python >= >=3.9
|
|
512
|
+
- code2llm >=0.5.0- jinja2 >=3.1- click >=8.0- pyyaml >=6.0- rich >=13.0
|
|
513
|
+
|
|
514
|
+
## Contributing
|
|
515
|
+
|
|
516
|
+
**Contributors:**
|
|
517
|
+
- Tom Softreck <tom@sapletta.com>
|
|
518
|
+
- Tom Sapletta <tom-sapletta-com@users.noreply.github.com>
|
|
519
|
+
|
|
520
|
+
We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
521
|
+
|
|
522
|
+
### Development Setup
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
# Clone the repository
|
|
526
|
+
git clone https://github.com/wronai/code2docs
|
|
527
|
+
cd code2docs
|
|
528
|
+
|
|
529
|
+
# Install in development mode
|
|
530
|
+
pip install -e ".[dev]"
|
|
531
|
+
|
|
532
|
+
# Run tests
|
|
533
|
+
pytest
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
## Documentation
|
|
537
|
+
|
|
538
|
+
- 📖 [Full Documentation](https://github.com/wronai/code2docs/tree/main/docs) — API reference, module docs, architecture
|
|
539
|
+
- 🚀 [Getting Started](https://github.com/wronai/code2docs/blob/main/docs/getting-started.md) — Quick start guide
|
|
540
|
+
- 📚 [API Reference](https://github.com/wronai/code2docs/blob/main/docs/api.md) — Complete API documentation
|
|
541
|
+
- 🔧 [Configuration](https://github.com/wronai/code2docs/blob/main/docs/configuration.md) — Configuration options
|
|
542
|
+
- 💡 [Examples](./examples) — Usage examples and code samples
|
|
543
|
+
|
|
544
|
+
### Generated Files
|
|
545
|
+
|
|
546
|
+
| Output | Description | Link |
|
|
547
|
+
|--------|-------------|------|
|
|
548
|
+
| `README.md` | Project overview (this file) | — |
|
|
549
|
+
| `docs/api.md` | Consolidated API reference | [View](./docs/api.md) |
|
|
550
|
+
| `docs/modules.md` | Module reference with metrics | [View](./docs/modules.md) |
|
|
551
|
+
| `docs/architecture.md` | Architecture with diagrams | [View](./docs/architecture.md) |
|
|
552
|
+
| `docs/dependency-graph.md` | Dependency graphs | [View](./docs/dependency-graph.md) |
|
|
553
|
+
| `docs/coverage.md` | Docstring coverage report | [View](./docs/coverage.md) |
|
|
554
|
+
| `docs/getting-started.md` | Getting started guide | [View](./docs/getting-started.md) |
|
|
555
|
+
| `docs/configuration.md` | Configuration reference | [View](./docs/configuration.md) |
|
|
556
|
+
| `docs/api-changelog.md` | API change tracking | [View](./docs/api-changelog.md) |
|
|
557
|
+
| `CONTRIBUTING.md` | Contribution guidelines | [View](./CONTRIBUTING.md) |
|
|
558
|
+
| `examples/` | Usage examples | [Browse](./examples) |
|
|
559
|
+
| `mkdocs.yml` | MkDocs configuration | — |
|
|
560
|
+
|
|
561
|
+
<!-- code2docs:end -->
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
Content outside the markers is preserved when regenerating. Enable this with `sync_markers: true` in your configuration.
|
|
565
|
+
|
|
566
|
+
## Architecture
|
|
567
|
+
|
|
568
|
+
```
|
|
569
|
+
code2docs/
|
|
570
|
+
├── registry ├── llm_helper├── code2docs/ ├── __main__ ├── 04_sync_and_watch ├── 05_custom_generators ├── 06_formatters ├── 03_programmatic_api ├── entry_points ├── 07_web_frameworks ├── class_examples ├── basic_usage ├── 01_cli_usage ├── 02_configuration ├── updater ├── sync/ ├── watcher ├── differ ├── quickstart ├── base ├── advanced_usage ├── badges ├── markdown ├── formatters/ ├── toc ├── coverage_gen ├── _source_links ├── depgraph_gen ├── getting_started_gen ├── config_docs_gen ├── changelog_gen ├── generators/ ├── code2llm_gen ├── module_docs_gen ├── api_reference_gen ├── examples_gen ├── mkdocs_gen ├── config ├── api_changelog_gen ├── _registry_adapters ├── contributing_gen ├── readme_gen ├── analyzers/ ├── docstring_extractor ├── endpoint_detector ├── architecture_gen ├── project_scanner ├── cli ├── dependency_scanner```
|
|
571
|
+
|
|
572
|
+
## API Overview
|
|
573
|
+
|
|
574
|
+
### Classes
|
|
575
|
+
|
|
576
|
+
- **`GeneratorRegistry`** — Registry of documentation generators.
|
|
577
|
+
- **`LLMHelper`** — Thin wrapper around litellm for documentation generation.
|
|
578
|
+
- **`MetricsReportGenerator`** — Generate a metrics report from code analysis.
|
|
579
|
+
- **`APIChangelogGenerator`** — Generate changelog based on API changes.
|
|
580
|
+
- **`CustomGenerator`** — Example of extending the base generator class.
|
|
581
|
+
- **`Updater`** — Apply selective documentation updates based on detected changes.
|
|
582
|
+
- **`ChangeInfo`** — Describes a detected change.
|
|
583
|
+
- **`Differ`** — Detect changes between current source and previous state.
|
|
584
|
+
- **`GenerateContext`** — Shared context passed to all generators during a run.
|
|
585
|
+
- **`BaseGenerator`** — Abstract base for all documentation generators.
|
|
586
|
+
- **`MarkdownFormatter`** — Helper for constructing Markdown documents.
|
|
587
|
+
- **`CoverageGenerator`** — Generate docs/coverage.md — docstring coverage report.
|
|
588
|
+
- **`SourceLinker`** — Build source-code links (relative paths + optional GitHub/GitLab URLs).
|
|
589
|
+
- **`DepGraphGenerator`** — Generate docs/dependency-graph.md with Mermaid diagrams.
|
|
590
|
+
- **`GettingStartedGenerator`** — Generate docs/getting-started.md from entry points and dependencies.
|
|
591
|
+
- **`ConfigDocsGenerator`** — Generate docs/configuration.md from Code2DocsConfig dataclass.
|
|
592
|
+
- **`ChangelogEntry`** — A single changelog entry.
|
|
593
|
+
- **`ChangelogGenerator`** — Generate CHANGELOG.md from git log and analysis diff.
|
|
594
|
+
- **`Code2LlmGenerator`** — Generate code2llm analysis files in project/ directory.
|
|
595
|
+
- **`ModuleDocsGenerator`** — Generate docs/modules.md — consolidated module documentation.
|
|
596
|
+
- **`ApiReferenceGenerator`** — Generate docs/api.md — consolidated API reference.
|
|
597
|
+
- **`ExamplesGenerator`** — Generate examples/ — usage examples from public API signatures.
|
|
598
|
+
- **`MkDocsGenerator`** — Generate mkdocs.yml from the docs/ directory structure.
|
|
599
|
+
- **`ReadmeConfig`** — Configuration for README generation.
|
|
600
|
+
- **`DocsConfig`** — Configuration for docs/ generation.
|
|
601
|
+
- **`ExamplesConfig`** — Configuration for examples/ generation.
|
|
602
|
+
- **`SyncConfig`** — Configuration for synchronization.
|
|
603
|
+
- **`Code2LlmConfig`** — Configuration for code2llm analysis generation.
|
|
604
|
+
- **`LLMConfig`** — Configuration for optional LLM-assisted documentation generation.
|
|
605
|
+
- **`Code2DocsConfig`** — Main configuration for code2docs.
|
|
606
|
+
- **`ApiChange`** — A single API change between two analysis snapshots.
|
|
607
|
+
- **`ApiChangelogGenerator`** — Generate API changelog by diffing current analysis with a saved snapshot.
|
|
608
|
+
- **`ReadmeGeneratorAdapter`** — —
|
|
609
|
+
- **`ApiReferenceAdapter`** — —
|
|
610
|
+
- **`ModuleDocsAdapter`** — —
|
|
611
|
+
- **`ArchitectureAdapter`** — —
|
|
612
|
+
- **`DepGraphAdapter`** — —
|
|
613
|
+
- **`CoverageAdapter`** — —
|
|
614
|
+
- **`ApiChangelogAdapter`** — —
|
|
615
|
+
- **`ExamplesAdapter`** — —
|
|
616
|
+
- **`MkDocsAdapter`** — —
|
|
617
|
+
- **`GettingStartedAdapter`** — —
|
|
618
|
+
- **`ConfigDocsAdapter`** — —
|
|
619
|
+
- **`ContributingAdapter`** — —
|
|
620
|
+
- **`Code2LlmAdapter`** — Adapter for code2llm analysis generation.
|
|
621
|
+
- **`ContributingGenerator`** — Generate CONTRIBUTING.md by detecting dev tools from pyproject.toml.
|
|
622
|
+
- **`ReadmeGenerator`** — Generate README.md from AnalysisResult.
|
|
623
|
+
- **`DocstringInfo`** — Parsed docstring with sections.
|
|
624
|
+
- **`DocstringExtractor`** — Extract and parse docstrings from AnalysisResult.
|
|
625
|
+
- **`Endpoint`** — Represents a detected web endpoint.
|
|
626
|
+
- **`EndpointDetector`** — Detects web endpoints from decorator patterns in source code.
|
|
627
|
+
- **`ArchitectureGenerator`** — Generate docs/architecture.md — architecture overview with diagrams.
|
|
628
|
+
- **`ProjectScanner`** — Wraps code2llm's ProjectAnalyzer with code2docs-specific defaults.
|
|
629
|
+
- **`DefaultGroup`** — Click Group that routes unknown subcommands to 'generate'.
|
|
630
|
+
- **`DependencyInfo`** — Information about a project dependency.
|
|
631
|
+
- **`ProjectDependencies`** — All detected project dependencies.
|
|
632
|
+
- **`DependencyScanner`** — Scan and parse project dependency files.
|
|
633
|
+
|
|
634
|
+
### Functions
|
|
635
|
+
|
|
636
|
+
- `detect_changes_example(project_path)` — Detect what files have changed since last documentation generation.
|
|
637
|
+
- `update_docs_incrementally(project_path)` — Update only the parts of docs that need changing.
|
|
638
|
+
- `force_full_regeneration(project_path)` — Force full regeneration of all documentation.
|
|
639
|
+
- `watch_and_auto_regenerate(project_path, interval)` — Watch for file changes and auto-regenerate documentation.
|
|
640
|
+
- `custom_watcher_with_hooks(project_path)` — Set up a custom watcher with pre/post generation hooks.
|
|
641
|
+
- `sync_with_git_changes(project_path)` — Only regenerate docs for files changed in git.
|
|
642
|
+
- `generate_custom_report(project_path)` — Generate a custom metrics report.
|
|
643
|
+
- `markdown_formatting_examples()` — Demonstrate markdown formatting utilities.
|
|
644
|
+
- `generate_complex_document()` — Generate a complex markdown document using the formatter.
|
|
645
|
+
- `badge_examples()` — Generate various badge examples.
|
|
646
|
+
- `toc_examples()` — Demonstrate table of contents generation.
|
|
647
|
+
- `build_custom_readme()` — Build a custom README using formatters.
|
|
648
|
+
- `generate_readme_simple(project_path)` — Generate README.md content from a project.
|
|
649
|
+
- `generate_full_documentation(project_path)` — Generate complete documentation for a project.
|
|
650
|
+
- `custom_documentation_pipeline(project_path)` — Create a custom documentation pipeline.
|
|
651
|
+
- `inspect_project_structure(project_path)` — Inspect project structure from analysis.
|
|
652
|
+
- `generate_docs_if_needed(project_path, force)` — Only generate docs if code has changed.
|
|
653
|
+
- `detect_flask_endpoints(project_path)` — Detect Flask endpoints in a project.
|
|
654
|
+
- `detect_fastapi_endpoints(project_path)` — Detect FastAPI endpoints in a project.
|
|
655
|
+
- `generate_api_docs_from_endpoints(project_path, output_dir)` — Generate API documentation from detected endpoints.
|
|
656
|
+
- `create_example_web_apps(target_dir)` — Create example Flask and FastAPI apps for testing.
|
|
657
|
+
- `document_web_project(project_path)` — Complete workflow: detect endpoints and generate docs.
|
|
658
|
+
- `run_cli_basic(project_path)` — Run code2docs CLI programmatically.
|
|
659
|
+
- `run_cli_with_config(project_path, config_path)` — Run with custom configuration.
|
|
660
|
+
- `create_basic_config()` — Create a basic configuration.
|
|
661
|
+
- `create_advanced_config()` — Create advanced configuration with all options.
|
|
662
|
+
- `save_yaml_config_example(path)` — Save example YAML config to file.
|
|
663
|
+
- `load_config_from_yaml(path)` — Load configuration from YAML file.
|
|
664
|
+
- `start_watcher(project_path, config)` — Start watching project for file changes and auto-resync docs.
|
|
665
|
+
- `generate_badges(project_name, badge_types, stats, deps)` — Generate shields.io badge Markdown strings.
|
|
666
|
+
- `generate_toc(markdown_content, max_depth)` — Generate a table of contents from Markdown headings.
|
|
667
|
+
- `extract_headings(content, max_depth)` — Extract headings from Markdown content.
|
|
668
|
+
- `generate_docs(project_path, config)` — High-level function to generate all documentation.
|
|
669
|
+
- `generate_code2llm_analysis(project_path, config)` — Convenience function to generate code2llm analysis.
|
|
670
|
+
- `generate_readme(project_path, output, sections, sync_markers)` — Convenience function to generate a README.
|
|
671
|
+
- `analyze_and_document(project_path, config)` — Convenience function: analyze a project in one call.
|
|
672
|
+
- `main()` — code2docs — Auto-generate project documentation from source code.
|
|
673
|
+
- `generate(project_path, config_path, readme_only, sections)` — Generate documentation (default command).
|
|
674
|
+
- `sync(project_path, config_path, verbose, dry_run)` — Synchronize documentation with source code changes.
|
|
675
|
+
- `watch(project_path, config_path, verbose)` — Watch for file changes and auto-regenerate docs.
|
|
676
|
+
- `init(project_path, output)` — Initialize code2docs.yaml configuration file.
|
|
677
|
+
- `check(project_path, config_path, target)` — Health check — verify documentation completeness.
|
|
678
|
+
- `diff(project_path, config_path)` — Preview what would change without writing anything.
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
## Project Structure
|
|
682
|
+
|
|
683
|
+
📦 `code2docs` (1 functions)
|
|
684
|
+
📄 `code2docs.__main__`
|
|
685
|
+
📦 `code2docs.analyzers`
|
|
686
|
+
📄 `code2docs.analyzers.dependency_scanner` (6 functions, 3 classes)
|
|
687
|
+
📄 `code2docs.analyzers.docstring_extractor` (10 functions, 2 classes)
|
|
688
|
+
📄 `code2docs.analyzers.endpoint_detector` (3 functions, 2 classes)
|
|
689
|
+
📄 `code2docs.analyzers.project_scanner` (4 functions, 1 classes)
|
|
690
|
+
📄 `code2docs.base` (3 functions, 2 classes)
|
|
691
|
+
📄 `code2docs.cli` (14 functions, 1 classes)
|
|
692
|
+
📄 `code2docs.config` (5 functions, 7 classes)
|
|
693
|
+
📄 `code2docs.examples.advanced_usage`
|
|
694
|
+
📄 `code2docs.examples.quickstart`
|
|
695
|
+
📦 `code2docs.formatters`
|
|
696
|
+
📄 `code2docs.formatters.badges` (2 functions)
|
|
697
|
+
📄 `code2docs.formatters.markdown` (13 functions, 1 classes)
|
|
698
|
+
📄 `code2docs.formatters.toc` (3 functions)
|
|
699
|
+
📦 `code2docs.generators` (1 functions)
|
|
700
|
+
📄 `code2docs.generators._registry_adapters` (26 functions, 13 classes)
|
|
701
|
+
📄 `code2docs.generators._source_links` (6 functions, 1 classes)
|
|
702
|
+
📄 `code2docs.generators.api_changelog_gen` (9 functions, 2 classes)
|
|
703
|
+
📄 `code2docs.generators.api_reference_gen` (7 functions, 1 classes)
|
|
704
|
+
📄 `code2docs.generators.architecture_gen` (10 functions, 1 classes)
|
|
705
|
+
📄 `code2docs.generators.changelog_gen` (6 functions, 2 classes)
|
|
706
|
+
📄 `code2docs.generators.code2llm_gen` (5 functions, 1 classes)
|
|
707
|
+
📄 `code2docs.generators.config_docs_gen` (4 functions, 1 classes)
|
|
708
|
+
📄 `code2docs.generators.contributing_gen` (8 functions, 1 classes)
|
|
709
|
+
📄 `code2docs.generators.coverage_gen` (7 functions, 1 classes)
|
|
710
|
+
📄 `code2docs.generators.depgraph_gen` (9 functions, 1 classes)
|
|
711
|
+
📄 `code2docs.generators.examples_gen` (14 functions, 1 classes)
|
|
712
|
+
📄 `code2docs.generators.getting_started_gen` (8 functions, 1 classes)
|
|
713
|
+
📄 `code2docs.generators.mkdocs_gen` (4 functions, 1 classes)
|
|
714
|
+
📄 `code2docs.generators.module_docs_gen` (9 functions, 1 classes)
|
|
715
|
+
📄 `code2docs.generators.readme_gen` (18 functions, 1 classes)
|
|
716
|
+
📄 `code2docs.llm_helper` (7 functions, 1 classes)
|
|
717
|
+
📄 `code2docs.registry` (4 functions, 1 classes)
|
|
718
|
+
📦 `code2docs.sync`
|
|
719
|
+
📄 `code2docs.sync.differ` (7 functions, 2 classes)
|
|
720
|
+
📄 `code2docs.sync.updater` (2 functions, 1 classes)
|
|
721
|
+
📄 `code2docs.sync.watcher` (1 functions)
|
|
722
|
+
📄 `examples.01_cli_usage` (2 functions)
|
|
723
|
+
📄 `examples.02_configuration` (4 functions)
|
|
724
|
+
📄 `examples.03_programmatic_api` (5 functions)
|
|
725
|
+
📄 `examples.04_sync_and_watch` (6 functions)
|
|
726
|
+
📄 `examples.05_custom_generators` (13 functions, 3 classes)
|
|
727
|
+
📄 `examples.06_formatters` (5 functions)
|
|
728
|
+
📄 `examples.07_web_frameworks` (5 functions)
|
|
729
|
+
📄 `examples.basic_usage`
|
|
730
|
+
📄 `examples.class_examples`
|
|
731
|
+
📄 `examples.entry_points`
|
|
732
|
+
|
|
733
|
+
## Requirements
|
|
734
|
+
|
|
735
|
+
- Python >= >=3.9
|
|
736
|
+
- code2llm >=0.5.0- jinja2 >=3.1- click >=8.0- pyyaml >=6.0- rich >=13.0
|
|
737
|
+
|
|
738
|
+
## Contributing
|
|
739
|
+
|
|
740
|
+
**Contributors:**
|
|
741
|
+
- Tom Softreck <tom@sapletta.com>
|
|
742
|
+
- Tom Sapletta <tom-sapletta-com@users.noreply.github.com>
|
|
743
|
+
|
|
744
|
+
We welcome contributions! Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
|
|
745
|
+
|
|
746
|
+
### Development Setup
|
|
747
|
+
|
|
748
|
+
```bash
|
|
749
|
+
# Clone the repository
|
|
750
|
+
git clone https://github.com/wronai/code2docs
|
|
751
|
+
cd code2docs
|
|
752
|
+
|
|
753
|
+
# Install in development mode
|
|
754
|
+
pip install -e ".[dev]"
|
|
755
|
+
|
|
756
|
+
# Run tests
|
|
757
|
+
pytest
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
## Documentation
|
|
761
|
+
|
|
762
|
+
- 📖 [Full Documentation](https://github.com/wronai/code2docs/tree/main/docs) — API reference, module docs, architecture
|
|
763
|
+
- 🚀 [Getting Started](https://github.com/wronai/code2docs/blob/main/docs/getting-started.md) — Quick start guide
|
|
764
|
+
- 📚 [API Reference](https://github.com/wronai/code2docs/blob/main/docs/api.md) — Complete API documentation
|
|
765
|
+
- 🔧 [Configuration](https://github.com/wronai/code2docs/blob/main/docs/configuration.md) — Configuration options
|
|
766
|
+
- 💡 [Examples](./examples) — Usage examples and code samples
|
|
767
|
+
|
|
768
|
+
### Generated Files
|
|
769
|
+
|
|
770
|
+
| Output | Description | Link |
|
|
771
|
+
|--------|-------------|------|
|
|
772
|
+
| `README.md` | Project overview (this file) | — |
|
|
773
|
+
| `docs/api.md` | Consolidated API reference | [View](./docs/api.md) |
|
|
774
|
+
| `docs/modules.md` | Module reference with metrics | [View](./docs/modules.md) |
|
|
775
|
+
| `docs/architecture.md` | Architecture with diagrams | [View](./docs/architecture.md) |
|
|
776
|
+
| `docs/dependency-graph.md` | Dependency graphs | [View](./docs/dependency-graph.md) |
|
|
777
|
+
| `docs/coverage.md` | Docstring coverage report | [View](./docs/coverage.md) |
|
|
778
|
+
| `docs/getting-started.md` | Getting started guide | [View](./docs/getting-started.md) |
|
|
779
|
+
| `docs/configuration.md` | Configuration reference | [View](./docs/configuration.md) |
|
|
780
|
+
| `docs/api-changelog.md` | API change tracking | [View](./docs/api-changelog.md) |
|
|
781
|
+
| `CONTRIBUTING.md` | Contribution guidelines | [View](./CONTRIBUTING.md) |
|
|
782
|
+
| `examples/` | Usage examples | [Browse](./examples) |
|
|
783
|
+
| `mkdocs.yml` | MkDocs configuration | — |
|
|
784
|
+
|
|
785
|
+
<!-- code2docs:end -->
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
Content outside markers is preserved.
|
|
789
|
+
|
|
790
|
+
## Architecture
|
|
791
|
+
|
|
792
|
+
```
|
|
793
|
+
code2docs/
|
|
794
|
+
├── cli.py # CLI (click-based)
|
|
795
|
+
├── config.py # Configuration (code2docs.yaml)
|
|
796
|
+
├── analyzers/ # Adapters to code2llm + custom detectors
|
|
797
|
+
│ ├── project_scanner.py # Wrapper on code2llm.ProjectAnalyzer
|
|
798
|
+
│ ├── endpoint_detector.py # Flask/FastAPI/Django route extraction
|
|
799
|
+
│ ├── docstring_extractor.py
|
|
800
|
+
│ └── dependency_scanner.py
|
|
801
|
+
├── generators/ # Documentation generators
|
|
802
|
+
│ ├── readme_gen.py # README.md generator
|
|
803
|
+
│ ├── api_reference_gen.py # docs/api/ reference from signatures
|
|
804
|
+
│ ├── module_docs_gen.py # docs/modules/ per-module docs
|
|
805
|
+
│ ├── examples_gen.py # examples/ from signatures
|
|
806
|
+
│ ├── changelog_gen.py # CHANGELOG from git log
|
|
807
|
+
│ └── architecture_gen.py # Architecture + Mermaid diagrams
|
|
808
|
+
├── templates/ # Jinja2 templates
|
|
809
|
+
├── sync/ # Change detection & selective regeneration
|
|
810
|
+
│ ├── differ.py
|
|
811
|
+
│ ├── updater.py
|
|
812
|
+
│ └── watcher.py
|
|
813
|
+
└── formatters/ # Markdown, badges, TOC
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
## Requirements
|
|
817
|
+
|
|
818
|
+
- Python >= 3.9
|
|
819
|
+
- [code2llm](https://github.com/wronai/code2llm) >= 0.5.0
|
|
820
|
+
- Jinja2 >= 3.1
|
|
821
|
+
- Click >= 8.0
|
|
822
|
+
- PyYAML >= 6.0
|
|
823
|
+
|
|
824
|
+
## License
|
|
825
|
+
|
|
826
|
+
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
827
|
+
|
|
828
|
+
## Author
|
|
829
|
+
|
|
830
|
+
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
|