code2docs 0.1.1__tar.gz → 2.1.93__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-2.1.93/PKG-INFO +49 -0
- code2docs-2.1.93/README.md +9 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/__init__.py +1 -1
- code2docs-2.1.93/code2docs.egg-info/PKG-INFO +49 -0
- code2docs-2.1.93/code2docs.egg-info/SOURCES.txt +20 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/pyproject.toml +1 -1
- code2docs-0.1.1/PKG-INFO +0 -228
- code2docs-0.1.1/README.md +0 -188
- code2docs-0.1.1/code2docs/formatters/__init__.py +0 -7
- code2docs-0.1.1/code2docs/formatters/badges.py +0 -52
- code2docs-0.1.1/code2docs/formatters/markdown.py +0 -73
- code2docs-0.1.1/code2docs/formatters/toc.py +0 -63
- code2docs-0.1.1/code2docs/generators/api_reference_gen.py +0 -150
- code2docs-0.1.1/code2docs/generators/architecture_gen.py +0 -192
- code2docs-0.1.1/code2docs/generators/changelog_gen.py +0 -121
- code2docs-0.1.1/code2docs/generators/examples_gen.py +0 -194
- code2docs-0.1.1/code2docs/generators/module_docs_gen.py +0 -204
- code2docs-0.1.1/code2docs/generators/readme_gen.py +0 -229
- code2docs-0.1.1/code2docs/sync/__init__.py +0 -6
- code2docs-0.1.1/code2docs/sync/differ.py +0 -125
- code2docs-0.1.1/code2docs/sync/updater.py +0 -77
- code2docs-0.1.1/code2docs/sync/watcher.py +0 -75
- code2docs-0.1.1/code2docs/templates/api_module.md.j2 +0 -62
- code2docs-0.1.1/code2docs/templates/architecture.md.j2 +0 -45
- code2docs-0.1.1/code2docs/templates/example_usage.py.j2 +0 -12
- code2docs-0.1.1/code2docs/templates/index.md.j2 +0 -31
- code2docs-0.1.1/code2docs/templates/readme.md.j2 +0 -85
- code2docs-0.1.1/code2docs.egg-info/PKG-INFO +0 -228
- code2docs-0.1.1/code2docs.egg-info/SOURCES.txt +0 -43
- code2docs-0.1.1/tests/test_analyzers.py +0 -138
- code2docs-0.1.1/tests/test_config.py +0 -49
- code2docs-0.1.1/tests/test_formatters.py +0 -91
- code2docs-0.1.1/tests/test_sync.py +0 -82
- {code2docs-0.1.1 → code2docs-2.1.93}/LICENSE +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/__main__.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/analyzers/__init__.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/analyzers/dependency_scanner.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/analyzers/docstring_extractor.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/analyzers/endpoint_detector.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/analyzers/project_scanner.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/cli.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/config.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs/generators/__init__.py +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs.egg-info/dependency_links.txt +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs.egg-info/entry_points.txt +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs.egg-info/requires.txt +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/code2docs.egg-info/top_level.txt +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/setup.cfg +0 -0
- {code2docs-0.1.1 → code2docs-2.1.93}/tests/test_code2docs.py +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code2docs
|
|
3
|
+
Version: 2.1.93
|
|
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
|
+
Provides-Extra: watch
|
|
29
|
+
Requires-Dist: watchdog>=3.0; extra == "watch"
|
|
30
|
+
Provides-Extra: mkdocs
|
|
31
|
+
Requires-Dist: mkdocs>=1.5; extra == "mkdocs"
|
|
32
|
+
Requires-Dist: mkdocs-material>=9.0; extra == "mkdocs"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# code2docs
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
46
|
+
|
|
47
|
+
## Author
|
|
48
|
+
|
|
49
|
+
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
|
|
@@ -5,7 +5,7 @@ Uses code2llm's AnalysisResult to produce human-readable documentation:
|
|
|
5
5
|
README.md, API references, module docs, examples, and architecture diagrams.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = "
|
|
8
|
+
__version__ = "2.1.93"
|
|
9
9
|
__author__ = "Tom Sapletta"
|
|
10
10
|
|
|
11
11
|
from .config import Code2DocsConfig
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: code2docs
|
|
3
|
+
Version: 2.1.93
|
|
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
|
+
Provides-Extra: watch
|
|
29
|
+
Requires-Dist: watchdog>=3.0; extra == "watch"
|
|
30
|
+
Provides-Extra: mkdocs
|
|
31
|
+
Requires-Dist: mkdocs>=1.5; extra == "mkdocs"
|
|
32
|
+
Requires-Dist: mkdocs-material>=9.0; extra == "mkdocs"
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
36
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
38
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
# code2docs
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
46
|
+
|
|
47
|
+
## Author
|
|
48
|
+
|
|
49
|
+
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
code2docs/__init__.py
|
|
5
|
+
code2docs/__main__.py
|
|
6
|
+
code2docs/cli.py
|
|
7
|
+
code2docs/config.py
|
|
8
|
+
code2docs.egg-info/PKG-INFO
|
|
9
|
+
code2docs.egg-info/SOURCES.txt
|
|
10
|
+
code2docs.egg-info/dependency_links.txt
|
|
11
|
+
code2docs.egg-info/entry_points.txt
|
|
12
|
+
code2docs.egg-info/requires.txt
|
|
13
|
+
code2docs.egg-info/top_level.txt
|
|
14
|
+
code2docs/analyzers/__init__.py
|
|
15
|
+
code2docs/analyzers/dependency_scanner.py
|
|
16
|
+
code2docs/analyzers/docstring_extractor.py
|
|
17
|
+
code2docs/analyzers/endpoint_detector.py
|
|
18
|
+
code2docs/analyzers/project_scanner.py
|
|
19
|
+
code2docs/generators/__init__.py
|
|
20
|
+
tests/test_code2docs.py
|
code2docs-0.1.1/PKG-INFO
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: code2docs
|
|
3
|
-
Version: 0.1.1
|
|
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
|
-
Provides-Extra: watch
|
|
29
|
-
Requires-Dist: watchdog>=3.0; extra == "watch"
|
|
30
|
-
Provides-Extra: mkdocs
|
|
31
|
-
Requires-Dist: mkdocs>=1.5; extra == "mkdocs"
|
|
32
|
-
Requires-Dist: mkdocs-material>=9.0; extra == "mkdocs"
|
|
33
|
-
Provides-Extra: dev
|
|
34
|
-
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
-
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
36
|
-
Requires-Dist: black>=23.0; extra == "dev"
|
|
37
|
-
Requires-Dist: ruff>=0.1; extra == "dev"
|
|
38
|
-
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
39
|
-
Dynamic: license-file
|
|
40
|
-
|
|
41
|
-
# code2docs
|
|
42
|
-
|
|
43
|
-
  
|
|
44
|
-
|
|
45
|
-
> Auto-generate and sync project documentation from source code analysis.
|
|
46
|
-
|
|
47
|
-
**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.
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
code2llm → AnalysisResult → .toon / .mmd / context.md (for LLM)
|
|
51
|
-
code2docs → AnalysisResult → README.md / docs/ / examples/ (for humans)
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Installation
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
pip install code2docs
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Or from source:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
git clone https://github.com/wronai/code2docs
|
|
64
|
-
cd code2docs
|
|
65
|
-
pip install -e .
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Optional extras
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
pip install code2docs[watch] # file watcher (watchdog)
|
|
72
|
-
pip install code2docs[mkdocs] # MkDocs integration
|
|
73
|
-
pip install code2docs[dev] # development tools
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## Quick Start
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# Generate full documentation for a project
|
|
80
|
-
code2docs ./my-project
|
|
81
|
-
|
|
82
|
-
# Generate only README
|
|
83
|
-
code2docs ./my-project --readme-only
|
|
84
|
-
|
|
85
|
-
# Sync (regenerate only changed modules)
|
|
86
|
-
code2docs sync ./my-project
|
|
87
|
-
|
|
88
|
-
# Watch mode (auto-resync on file changes)
|
|
89
|
-
code2docs watch ./my-project
|
|
90
|
-
|
|
91
|
-
# Initialize config file
|
|
92
|
-
code2docs init ./my-project
|
|
93
|
-
|
|
94
|
-
# Dry-run (show what would be generated)
|
|
95
|
-
code2docs ./my-project --dry-run
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Python API
|
|
99
|
-
|
|
100
|
-
```python
|
|
101
|
-
from code2docs import generate_readme, generate_docs, Code2DocsConfig
|
|
102
|
-
|
|
103
|
-
# Generate README
|
|
104
|
-
generate_readme("./my-project", output="README.md")
|
|
105
|
-
|
|
106
|
-
# Generate full docs with custom config
|
|
107
|
-
config = Code2DocsConfig(project_name="mylib", verbose=True)
|
|
108
|
-
docs = generate_docs("./my-project", config=config)
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Generated Output
|
|
112
|
-
|
|
113
|
-
```
|
|
114
|
-
<project>/
|
|
115
|
-
├── README.md # Main README (auto-generated sections)
|
|
116
|
-
├── docs/
|
|
117
|
-
│ ├── index.md # Documentation index
|
|
118
|
-
│ ├── architecture.md # Architecture + Mermaid diagrams
|
|
119
|
-
│ ├── api/
|
|
120
|
-
│ │ ├── index.md # API overview
|
|
121
|
-
│ │ ├── module_analyzer.md # Per-module API reference
|
|
122
|
-
│ │ └── ...
|
|
123
|
-
│ └── modules/
|
|
124
|
-
│ ├── analyzer.md # Detailed module documentation
|
|
125
|
-
│ └── ...
|
|
126
|
-
├── examples/
|
|
127
|
-
│ ├── basic_usage.py # Auto-generated usage example
|
|
128
|
-
│ ├── class_examples.py # Class usage examples
|
|
129
|
-
│ └── ...
|
|
130
|
-
└── code2docs.yaml # Generator configuration
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
## Configuration
|
|
134
|
-
|
|
135
|
-
Create `code2docs.yaml` in your project root (or run `code2docs init`):
|
|
136
|
-
|
|
137
|
-
```yaml
|
|
138
|
-
project:
|
|
139
|
-
name: my-project
|
|
140
|
-
source: ./
|
|
141
|
-
output: ./docs/
|
|
142
|
-
|
|
143
|
-
readme:
|
|
144
|
-
sections:
|
|
145
|
-
- overview
|
|
146
|
-
- install
|
|
147
|
-
- quickstart
|
|
148
|
-
- api
|
|
149
|
-
- structure
|
|
150
|
-
- endpoints
|
|
151
|
-
badges:
|
|
152
|
-
- version
|
|
153
|
-
- python
|
|
154
|
-
- coverage
|
|
155
|
-
- complexity
|
|
156
|
-
sync_markers: true
|
|
157
|
-
|
|
158
|
-
docs:
|
|
159
|
-
api_reference: true
|
|
160
|
-
module_docs: true
|
|
161
|
-
architecture: true
|
|
162
|
-
changelog: true
|
|
163
|
-
|
|
164
|
-
examples:
|
|
165
|
-
auto_generate: true
|
|
166
|
-
from_entry_points: true
|
|
167
|
-
|
|
168
|
-
sync:
|
|
169
|
-
strategy: markers # markers | full | git-diff
|
|
170
|
-
watch: false
|
|
171
|
-
ignore:
|
|
172
|
-
- "tests/"
|
|
173
|
-
- "__pycache__"
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Sync Markers
|
|
177
|
-
|
|
178
|
-
code2docs can update only specific sections of an existing README using markers:
|
|
179
|
-
|
|
180
|
-
```markdown
|
|
181
|
-
<!-- code2docs:start -->
|
|
182
|
-
... auto-generated content ...
|
|
183
|
-
<!-- code2docs:end -->
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Content outside markers is preserved.
|
|
187
|
-
|
|
188
|
-
## Architecture
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
code2docs/
|
|
192
|
-
├── cli.py # CLI (click-based)
|
|
193
|
-
├── config.py # Configuration (code2docs.yaml)
|
|
194
|
-
├── analyzers/ # Adapters to code2llm + custom detectors
|
|
195
|
-
│ ├── project_scanner.py # Wrapper on code2llm.ProjectAnalyzer
|
|
196
|
-
│ ├── endpoint_detector.py # Flask/FastAPI/Django route extraction
|
|
197
|
-
│ ├── docstring_extractor.py
|
|
198
|
-
│ └── dependency_scanner.py
|
|
199
|
-
├── generators/ # Documentation generators
|
|
200
|
-
│ ├── readme_gen.py # README.md generator
|
|
201
|
-
│ ├── api_reference_gen.py # docs/api/ reference from signatures
|
|
202
|
-
│ ├── module_docs_gen.py # docs/modules/ per-module docs
|
|
203
|
-
│ ├── examples_gen.py # examples/ from signatures
|
|
204
|
-
│ ├── changelog_gen.py # CHANGELOG from git log
|
|
205
|
-
│ └── architecture_gen.py # Architecture + Mermaid diagrams
|
|
206
|
-
├── templates/ # Jinja2 templates
|
|
207
|
-
├── sync/ # Change detection & selective regeneration
|
|
208
|
-
│ ├── differ.py
|
|
209
|
-
│ ├── updater.py
|
|
210
|
-
│ └── watcher.py
|
|
211
|
-
└── formatters/ # Markdown, badges, TOC
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
## Requirements
|
|
215
|
-
|
|
216
|
-
- Python >= 3.9
|
|
217
|
-
- [code2llm](https://github.com/wronai/code2llm) >= 0.5.0
|
|
218
|
-
- Jinja2 >= 3.1
|
|
219
|
-
- Click >= 8.0
|
|
220
|
-
- PyYAML >= 6.0
|
|
221
|
-
|
|
222
|
-
## License
|
|
223
|
-
|
|
224
|
-
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
225
|
-
|
|
226
|
-
## Author
|
|
227
|
-
|
|
228
|
-
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
|
code2docs-0.1.1/README.md
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
# code2docs
|
|
2
|
-
|
|
3
|
-
  
|
|
4
|
-
|
|
5
|
-
> Auto-generate and sync project documentation from source code analysis.
|
|
6
|
-
|
|
7
|
-
**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.
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
code2llm → AnalysisResult → .toon / .mmd / context.md (for LLM)
|
|
11
|
-
code2docs → AnalysisResult → README.md / docs/ / examples/ (for humans)
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
pip install code2docs
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Or from source:
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
git clone https://github.com/wronai/code2docs
|
|
24
|
-
cd code2docs
|
|
25
|
-
pip install -e .
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Optional extras
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
pip install code2docs[watch] # file watcher (watchdog)
|
|
32
|
-
pip install code2docs[mkdocs] # MkDocs integration
|
|
33
|
-
pip install code2docs[dev] # development tools
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Quick Start
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
# Generate full documentation for a project
|
|
40
|
-
code2docs ./my-project
|
|
41
|
-
|
|
42
|
-
# Generate only README
|
|
43
|
-
code2docs ./my-project --readme-only
|
|
44
|
-
|
|
45
|
-
# Sync (regenerate only changed modules)
|
|
46
|
-
code2docs sync ./my-project
|
|
47
|
-
|
|
48
|
-
# Watch mode (auto-resync on file changes)
|
|
49
|
-
code2docs watch ./my-project
|
|
50
|
-
|
|
51
|
-
# Initialize config file
|
|
52
|
-
code2docs init ./my-project
|
|
53
|
-
|
|
54
|
-
# Dry-run (show what would be generated)
|
|
55
|
-
code2docs ./my-project --dry-run
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Python API
|
|
59
|
-
|
|
60
|
-
```python
|
|
61
|
-
from code2docs import generate_readme, generate_docs, Code2DocsConfig
|
|
62
|
-
|
|
63
|
-
# Generate README
|
|
64
|
-
generate_readme("./my-project", output="README.md")
|
|
65
|
-
|
|
66
|
-
# Generate full docs with custom config
|
|
67
|
-
config = Code2DocsConfig(project_name="mylib", verbose=True)
|
|
68
|
-
docs = generate_docs("./my-project", config=config)
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Generated Output
|
|
72
|
-
|
|
73
|
-
```
|
|
74
|
-
<project>/
|
|
75
|
-
├── README.md # Main README (auto-generated sections)
|
|
76
|
-
├── docs/
|
|
77
|
-
│ ├── index.md # Documentation index
|
|
78
|
-
│ ├── architecture.md # Architecture + Mermaid diagrams
|
|
79
|
-
│ ├── api/
|
|
80
|
-
│ │ ├── index.md # API overview
|
|
81
|
-
│ │ ├── module_analyzer.md # Per-module API reference
|
|
82
|
-
│ │ └── ...
|
|
83
|
-
│ └── modules/
|
|
84
|
-
│ ├── analyzer.md # Detailed module documentation
|
|
85
|
-
│ └── ...
|
|
86
|
-
├── examples/
|
|
87
|
-
│ ├── basic_usage.py # Auto-generated usage example
|
|
88
|
-
│ ├── class_examples.py # Class usage examples
|
|
89
|
-
│ └── ...
|
|
90
|
-
└── code2docs.yaml # Generator configuration
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Configuration
|
|
94
|
-
|
|
95
|
-
Create `code2docs.yaml` in your project root (or run `code2docs init`):
|
|
96
|
-
|
|
97
|
-
```yaml
|
|
98
|
-
project:
|
|
99
|
-
name: my-project
|
|
100
|
-
source: ./
|
|
101
|
-
output: ./docs/
|
|
102
|
-
|
|
103
|
-
readme:
|
|
104
|
-
sections:
|
|
105
|
-
- overview
|
|
106
|
-
- install
|
|
107
|
-
- quickstart
|
|
108
|
-
- api
|
|
109
|
-
- structure
|
|
110
|
-
- endpoints
|
|
111
|
-
badges:
|
|
112
|
-
- version
|
|
113
|
-
- python
|
|
114
|
-
- coverage
|
|
115
|
-
- complexity
|
|
116
|
-
sync_markers: true
|
|
117
|
-
|
|
118
|
-
docs:
|
|
119
|
-
api_reference: true
|
|
120
|
-
module_docs: true
|
|
121
|
-
architecture: true
|
|
122
|
-
changelog: true
|
|
123
|
-
|
|
124
|
-
examples:
|
|
125
|
-
auto_generate: true
|
|
126
|
-
from_entry_points: true
|
|
127
|
-
|
|
128
|
-
sync:
|
|
129
|
-
strategy: markers # markers | full | git-diff
|
|
130
|
-
watch: false
|
|
131
|
-
ignore:
|
|
132
|
-
- "tests/"
|
|
133
|
-
- "__pycache__"
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Sync Markers
|
|
137
|
-
|
|
138
|
-
code2docs can update only specific sections of an existing README using markers:
|
|
139
|
-
|
|
140
|
-
```markdown
|
|
141
|
-
<!-- code2docs:start -->
|
|
142
|
-
... auto-generated content ...
|
|
143
|
-
<!-- code2docs:end -->
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Content outside markers is preserved.
|
|
147
|
-
|
|
148
|
-
## Architecture
|
|
149
|
-
|
|
150
|
-
```
|
|
151
|
-
code2docs/
|
|
152
|
-
├── cli.py # CLI (click-based)
|
|
153
|
-
├── config.py # Configuration (code2docs.yaml)
|
|
154
|
-
├── analyzers/ # Adapters to code2llm + custom detectors
|
|
155
|
-
│ ├── project_scanner.py # Wrapper on code2llm.ProjectAnalyzer
|
|
156
|
-
│ ├── endpoint_detector.py # Flask/FastAPI/Django route extraction
|
|
157
|
-
│ ├── docstring_extractor.py
|
|
158
|
-
│ └── dependency_scanner.py
|
|
159
|
-
├── generators/ # Documentation generators
|
|
160
|
-
│ ├── readme_gen.py # README.md generator
|
|
161
|
-
│ ├── api_reference_gen.py # docs/api/ reference from signatures
|
|
162
|
-
│ ├── module_docs_gen.py # docs/modules/ per-module docs
|
|
163
|
-
│ ├── examples_gen.py # examples/ from signatures
|
|
164
|
-
│ ├── changelog_gen.py # CHANGELOG from git log
|
|
165
|
-
│ └── architecture_gen.py # Architecture + Mermaid diagrams
|
|
166
|
-
├── templates/ # Jinja2 templates
|
|
167
|
-
├── sync/ # Change detection & selective regeneration
|
|
168
|
-
│ ├── differ.py
|
|
169
|
-
│ ├── updater.py
|
|
170
|
-
│ └── watcher.py
|
|
171
|
-
└── formatters/ # Markdown, badges, TOC
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Requirements
|
|
175
|
-
|
|
176
|
-
- Python >= 3.9
|
|
177
|
-
- [code2llm](https://github.com/wronai/code2llm) >= 0.5.0
|
|
178
|
-
- Jinja2 >= 3.1
|
|
179
|
-
- Click >= 8.0
|
|
180
|
-
- PyYAML >= 6.0
|
|
181
|
-
|
|
182
|
-
## License
|
|
183
|
-
|
|
184
|
-
Apache License 2.0 - see [LICENSE](LICENSE) for details.
|
|
185
|
-
|
|
186
|
-
## Author
|
|
187
|
-
|
|
188
|
-
Created by **Tom Sapletta** - [tom@sapletta.com](mailto:tom@sapletta.com)
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"""Badge generation using shields.io URLs."""
|
|
2
|
-
|
|
3
|
-
from typing import Dict, List, Optional
|
|
4
|
-
from urllib.parse import quote
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def generate_badges(project_name: str, badge_types: List[str],
|
|
8
|
-
stats: Dict = None, deps=None) -> str:
|
|
9
|
-
"""Generate shields.io badge Markdown strings."""
|
|
10
|
-
stats = stats or {}
|
|
11
|
-
badges: List[str] = []
|
|
12
|
-
|
|
13
|
-
for badge_type in badge_types:
|
|
14
|
-
badge = _make_badge(badge_type, project_name, stats, deps)
|
|
15
|
-
if badge:
|
|
16
|
-
badges.append(badge)
|
|
17
|
-
|
|
18
|
-
return " ".join(badges)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
def _make_badge(badge_type: str, project_name: str,
|
|
22
|
-
stats: Dict, deps) -> Optional[str]:
|
|
23
|
-
"""Create a single badge Markdown string."""
|
|
24
|
-
name = quote(project_name)
|
|
25
|
-
|
|
26
|
-
if badge_type == "version":
|
|
27
|
-
return f""
|
|
28
|
-
|
|
29
|
-
elif badge_type == "python":
|
|
30
|
-
py_version = ""
|
|
31
|
-
if deps and hasattr(deps, "python_version"):
|
|
32
|
-
py_version = deps.python_version
|
|
33
|
-
py_version = py_version or ">=3.9"
|
|
34
|
-
py_safe = quote(py_version)
|
|
35
|
-
return f""
|
|
36
|
-
|
|
37
|
-
elif badge_type == "coverage":
|
|
38
|
-
return f""
|
|
39
|
-
|
|
40
|
-
elif badge_type == "complexity":
|
|
41
|
-
funcs = stats.get("functions_found", 0)
|
|
42
|
-
if funcs:
|
|
43
|
-
return f""
|
|
44
|
-
return None
|
|
45
|
-
|
|
46
|
-
elif badge_type == "license":
|
|
47
|
-
return f""
|
|
48
|
-
|
|
49
|
-
elif badge_type == "docs":
|
|
50
|
-
return f""
|
|
51
|
-
|
|
52
|
-
return None
|