-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathquickstart.py
More file actions
50 lines (36 loc) · 1.34 KB
/
quickstart.py
File metadata and controls
50 lines (36 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
"""
Quickstart — code2docs
Minimal working examples for the most common use cases.
Run: python examples/quickstart.py
"""
from pathlib import Path
from code2docs import Code2DocsConfig
from code2docs import analyze_and_document
from code2docs import generate_docs
from code2docs import generate_readme
# ==================================================
# Example 1: Configuration
# ==================================================
config = Code2DocsConfig(
project_name="my-project",
source="./src",
output="./docs",
verbose=True,
)
# ==================================================
# Example 2: Generate documentation
# ==================================================
# Generate a README for your project
generate_readme("./my-project", output="README.md")
# Generate all documentation
docs = generate_docs("./my-project", config=config)
print(f"Generated {len(docs)} documentation sections")
# ==================================================
# Example 3: Analyze a project programmatically
# ==================================================
from code2docs.analyzers.project_scanner import ProjectScanner
scanner = ProjectScanner(config)
result = scanner.analyze("./my-project")
print(f"Found {len(result.functions)} functions")
print(f"Found {len(result.classes)} classes")
print(f"Found {len(result.modules)} modules")