Generate structured DOCX documents and PPTX presentations from validated JSON configurations.
docgen provides a small CLI and Python API for data-driven document generation without assumptions about organization, subject, or document category.
- Builds DOCX files from ordered sections, reusable content blocks and fragments.
- Builds PPTX files from typed slide configurations.
- Expands opt-in scalar variables in user-visible text fields.
- Generates charts and structure diagrams.
- Embeds images and inline or external CSV tables by stable resource IDs.
- Validates the complete project before writing output atomically.
Python 3.10 or newer is required.
python -m pip install .For development:
python -m pip install -e '.[dev]'
python -m pytest -qdocgen init ./my-document
docgen build ./my-document/document.json
docgen init ./my-slides --kind presentation
docgen build ./my-slides/presentation.jsonOverride the configured output with docgen build CONFIG -o OUTPUT. Validate without writing output with docgen validate CONFIG.
{
"kind": "document",
"output": "result.docx",
"sections": [
{
"type": "content",
"title": "Overview",
"content": [
{"type": "paragraph", "text": "Hello."}
]
}
]
}Save as document.json, then run docgen validate document.json and docgen build document.json.
{
"kind": "presentation",
"output": "result.pptx",
"title": "Demo",
"slides": [
{"type": "title"},
{"type": "text", "title": "One", "text": "Hello."}
]
}Save as presentation.json, then run docgen validate presentation.json and docgen build presentation.json.
- Documents: sections, blocks, rich text, citations, and formatting.
- Presentations: typed slides, rich text, image fitting, and overflow.
- Variables and fragments: authoring expansion, normalization, and limits.
- Resources: tables, figures, diagrams, images, and CSV sources.
- CLI reference: commands, validation, diagnostics, and schemas.
- Development: development commands and known limitations.