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 declarativedocs 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.2.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.2-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: declarativedocs-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 73474e04b0bbf49d1ffc47a06c1f06ede372c225ea8fcc50dc32fffdb895fe2b
MD5 f8e0168f51122ed686c2d7b6ae7c1904
BLAKE2b-256 38519a9add887f810107e1342d605a4ed88aaa0acfaaebac1afee4f0f33793ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for declarativedocs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1094d09500bb33a202e0cfd33188d88c7a90c35151c44f50dd1be5391e1fae20
MD5 e1f10f908fee0b394f8a195453056b02
BLAKE2b-256 49c2eebb4d5fa9fc70e35791c7d94ebc6fbd6351cf525a9b1379b6ab1349eb16

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