Skip to content

Latest commit

 

History

History
579 lines (398 loc) · 30.7 KB

File metadata and controls

579 lines (398 loc) · 30.7 KB

code2docs — Module Reference

40 modules | 255 functions | 56 classes

Module Overview

Module Lines Functions Classes CC avg Description Source
analyzers.dependency_scanner 325 0 3 6.0 Scan project dependencies from requirements.txt, pyproject.t source
analyzers.docstring_extractor 140 0 2 3.5 Extract and analyze docstrings from source code. source
analyzers.endpoint_detector 113 0 2 4.0 Detect web framework endpoints (Flask, FastAPI, Django) from source
analyzers.project_scanner 42 1 1 1.2 Wrapper around code2llm's ProjectAnalyzer for documentation source
base 46 0 2 1.0 Base generator interface and generation context. source
cli 319 13 1 3.4 CLI interface for code2docs. source
code2docs 32 1 0 4.0 code2docs - Auto-generate and sync project documentation fro source
config 297 0 7 3.4 Configuration for code2docs documentation generation. source
formatters.badges 52 2 0 7.5 Badge generation using shields.io URLs. source
formatters.markdown 73 0 1 1.2 Markdown formatting utilities. source
formatters.toc 63 3 0 3.3 Table of contents generator from Markdown headings. source
generators 59 1 0 5.0 Documentation generators — produce Markdown, examples, and d source
generators._registry_adapters 287 0 14 2.0 Registry adapters — wrap existing generators into BaseGenera source
generators._source_links 76 0 1 3.0 Helper for generating source code links in documentation. source
generators.api_changelog_gen 196 0 2 5.4 API changelog generator — diff function/class signatures bet source
generators.api_reference_gen 163 0 1 8.7 API reference documentation generator — single consolidated source
generators.architecture_gen 294 0 1 6.9 Architecture documentation generator with Mermaid diagrams. source
generators.changelog_gen 121 0 2 3.5 Changelog generator from git log and API diff. source
generators.code2llm_gen 206 2 1 7.0 code2llm integration generator — produces analysis files in source
generators.config_docs_gen 125 0 1 4.2 Configuration documentation generator. source
generators.contributing_gen 231 0 1 4.6 CONTRIBUTING.md generator from project tooling detection. source
generators.coverage_gen 104 0 1 4.4 Docstring coverage report generator. source
generators.depgraph_gen 140 0 1 3.9 Dependency graph generator — Mermaid diagram from coupling m source
generators.examples_gen 443 0 1 6.1 Auto-generate usage examples from public signatures and entr source
generators.getting_started_gen 196 0 1 7.1 Getting Started guide generator. source
generators.mkdocs_gen 110 0 1 3.2 MkDocs configuration generator — auto-generate mkdocs.yml fr source
generators.module_docs_gen 198 0 1 8.0 Module documentation generator — single consolidated modules source
generators.org_readme_gen 227 0 1 5.2 Organization README generator - generates overview of multip source
generators.readme_gen 477 1 1 6.0 README.md generator from AnalysisResult. source
llm_helper 161 1 1 2.3 LLM helper — optional LLM-assisted documentation generation source
registry 39 0 1 2.5 Generator registry — pluggable generator system. source
sync.differ 125 0 2 3.6 Detect changes in source code for selective documentation re source
sync.updater 51 0 1 3.0 Selectively regenerate documentation for changed modules. source
sync.watcher 75 1 0 5.0 File watcher for auto-resync on source changes (requires wat source

Core

base source

Base generator interface and generation context.

BaseGenerator (ABC) source : Abstract base for all documentation generators.

Method Args Returns CC
should_run `` 1
run ctx 1

GenerateContext source : Shared context passed to all generators during a run.

cli source

CLI interface for code2docs.

DefaultGroup (click.Group) source : Click Group that routes unknown subcommands to 'generate'.

Method Args Returns CC
parse_args ctx, args 4
  • check(project_path, config_path, target) — Health check — verify documentation completeness. source
  • diff(project_path, config_path) — Preview what would change without writing anything. source
  • generate(project_path, config_path, readme_only, sections, output, verbose, dry_run, llm_model, org_name) — Generate documentation (default command). source
  • init(project_path, output) — Initialize code2docs.yaml configuration file. source
  • main() — code2docs — Auto-generate project documentation from source code. source
  • sync(project_path, config_path, verbose, dry_run) — Synchronize documentation with source code changes. source
  • watch(project_path, config_path, verbose) — Watch for file changes and auto-regenerate docs. source

config source

Configuration for code2docs documentation generation.

Code2DocsConfig source : Main configuration for code2docs.

Method Args Returns CC
from_yaml cls, path 10
to_yaml path 1

Code2LlmConfig source : Configuration for code2llm analysis generation.

DocsConfig source : Configuration for docs/ generation.

ExamplesConfig source : Configuration for examples/ generation.

LLMConfig source : Configuration for optional LLM-assisted documentation generation.

Method Args Returns CC
from_env cls 1

ReadmeConfig source : Configuration for README generation.

SyncConfig source : Configuration for synchronization.

generators source

Documentation generators — produce Markdown, examples, and diagrams.

  • generate_docs(project_path, config) — High-level function to generate all documentation. source

llm_helper source

LLM helper — optional LLM-assisted documentation generation via litellm.

LLMHelper source : Thin wrapper around litellm for documentation generation.

Method Args Returns CC
complete prompt, system 7
generate_project_description project_name, modules_summary, entry_points 1
generate_architecture_summary project_name, layers, patterns 1
generate_getting_started_summary project_name, cli_commands, public_api 1
enhance_module_docstring module_name, functions, classes 1

registry source

Generator registry — pluggable generator system.

GeneratorRegistry source : Registry of documentation generators.

Method Args Returns CC
add generator 1
run_all ctx 4
run_only name, ctx 4

analyzers

analyzers.dependency_scanner source

Scan project dependencies from requirements.txt, pyproject.toml, setup.py, package.json, Cargo.toml, go.mod.

DependencyInfo source : Information about a project dependency.

DependencyScanner source : Scan and parse project dependency files.

Method Args Returns CC
scan project_path 8

ProjectDependencies source : All detected project dependencies.

analyzers.docstring_extractor source

Extract and analyze docstrings from source code.

DocstringExtractor source : Extract and parse docstrings from AnalysisResult.

Method Args Returns CC
extract_all result 5
parse docstring 2
coverage_report result 8

DocstringInfo source : Parsed docstring with sections.

analyzers.endpoint_detector source

Detect web framework endpoints (Flask, FastAPI, Django) from AST analysis.

Endpoint source : Represents a detected web endpoint.

EndpointDetector source : Detects web endpoints from decorator patterns in source code.

Method Args Returns CC
detect result, project_path 5

analyzers.project_scanner source

Wrapper around code2llm's ProjectAnalyzer for documentation purposes.

ProjectScanner source : Wraps code2llm's ProjectAnalyzer with code2docs-specific defaults.

Method Args Returns CC
analyze project_path 1
  • analyze_and_document(project_path, config) — Convenience function: analyze a project in one call. source

formatters

formatters.badges source

Badge generation using shields.io URLs.

  • generate_badges(project_name, badge_types, stats, deps) — Generate shields.io badge Markdown strings. source

formatters.markdown source

Markdown formatting utilities.

MarkdownFormatter source : Helper for constructing Markdown documents.

Method Args Returns CC
heading text, level 1
paragraph text 1
blockquote text 1
code_block code, language 1
inline_code text 1
bold text 1
link text, url 1
list_item text, indent 1
table headers, rows 4
separator `` 1
blank `` 1
render `` 1

formatters.toc source

Table of contents generator from Markdown headings.

  • extract_headings(content, max_depth) — Extract headings from Markdown content. source
  • generate_toc(markdown_content, max_depth) — Generate a table of contents from Markdown headings. source

generators

generators._registry_adapters source

Registry adapters — wrap existing generators into BaseGenerator interface.

ApiChangelogAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 2

ApiReferenceAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 2
run ctx 2

ArchitectureAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 2
run ctx 2

Code2LlmAdapter (BaseGenerator) source : Adapter for code2llm analysis generation.

Method Args Returns CC
should_run `` 1
run ctx 7

ConfigDocsAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 2

ContributingAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 2

CoverageAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 2

DepGraphAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 2

ExamplesAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 2
run ctx 2

GettingStartedAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 2

MkDocsAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 2

ModuleDocsAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 2
run ctx 2

OrgReadmeAdapter (BaseGenerator) source : Adapter for organization README generation.

Method Args Returns CC
should_run `` 2
run ctx 4

ReadmeGeneratorAdapter (BaseGenerator) source

Method Args Returns CC
should_run `` 1
run ctx 4

generators._source_links source

Helper for generating source code links in documentation.

SourceLinker source : Build source-code links (relative paths + optional GitHub/GitLab URLs).

Method Args Returns CC
source_link file, line 5
file_link file 1

generators.api_changelog_gen source

API changelog generator — diff function/class signatures between versions.

ApiChange source : A single API change between two analysis snapshots.

ApiChangelogGenerator source : Generate API changelog by diffing current analysis with a saved snapshot.

Method Args Returns CC
generate project_path 2
save_snapshot project_path 1

generators.api_reference_gen source

API reference documentation generator — single consolidated api.md.

ApiReferenceGenerator source : Generate docs/api.md — consolidated API reference.

Method Args Returns CC
generate `` 11

generators.architecture_gen source

Architecture documentation generator with Mermaid diagrams.

ArchitectureGenerator source : Generate docs/architecture.md — architecture overview with diagrams.

Method Args Returns CC
generate `` 13

generators.changelog_gen source

Changelog generator from git log and API diff.

ChangelogEntry source : A single changelog entry.

ChangelogGenerator source : Generate CHANGELOG.md from git log and analysis diff.

Method Args Returns CC
generate project_path, max_entries 3

generators.code2llm_gen source

code2llm integration generator — produces analysis files in project/ folder.

Code2LlmGenerator source : Generate code2llm analysis files in project/ directory.

Method Args Returns CC
generate_all `` 5
get_analysis_summary `` 2
  • generate_code2llm_analysis(project_path, config) — Convenience function to generate code2llm analysis. source
  • parse_gitignore(project_path) — Parse .gitignore file and return list of patterns to exclude. source

generators.config_docs_gen source

Configuration documentation generator.

ConfigDocsGenerator source : Generate docs/configuration.md from Code2DocsConfig dataclass.

Method Args Returns CC
generate `` 4

generators.contributing_gen source

CONTRIBUTING.md generator from project tooling detection.

ContributingGenerator source : Generate CONTRIBUTING.md by detecting dev tools from pyproject.toml.

Method Args Returns CC
generate `` 2

generators.coverage_gen source

Docstring coverage report generator.

CoverageGenerator source : Generate docs/coverage.md — docstring coverage report.

Method Args Returns CC
generate `` 2

generators.depgraph_gen source

Dependency graph generator — Mermaid diagram from coupling matrix.

DepGraphGenerator source : Generate docs/dependency-graph.md with Mermaid diagrams.

Method Args Returns CC
generate `` 2

generators.examples_gen source

Auto-generate usage examples from public signatures and entry points.

ExamplesGenerator source : Generate examples/ — usage examples from public API signatures.

Method Args Returns CC
generate_all `` 1
write_all output_dir, files 2

generators.getting_started_gen source

Getting Started guide generator.

GettingStartedGenerator source : Generate docs/getting-started.md from entry points and dependencies.

Method Args Returns CC
generate `` 3

generators.mkdocs_gen source

MkDocs configuration generator — auto-generate mkdocs.yml from docs tree.

MkDocsGenerator source : Generate mkdocs.yml from the docs/ directory structure.

Method Args Returns CC
generate docs_dir 4
write output_path, content 1

generators.module_docs_gen source

Module documentation generator — single consolidated modules.md.

ModuleDocsGenerator source : Generate docs/modules.md — consolidated module documentation.

Method Args Returns CC
generate `` 18

generators.org_readme_gen source

Organization README generator - generates overview of multiple projects.

OrgReadmeGenerator source : Generate organization README with list of projects and brief descriptions.

Method Args Returns CC
generate `` 2
write output_path, content 1

generators.readme_gen source

README.md generator from AnalysisResult.

ReadmeGenerator source : Generate README.md from AnalysisResult.

Method Args Returns CC
generate `` 3
write path, content 4
  • generate_readme(project_path, output, sections, sync_markers, config) — Convenience function to generate a README. source

sync

sync.differ source

Detect changes in source code for selective documentation regeneration.

ChangeInfo source : Describes a detected change.

Differ source : Detect changes between current source and previous state.

Method Args Returns CC
detect_changes project_path 6
save_state project_path 1

sync.updater source

Selectively regenerate documentation for changed modules.

Updater source : Apply selective documentation updates based on detected changes.

Method Args Returns CC
apply project_path, changes 4

sync.watcher source

File watcher for auto-resync on source changes (requires watchdog).

  • start_watcher(project_path, config) — Start watching project for file changes and auto-resync docs. source