Add LLM-friendly serialization and animation support#1
Draft
Copilot wants to merge 7 commits into
Draft
Conversation
… serialization Co-authored-by: spranav1998 <[email protected]>
Co-authored-by: spranav1998 <[email protected]>
…hecks Co-authored-by: spranav1998 <[email protected]>
Copilot
AI
changed the title
[WIP] Enhance PPTX library for better LLM integration
Add to_dict() and __repr__() to core objects for LLM-friendly serialization
Feb 20, 2026
…blic API Co-authored-by: spranav1998 <[email protected]>
Co-authored-by: spranav1998 <[email protected]>
…us alias Co-authored-by: spranav1998 <[email protected]>
Copilot
AI
changed the title
Add to_dict() and __repr__() to core objects for LLM-friendly serialization
Add LLM-friendly serialization and animation support
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two enhancements to make python-pptx more useful for LLM-driven presentation generation: structured serialization of presentation content, and programmatic animation of shapes.
Serialization (
to_dict()/__repr__())to_dict()returning JSON-serializable dicts onPresentation,Slide,BaseShape,TextFrame,_Paragraph,_Run,Font__repr__()on the same objects (defensive against incomplete/mock state inSlide)Font.to_dict()only includes explicitly-set properties to avoid inherited noisetests/test_llm_friendly.pyAnimation (
Slide.add_animation())src/pptx/enum/animation.py—PP_ANIMATION_TYPEenum: 14 entrance effects (APPEAR, FADE, FLY_IN×4, WIPE×4, SPLIT×2, WHEEL, DISSOLVE)src/pptx/oxml/slide.py—CT_Slide.add_animation()+ XML builders (_build_animation_timing_xml,_build_animation_click_par_xml) generating valid OOXML timing trees. Supports first-animation (full scaffold) and subsequent-animation (appended to existingmainSeq) paths._ANIMATION_FILTER_MAPmaps enum xml_values → OOXML filter/transition attrs.src/pptx/slide.py—Slide.add_animation(shape, animation_type, duration=500)public API with input validationtests/test_animation.pyUsage
All 2747 tests pass (2700 existing + 47 new).
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.