Skip to main content

Generate structured Markdown documentation from project directories

Project description

DocGen — Codebase Documentation Generator

Effortlessly generate Markdown documentation from your source code with DocGen.
It’s quick to set up, highly configurable, and supports multiple languages.

PyPI version License: MIT

Table of Contents

  1. 📋 Overview
  2. Features
  3. 📦 Requirements
  4. Installation
  5. 🚀 Quick Start
  6. 💻 Command Line Options
  7. 🧙‍♂️ Interactive Wizard
  8. 📝 Examples
  9. 🎨 Output Customization
  10. 🔤 Supported Languages
  11. ⚙️ Configuration
  12. 🔧 Troubleshooting
  13. 👥 Contributing
  14. 📄 License

1. Overview

DocGen makes it easy to create sleek, up-to-date project documentation.
Use the interactive wizard for a guided setup or jump straight into the CLI for customized reports.

Key benefits:

  • Saves time with automatic scanning of files and folders
  • Offers multiple table of contents formats and collapsible sections
  • Handles large files by chunking content for better readability
  • Works on Windows, macOS, and Linux

2. Features

  • Interactive Wizard: Step-by-step prompts for quick config
  • Project Tree Visualization: Easily see project structure with file extension filters
  • Selective Coverage: Document subfolders or specific file types
  • Flexible TOC: Multiple formats (full paths, filenames, or minimal)
  • Language-Aware: Syntax highlighting and optional line numbers
  • Chunking: Read large files in manageable blocks
  • Fast Reports: Skip detail for high-level project stats (--fast-report)
  • Automation: Generate CLI commands for reuse
  • Minimal or Full Output: Choose a light or detailed style
  • Progress Bar: Visual feedback while scanning large projects

3. Requirements

  • Python 3.7+
  • Runs on Windows, macOS, Linux

Dependencies:

  • Standard Python libraries (pathlib, typing)
  • dataclasses (only for Python < 3.7)

4. Installation

Simple (Global)

pip install py-code-docgen

Development (Recommended)

git clone https://github.com/ci-psy/DocGen.git
cd DocGen
python3 -m venv venv
source venv/bin/activate  # macOS/Linux
venv\Scripts\activate.bat # Windows
pip install -r requirements.txt

5. Quick Start

  1. Interactive Wizard
    py-code-docgen -i
    
  2. Fast Report
    py-code-docgen --fast-report
    
  3. Basic Usage
    py-code-docgen [project_dir] -o output.md --include "py,js,cpp"
    
  4. Help
    py-code-docgen --help
    

6. Command Line Options

usage: py-code-docgen [options] [project_dir]
  • --include "ext1,ext2": Only document these file extensions
  • --folders "folder1,folder2": Restrict documentation to specific subfolders
  • --show "ext1,ext2": Control which extensions appear in the project tree
  • --chunk-size N: Break large files into chunks of size N lines
  • --toc-format: Set how the table of contents labels files
  • --collapsible-level: Choose sections to make collapsible
  • --show-progress: Enable a progress bar

More details are available with:

py-code-docgen --help

7. Interactive Wizard

The wizard guides you through:

  • Project Overview: Basic stats and file listing
  • File Types and Subfolders: Select which files to include
  • TOC and Collapsible Sections: Decide how sections appear
  • CLI Command Generation: Easily reuse or share the exact command

Example wizard command:

py-code-docgen "my_project" -o "docs.md" \
  --include "py,js" --toc-format full \
  --collapsible-level main --line-numbers

8. Examples

  • Basic
    py-code-docgen .
    
  • Python Only
    py-code-docgen --include py --no-toc --minimal
    
  • C++ + Collapsible
    py-code-docgen --include cpp --toc-format full \
      --collapsible-level main --line-numbers
    
  • Fast Analysis
    py-code-docgen --fast-report
    
  • Chunking Large Files
    py-code-docgen . --chunk-size 100 --collapsible-level all
    
  • Subfolders
    py-code-docgen . --folders "src,tests" --include "py" --show-progress
    

9. Output Customization

  • TOC Format: Full paths, filename.ext, or just the name
  • Collapsible Sections: Adjust the collapsible level (all, main only, or none)
  • File Info: Include file size, timestamps, and line counts
  • Code Display: Syntax highlighting, line numbers, chunking

10. Supported Languages

DocGen supports a wide range of languages, including but not limited to:

  • Web/Markup: .html, .css, .jsx, .tsx, .vue, .scss, .less
  • Python: .py, .pyi, .pyx, .pxd
  • C/C++: .c, .cpp, .cc, .cxx, .hpp, etc.
  • Java/JVM: .java, .kt, .kts, .groovy, .scala
  • Shell: .sh, .bash, .zsh, .fish, .ps1
  • Other: .swift, .rust, .go, .php, .ruby, .lua, .dart, etc.

Note: Syntax highlighting depends on your Markdown viewer.


11. Configuration

  • Exclude Patterns: --exclude "node_modules/,*.test.js"
  • Subfolders Only: --folders "src,tests"
  • Chunk Size: --chunk-size 100

Minimal Mode:

py-code-docgen --minimal

Full Mode:

py-code-docgen --show-all --line-numbers --path-info

Progress Bar:

py-code-docgen --show-progress

12. Troubleshooting

  • Command Not Found: Make sure you’ve activated the virtual environment or installed globally
  • Large Files: Lower the --chunk-size
  • Encoding Errors: Check files are in UTF-8
  • Permissions: Verify you have the right access level

Check version:

py-code-docgen --version

13. Contributing

Contributions are welcome! Please open issues or submit pull requests on GitHub.


14. License

This project is licensed under the MIT License.

Project details


Download files

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

Source Distribution

py_code_docgen-0.2.1.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

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

py_code_docgen-0.2.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file py_code_docgen-0.2.1.tar.gz.

File metadata

  • Download URL: py_code_docgen-0.2.1.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for py_code_docgen-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cc005abe094c745ea5594c7b6e4eb36706a07c66eed348fcf4ec131b37ca0320
MD5 597b59a30d5ef615681a34a7c4aa48ca
BLAKE2b-256 8b14b7206478b65b16ac326ae81e35f36671b764bbf71d0d94ef689231b67f0d

See more details on using hashes here.

File details

Details for the file py_code_docgen-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: py_code_docgen-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.0

File hashes

Hashes for py_code_docgen-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a451c36771b28d918e26e04c055445f528eecc19486d410c5c963b87594aaf4
MD5 244e91039877818f81e1fce3d320125d
BLAKE2b-256 b4522e8a9de9759b39d1ef23c5424668c9bd7eea837a75bba3687e2e342e42fd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page