python-pptx
Create, read, and update PowerPoint presentations programmatically in Python
Repository Health
Technical Analysis
python-pptx is a Python library for creating, reading, and updating PowerPoint (.pptx) files without needing PowerPoint installed or licensed. It is commonly used to generate presentations from dynamic content such as database queries, analytics output, or JSON payloads, often in response to an HTTP request that returns a generated PPTX file.
The library models the OOXML slide format as a tree of Python objects — presentations, slides, shapes, text frames, tables, and charts — so consumers can build or edit decks with plain Python objects instead of manipulating XML directly. It can also analyze existing decks in a corpus, for example to extract text for search indexing or pull embedded images.
What You Get
- A
Presentationobject model covering slides, slide layouts, and slide masters - Shape APIs for text boxes, images, tables, and native PowerPoint charts
- Read/write access to existing .pptx files for templating and bulk editing
- Fine-grained control over fonts, colors, alignment, and placeholders
- Support for embedding images (BMP, GIF, JPEG, PNG, TIFF, WMF) and chart data
Common Use Cases
- Generating PowerPoint reports from database queries or analytics pipelines
- Serving a dynamically-built .pptx file as an HTTP response
- Templating recurring decks (e.g. weekly status decks) by editing a base .pptx
- Extracting text and images from a corpus of presentations for search indexing or analysis
- Automating tedious manual slide production tasks
Under The Hood
Architecture — python-pptx models a .pptx file as an OPC (Open Packaging Conventions) package: pptx/opc/package.py handles the zip-based part/relationship graph, while a content_type_to_part_class_map in pptx/__init__.py dispatches each XML part (slide, slide layout, slide master, chart, image, core properties) to a dedicated Part subclass under pptx/parts/. User-facing objects (Presentation, Slide, Shape, Table, Chart) in pptx/presentation.py, pptx/slide.py, pptx/shapes/, pptx/table.py, and pptx/chart/ wrap these parts’ underlying lxml-parsed OOXML elements (pptx/oxml/), giving a Pythonic object layer over the raw XML tree while lazily writing changes back on save. Tech Stack — pure Python (94% of the codebase) with a thin lxml dependency for XML parsing, Pillow for image introspection, and XlsxWriter for embedded chart workbook data; packaging uses setuptools with pyproject.toml, and the project ships inline type stubs (py.typed, a typings/ directory) checked with pyright. Code Quality — the repo pairs a large unittest/pytest-based tests/ tree (83 test files) with a parallel features/ directory of Gherkin behavioral specs, giving both unit-level and end-to-end acceptance coverage; module boundaries are organized by OOXML concern (opc, oxml, parts, shapes, dml, enum) which keeps low-level XML manipulation isolated from the public object API. API Design — the public surface is a single Presentation(path) entry point returning an object graph navigated with attribute access (prs.slides, slide.shapes, shape.text_frame) rather than raw XML manipulation, which keeps common operations (add a slide, insert a table, set text) low-boilerplate, though deeper formatting control still requires understanding the underlying OOXML concepts the object model is built on.
Used by 9 apps in this directory
Agno
Devops · AI Development · Automation
Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.
Banana Slides
AI Design Tools · Productivity
AI-native PPT generator with Vibe editing, multi-LLM support, and fully editable PPTX export
GPT Researcher
Productivity · AI Assistants
The pioneering open-source autonomous AI agent that conducts deep, multi-source research and produces citation-backed reports exceeding 2,000 words — faster and more reliably than any human researcher.
knowhere
AI Development · Developer Tools
Transform messy, unstructured documents into persistent, navigable memory that AI agents can actually use.
Open WebUI
AI Assistants · AI Agents
The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.
OpenHands
AI Code Assistants · AI Development
The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.
OpenViking
Databases · AI Development
An open-source context database that gives AI agents a unified filesystem for memory, resources, and skills with hierarchical tiered retrieval.
PrivateGPT
AI Development
The open-source API layer that turns local LLMs into production private AI applications with full Claude API compatibility
Skrun
AI Agents
An open, self-hostable, multi-model agent runtime that deploys any agent skill as an API via POST /run — an open-source alternative to Claude Managed Agents and Google's Gemini Enterprise Agent Platform.