Skip to main content

pystdoc: Python Structural & Topological Documentation Engine

pystdoc (Python Structural & Topological Documentation Engine) is an enterprise-grade, high-precision codebase and architectural documentation generator powered by LLMs, AST parsing, and libclang.

It analyzes codebases in bottom-up + top-down topological passes, constructs hierarchical execution/data models, and synthesizes clean, human-centric Markdown and Mermaid diagrams within a 16K context window.


📁 Output Directory: .docgen/

[!IMPORTANT] All generated documentation, architecture designs, and caches are automatically centralized inside the .docgen/ directory of your target project. Your existing source code files are never modified.

When pystdoc finishes, you can explore the complete documentation suite starting from .docgen/README.md:

your_project/
├── .docgen/                          # <-- Centralized output directory
│   ├── README.md                     # Executive summary: "What does this project actually do?"
│   ├── design/                       # System architecture and design documentation
│   │   ├── overview.md               # Architecture overview & inter-module Mermaid diagram
│   │   ├── data_models.md            # Data structure design, models, lifecycle & integrity
│   │   ├── execution_model.md        # Runtime execution model, paradigms, & control flow
│   │   └── modules/                  # Module-by-module detailed design documents
│   │       ├── module_a.md
│   │       └── ...
│   ├── documents/                    # Granular symbol & source code documentation
│   │   ├── src/main.c.md             # File-level overview and symbol list
│   │   ├── src/main.c.fn.main.md     # Individual symbol document (with call graph & context)
│   │   └── ...
│   ├── files.txt                     # List of scanned source files
│   └── index.db                      # SQLite WAL database for instantaneous incremental caching
├── src/
└── ...

🌟 Key Features

  1. Topological & Structural Ordering (Tarjan SCC + Kahn DAG):
    • Evaluates call graphs in $O(V+E)$ linear time.
    • Automatically breaks cyclic mutual recursions and organizes code symbols into dependency-safe execution levels.
    • Level-by-level parallel LLM execution guarantees context-rich bottom-up summaries without race conditions.
  2. 3-in-1 Unified Documentation Pipeline:
    • docgen: Bottom-up & top-down symbol-level documentation with SHA-256 and SQLite caching (.docgen/documents/).
    • designgen: Map-Reduce architectural synthesis (.docgen/design/).
    • reportgen / pystdoc: Executive summary README (.docgen/README.md) answering "What does this project actually do?"
  3. C/C++, Python & Shell Deep Understanding:
    • compile_commands.json Integration: Full include path resolution and macro expansion via libclang.
    • Fully Qualified Domain Names (FQDN): Disambiguates identical symbol names across large monorepos.
  4. Standard LLM Options & Multi-Language Support:
    • Works with Ollama, LiteRT-LM, vLLM, and OpenAI API.
    • Supports --host, --model, --token / --api-key, --context-size, and --language (e.g. English, Japanese, 日本語).

🚀 Quick Start

Installation

pip install pystdoc

Basic Usage

1. Generate Full Documentation & README (One Command)

pystdoc --dir ./my_project/

Output will be created at ./my_project/.docgen/README.md.

2. Generate in Japanese

pystdoc --dir ./my_project/ --language 日本語

3. Run Individual Steps

# Generate symbol-level docs into .docgen/documents/
docgen --dir ./my_project/ -j 4

# Synthesize architecture design docs into .docgen/design/
designgen --dir ./my_project/

⚙️ CLI Options

Option Alias / Env Default Description
--dir ./ Target project directory path
--language -l English Output documentation language (English, Japanese, 日本語)
--host -H, --base-url http://127.0.0.1:11434 LLM server host endpoint URL
--model -m, LLM_MODEL gemma4-26b-a4b LLM model identifier
--token --api-key, OPENAI_API_KEY None API Bearer token
--context-size --ctx-size 16384 Context window size
--concurrency -j 4 Number of parallel LLM workers
--force -f false Force regenerate all documents ignoring cache
--compile-commands None Path to compile_commands.json

📄 License

MIT License. Author: tab4moji.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pystdoc-0.2.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pystdoc-0.2.0-py3-none-any.whl (38.5 kB view details)

Uploaded Python 3

File details

Details for the file pystdoc-0.2.0.tar.gz.

File metadata

  • Download URL: pystdoc-0.2.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for pystdoc-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bff96ad102ab54faef3f4ea09f61d529ce09a9926dde467f11bbfff61bf6790c
MD5 0c981924d7a7a0ab19d8806bc6d8bac2
BLAKE2b-256 0433e5ca30961f80454f71d1758021ca90db8d9f20575a7b31f5d51e0b325352

See more details on using hashes here.

File details

Details for the file pystdoc-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pystdoc-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 38.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for pystdoc-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 652ac03a72a06879ce8c9348805ad6a02b84881eff5640da374412cf3e3ed84f
MD5 d51d1c4ca580a3ae40f31a9b6608807e
BLAKE2b-256 3fc155d3c4576c3619b74f34a50f77e76a97015f46381fdd7b3d9b74e4062b37

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.4

2 files

0.5.3

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

This release

0.2.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page