power-pptx
v2.12.0Python 3.9 – 3.13MIT LicensePyPI: power-pptx

PowerPoint decks from Python, that actually fit

power-pptx is the actively-maintained fork of python-pptx. Generate, mutate, theme, animate and render .pptx files — no Microsoft PowerPoint required — with space-aware authoring so text never overflows its box.

$ pip install power-pptx

Everything the upstream left out

Drop-in compatible with python-pptx 1.0.2 — every addition ships with round-trip regression tests, so existing scripts keep working.

Space-aware authoring

fit_text() measures with Pillow font metrics and bakes a fitting size before save; auto_size and slide.lint() catch everything else. Text that never overflows its box.

Design system

DesignTokens, a token-resolving shape.style facade, Grid/Stack layout primitives and opinionated slide recipes — title, bullet, KPI, quote, image-hero.

Effects & gradients

Outer shadow, glow, soft edges, blur and reflection as non-mutating proxies; alpha-tinted colours; linear / radial / rectangular gradient fills.

Animations & transitions

Entrance / exit / emphasis presets, motion paths, per-paragraph reveal, sequencing, and deck-wide transitions including Morph.

Charting

Palette presets independent of chart_style, ten quick layouts, per-series gradient and pattern fills, one-call chart.recolour().

Lint & audit

slide.lint() reports overflow, off-slide shapes and collisions; slide.tidy() auto-fixes; audit(prs) gives a whole-deck Markdown report.

JSON authoring

power_pptx.compose.from_spec() builds a complete deck from a JSON-shaped spec; import_slide and apply_template cover cross-presentation work.

Theme reader & writer

Read theme colours and fonts, write fresh srgbClr values into the clrScheme, or apply a theme imported from a .potx.

Built for coding agents

Ships a Claude Code skill — python -m power_pptx.skill install — with cheat sheets, recipes and an anti-patterns guide for LLM-authored decks.

A deck in twenty lines

The working set covers ~90% of deck generation: open, add a slide, drop in a diagram recipe, tidy up the geometry, audit the whole deck, save. Everything is splattableBBox geometry — no raw EMU integers.

  • Three-tier layout safety: fit_text → auto_size → lint
  • Six native-shape diagram recipes cover architecture decks
  • Hex strings everywhere a colour is accepted
  • One-call audit(prs).markdown() for chat replies
from power_pptx import Presentation, BBox, audit
from power_pptx.diagrams import horizontal_pipeline

prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[5])
slide.shapes.title.text = "Pipeline overview"

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

slide.tidy()                 # lint + safe auto-fixes
print(audit(prs).markdown()) # whole-deck report
prs.save("out.pptx")

24

Public API modules

included

6

Diagram recipes

included

16

Skill reference docs

included

3.9–3.13

Python versions

included

Made for coding agents

The package ships its own Claude Code skill: cheat sheet, 16 focused reference docs, and an anti-patterns list of the mistakes LLMs commonly make. One command installs it.

$ python -m power_pptx.skill install