Skip to main content

Kodudo

PyPI version Python versions License: GPL v3 Code style: ruff

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-Output: Render multiple output files from a single config with outputs.
  • Per-Record Rendering: Generate one file per data record with foreach and path interpolation.
  • 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)
paths = kodudo.cook("config.yaml")

# Cook with runtime overrides (no temp files needed)
batch = kodudo.load_config("config.yaml")
for locale in ("pt", "en"):
    kodudo.cook_from_config(
        batch.config,
        context={"lang": locale},
        output=f"docs/{locale}/page.html",
    )

# Render directly to a string
html = kodudo.render(
    data=[{"name": "Alice"}, {"name": "Bob"}],
    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:

# Single output
input: data/records.json
template: templates/page.html.j2
output: output/page.html
context:
  title: "My Documents"
# Multi-output (e.g., locales)
input: data/records.json
template: templates/page.html.j2
outputs:
  - output: en/page.html
    context: { lang: en }
  - output: pt/page.html
    context: { lang: pt }
# Per-record rendering
input: data/articles.json
template: templates/article.html.j2
output: articles/{article.slug}.html
foreach: article

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)

Metadata

Release files for kodudo 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kodudo 0.2.0
File Size Uploaded
kodudo-0.2.0.tar.gz 30.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kodudo 0.2.0
File Interpreter ABI Platform
kodudo-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 56.6 kB

Release files / kodudo-0.2.0.tar.gz

Download URL kodudo-0.2.0.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4b9e11652d68de6e5b88d2f02281fc5eb457a38879019985f112087286c38949
BLAKE2b-256 checksum
How to use checksums
df125d7bda8e6d6c659f12f003a9cbb25b813f6856787ac9ed2ea87c10f38311
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / kodudo-0.2.0-py3-none-any.whl

Download URL kodudo-0.2.0-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b5c9c6af1686a2f769e4a8ebe94b04c8dff2d515d03ade21ecbe4ec9994fad3
BLAKE2b-256 checksum
How to use checksums
d183ca3a3008cbdb14e875e5e670dc5c14ebe6a3986a64f7015574f082b0c8ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page