Skip to main content

Declarative Document Format (DDF) — YAML to documents compiler

Project description

declarativedocs

Python reference compiler for the Declarative Document Format (DDF). Turns YAML into real documents.

Created by WeAreBrain.

Install

pip install declarativedocs

Supported formats

Format Schema Status
Presentation (.pptx) presentation: ✅ Available
Document (.docx) document: 🔜 Planned
PDF (.pdf) pdf: 🔜 Planned

The compiler auto-detects the format from the YAML root key.

Usage

CLI

ddf my-deck.yaml                    # → my-deck.pptx (auto-detected)
ddf my-deck.yaml output.pptx        # → explicit output path

Python API

from ddf import compile

compile("my-deck.yaml", "output.pptx")

Element types (Presentation)

Type Description
text Text box with plain text, rich text runs, or bullet lists
shape Rectangle, rounded rectangle, oval, line
image Image from file path or base64
chart Bar, line, pie, doughnut, scatter, radar
table Data table with styled cells
group Auto-layout container (row or grid) with card styling
icon Colored circle with glyph character

Features

  • Theme variables — Define colors and fonts once, reference with $name
  • Slide masters — Reusable templates with {{placeholder}} data binding
  • Auto-layoutrow and grid with configurable gap
  • Card styling — Fill, radius, shadow, border on group items
  • Shadow presetsdefault, soft, hard, glow, up
  • Bullet lists — Proper indentation and tight spacing
  • Icons in cards — Automatic positioning above text

Quick example

presentation:
  layout: "16x9"
  theme:
    colors:
      primary: "1E2761"
      white: "FFFFFF"
    fonts:
      heading: Georgia

  slides:
    - background: $primary
      elements:
        - type: text
          x: 1  y: 2  w: 8  h: 1.5
          text: "Hello DDF"
          font: $heading
          size: 44
          color: $white
          bold: true
          align: center
ddf hello.yaml  # → hello.pptx

Schema

See the full DDF specification.

Examples

See the examples/ directory for complete YAML files.

Why DDF?

LLMs currently write 800+ lines of imperative library code to produce a 10-slide deck. DDF describes the same deck in ~200 lines of YAML. That's 3-5x fewer tokens, with significantly fewer bugs.

DDF is a declarative spec — the LLM describes what it wants, the compiler figures out how. The YAML is the contract, the compiler is a swappable implementation detail.

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

declarativedocs-0.1.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

declarativedocs-0.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file declarativedocs-0.1.0.tar.gz.

File metadata

  • Download URL: declarativedocs-0.1.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for declarativedocs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bcbffb4b36a3fe95a9487621c43bcfc3a970af30925ec9ae4fc360bc64328bec
MD5 9da9fb870c32824b9d3a27b45ca500fa
BLAKE2b-256 e3d9cab3e9ab4bff454e94160838c9b8f5d5740c64e202b79e67a30e3355c888

See more details on using hashes here.

File details

Details for the file declarativedocs-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for declarativedocs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8b8bb12e9d4c80a1a7e0f704f71bb97fdcea291963010ec2bd6022fd06ebd05
MD5 bf2a015661614320fe11c3e9bb74d0f6
BLAKE2b-256 f355bff909e5831cd50d0fedcce8d40ef1bbd7b579209a06e11e87c75859c085

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page