Getting Started
power-pptx is the actively-maintained fork of python-pptx. It creates, reads and updates PowerPoint 2007+ (.pptx) files on any Python-capable platform — no Microsoft PowerPoint required. This guide gets you from zero to a saved deck.
Requirements
- Python 3.9 – 3.13 (3.9 through 3.13 are tested in CI)
- Runtime dependencies install automatically:
Pillow,XlsxWriter,lxml,typing_extensions
Install
pip install power-pptxThe distribution is named power-pptx on PyPI but imports aspower_pptx. The 2.0 release renamed the package from pptx so the fork and upstream python-pptx can be installed side-by-side.
Optional dependencies
| Extra | Needed for |
|---|---|
cairosvg | Auto-rasterising the PNG fallback in add_svg_picture(...) |
pyyaml | DesignTokens.from_yaml(...) |
soffice (LibreOffice) on PATH | Presentation.render_thumbnails() |
pdftoppm / pypdfium2 | The PDF→PNG split path in the thumbnail renderer |
Migrating from python-pptx
The fork is drop-in compatible with upstream 1.0.2. Replace pptx withpower_pptx in your imports and everything else keeps working:
# before
from pptx import Presentation
# after
from power_pptx import PresentationYour first deck
A minimal end-to-end pattern — open, add a slide, a diagram, some text, tidy up, save:
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]) # Title Only
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.shapes.add_text(
BBox.from_inches(0.5, 5.5, 9, 1),
text="Four-stage data pipeline.",
align="center", size_pt=14, color="#666666",
)
slide.tidy() # lint + safe auto-fixes
print(audit(prs).markdown()) # optional whole-deck report
prs.save("out.pptx")Core concepts in sixty seconds
- Presentation — the deck.
Presentation()starts blank;Presentation("file.pptx")opens an existing one. Callprs.save("out.pptx")once at the end. - Slides & layouts —
prs.slides.add_slide(prs.slide_layouts[i])appends a slide from a layout (index 5 = Title Only, 6 = Blank in the default template). - BBox — an immutable rectangular region in EMU.
BBox.from_inches(x, y, w, h)splats directly into everyadd_*API. Never write raw EMU integers — useInches,Pt,Cm. - Colours — hex strings (
"#0B5CFF"), tuples andRGBColorall work anywhere a colour is accepted. - Space-aware authoring — the reason this fork exists. ReadSpace-Aware Authoring before generating decks from dynamic content.
Where next
- Advanced usage — geometry, effects, animations, charts, themes
- Coding agents — install the bundled skill for Claude Code and friends
- API reference — the full public surface
- Examples in the repo — ten real-world decks built end-to-end