How elapouya/python-docx-template works
docxtpl is a Python library and CLI for generating Word documents from .docx templates and context data. The main workflow validates inputs, loads a template and JSON context, renders the document, and saves the result. The library also provides rich-text, listing, inline-image, and subdocument helpers. The graph distinguishes the CLI orchestration from the template engine and helper features; several helper-to-render relationships are not shown in the excerpts, so they are not asserted.
Main entry points: template.py Template engine · __main__.py CLI workflow · subdoc.py Subdocuments · inline_image.py Inline images
Components 12
Entry points
- CLI workflow
docxtpl/__main__.py - JSON context
- DOCX template
- Generated DOCX
Template engine
- Template engine
docxtpl/template.py
Content helpers
- Rich text
docxtpl/richtext.py - Text listing
docxtpl/listing.py - Inline images
docxtpl/inline_image.py - Subdocuments
docxtpl/subdoc.py
Document dependencies
- Jinja2 renderer
- python-docx
Other components
- Developer
Connections 13
- Developer → CLI workflow: runs
docxtpl/__main__.py - Developer → DOCX template: provides
README.rst - Developer → JSON context: provides
- CLI workflow → JSON context: reads
docxtpl/__main__.py - CLI workflow → Template engine: loads, renders
docxtpl/__main__.py - CLI workflow → DOCX template: loads
docxtpl/__main__.py - CLI workflow → Template engine: saves via
docxtpl/__main__.py - Template engine → Generated DOCX: writes
README.rst - Template engine → Jinja2 renderer: renders with
README.rst - Template engine → python-docx: uses
README.rst - Inline images → Template engine: uses render part
docxtpl/inline_image.py - Template engine → Subdocuments: creates
docxtpl/template.py - Subdocuments → python-docx: loads document
docxtpl/subdoc.py