Files
doc-forge/docforge/__init__.py

76 lines
1.9 KiB
Python

"""
# doc-forge
`doc-forge` is a renderer-agnostic Python documentation compiler designed for
speed, flexibility, and beautiful output. It decouples the introspection of
your code from the rendering process, allowing you to generate documentation
for various platforms (starting with MkDocs) from a single internal models.
## Available Commands
- **build**: Build documentation (MkDocs site or MCP resources).
- **serve**: Serve documentation (MkDocs or MCP).
- **tree**: Visualize the introspected project structure.
## Installation
Install using `pip` with the optional `mkdocs` dependencies for a complete setup:
```bash
pip install doc-forge
```
## Quick Start
1. **Build Documentation**:
Introspect your package and generate documentation in one step:
```bash
# Build MkDocs site
doc-forge build --mkdocs --module my_package --site-name "My Docs"
# Build MCP resources
doc-forge build --mcp --module my_package
```
2. **Define Navigation**:
Create a `docforge.nav.yml` to organize your documentation:
```yaml
home: my_package/index.md
groups:
Core API:
- my_package/core/*.md
Utilities:
- my_package/utils.md
```
3. **Preview**:
```bash
# Serve MkDocs site
doc-forge serve --mkdocs
# Serve MCP documentation
doc-forge serve --mcp
```
## Project Structure
- `docforge.loaders`: Introspects source code using static analysis (`griffe`).
- `docforge.models`: The internal representation of your project, modules, and objects.
- `docforge.renderers`: Converters that turn the models into physical files.
- `docforge.nav`: Managers for logical-to-physical path mapping and navigation.
"""
from .loaders import GriffeLoader, discover_module_paths
from .renderers import MkDocsRenderer, MCPRenderer
from .cli import main
from . import models
__all__ = [
"GriffeLoader",
"discover_module_paths",
"MkDocsRenderer",
"MCPRenderer",
"models",
"main",
]