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.

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.1.tar.gz (67.7 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.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: declarativedocs-0.1.1.tar.gz
  • Upload date:
  • Size: 67.7 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.1.tar.gz
Algorithm Hash digest
SHA256 48a64fb9c38c90c967237801ad28be397590fc151b081e9f2c63e35517f6e9a2
MD5 f25168e1702dc28567acb16948d223e2
BLAKE2b-256 1a0d15007c102d13efadae8366ad8f01feb986a8dad1d17465c6ac9673b168c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for declarativedocs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 68b98df5c0cce11ff511265f5baab6438aaab1ef71f5a432274f48b17e85e1e8
MD5 5b72822549ceab5e2a074e0cda23d979
BLAKE2b-256 430319bd5ff094765d847c42f2eb851b75ade290efda7f7aca57b5269091f19e

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