power-pptx

Diagram Recipes

power_pptx.diagrams ships six recipes built from native shapes — editable in PowerPoint, no images. Each takes a slide, a BBox, and a content spec, and covers the patterns that make up most architecture and process decks.

Pipelines

from power_pptx import Presentation, BBox
from power_pptx.diagrams import horizontal_pipeline, vertical_pipeline

prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6])   # Blank

horizontal_pipeline(
    slide, BBox.from_inches(0.5, 2.5, 9, 2.2),
    steps=["Extract", "Classify", "Enrich", "Output"],
    accent="#0B5CFF",
)

vertical_pipeline(
    slide, BBox.from_inches(4, 1, 2, 5),
    steps=["Plan", "Build", "Ship"],
)

Hub and spoke

from power_pptx.diagrams import hub_and_spoke

hub_and_spoke(
    slide, BBox.from_inches(1, 1.5, 8, 5),
    centre="Agent",
    spokes=["Memory", "Tools", "Planning"],
)

Cycle

from power_pptx.diagrams import cycle

cycle(
    slide, BBox.from_inches(2, 1.5, 6, 5),
    steps=["Observe", "Orient", "Decide", "Act"],
)

Decision tree

from power_pptx.diagrams import decision_tree

decision_tree(
    slide, BBox.from_inches(1, 1, 8, 5.5),
    root="Cache hit?",
    branches=[
        {"label": "Yes", "children": ["Serve cached"]},
        {"label": "No", "children": ["Compute", "Store"]},
    ],
)

Comparison columns

from power_pptx.diagrams import comparison_columns

comparison_columns(
    slide, BBox.from_inches(0.5, 1.5, 9, 5),
    columns=[
        {"title": "python-pptx", "items": ["Upstream 1.0.2", "Maintenance mode"]},
        {"title": "power-pptx", "items": ["Space-aware authoring", "Effects, animations, themes"]},
    ],
)

Tips

  • Recipes return the shapes they create, so you can restyle individual nodes afterwards.
  • Size the BBox generously and let the recipe distribute the nodes; use bb.inset() to keep diagrams off the slide chrome.
  • Combine with slide.tidy() before save so any accidental collisions get reported.