Cook your data into documents using Jinja2 templates
Project description
Kodudo
Kodudo is a Bororo word for "to cook".
It is a minimal, functional Python tool that cooks your data into documents using Jinja2 templates. Designed to work seamlessly with aptoro, it separates data preparation from presentation, allowing you to transform validated data into HTML, Markdown, or any other text format.
Features
- Data Agnostic: Works natively with Aptoro exports, plain JSON lists, or generic wrappers.
- Jinja2 Powered: Leverage the full power of Jinja2 templates, inheritance, and macros.
- Configuration over Code: Define complex rendering pipelines in simple YAML files.
- Context Aware: Automatically injects metadata, configuration, and custom context into templates.
- Multi-Format: Output to HTML, Markdown, text, or any text-based format.
Installation
pip install kodudo
CLI Usage
Kodudo provides a command-line interface for "cooking" documents from configuration files.
# Cook a single configuration file
kodudo cook config.yaml
# Cook multiple files at once
kodudo cook config1.yaml config2.yaml
# Use shell expansion
kodudo cook configs/*.yaml
Quick Start
import kodudo
# Cook using a config file (same as CLI)
kodudo.cook("config.yaml")
# Or programmatically
data = [
{"name": "Alice", "role": "Admin"},
{"name": "Bob", "role": "User"}
]
# Render directly to a string
html = kodudo.render(
data=data,
template="templates/users.html.j2",
context={"title": "User List"}
)
Documentation
For full details on configuration options, template variables, and data formats, see the Documentation.
Configuration
Define your rendering process in a YAML configuration file:
# config.yaml
input: data/records.json # Path to data (JSON with aptoro metadata or plain list)
template: templates/page.html.j2 # Path to Jinja2 template
output: output/page.html # Where to write the result
# Optional settings
format: html # html, markdown, or text (inferred if missing)
context_file: context.yaml # Load extra variables from a file
context: # Inline extra variables
title: "My Documents"
author: "Tiago"
Supported Formats
Input Data (JSON):
- Aptoro Format:
{ "meta": {...}, "data": [...] } - Plain List:
[ {...}, {...} ] - Generic Wrapper:
{ "results": [...] }
Output:
- HTML
- Markdown
- Text
- Any text-based format
License
GNU General Public License v3 (GPLv3)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kodudo-0.1.1.tar.gz.
File metadata
- Download URL: kodudo-0.1.1.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8dfacd65cffdf328cbaf51abee5f1c39194b7c417cb925396e42d1cd0d7ea3e
|
|
| MD5 |
bbb8712c6cd8b7ac36eb4fa18bb32d2d
|
|
| BLAKE2b-256 |
464b1d42256ef6339a61edcf0bf8b7f1e9c7b68550b12c64c9967141c41c77b1
|
File details
Details for the file kodudo-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kodudo-0.1.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6c907c7f84155a0eb36a5fe63ff3226a29655a6a608625b71a1e1f4547884b8
|
|
| MD5 |
4919c0f1d37f7e2e17de43ab615f36f6
|
|
| BLAKE2b-256 |
dbb0596fc18bda4ed79c3a10b02aa489683d79b6d8e202638189cacabc26d321
|