Skip to main content

keynote-parser

keynote-parser is a Python module for unpacking and re-packing Apple Keynote .key files. It supports Keynote files generated by Keynote version 8.3 (current as of January 2019).

Keynote uses a proprietary, compressed binary format to store its presentations. This format is comprised of a zip file containing images and videos, as well as Snappy-compressed Protobuf .iwa files containing metadata, text, and all other definitions used in the presentation.

keynote-parser unpacks these component files into .yaml files in a directory, making them editable by text editors and/or scripts, then allows re-packing of these files into a working Keynote archive.

What could you use this for? Well, I use it to allow versioning of Keynote files in Git, which makes diffs more understandable (rather than binary), as well as modifying text in Keynote files in response to external scripts. (e.g.: figures that update from databases before giving a presentation)

Installation

pip install keynote-parser

Usage

# Unpack MyPresentation.key into ./MyPresentation/
keynote-parser unpack MyPresentation.key

# Re-pack ./MyPresentation/ into MyPresentation.out.key 
keynote-parser pack ./MyPresentation/

# List the files within a Keynote archive
keynote-parser ls MyPresentation.key

# Dump a particular .iwa file into its yaml representation on stdout
keynote-parser cat MyPresentation.key /Index/Slide-00001.iwa

# Replace text within a Keynote file in-place
keynote-parser replace MyPresentation.key --find "hello world" --replace "hello dolly"

Updates

As keynote-parser includes private Protobuf definitions extracted from a copy of Keynote, new versions of Keynote will inevitably create .key files that cannot be read by keynote-parser. As new versions of Keynote are released, the following steps must be undertaken:

  • Run proto-dump on the new copy of Keynote to dump new Proto files.
    • Any . characters in the Protobuf definitions must be changed to _ characters manually.
  • Connect to a running copy of Keynote with lldb (or any other debugger) and manually copy the results of [TSPRegistry sharedRegistry] into mapping.py.

Credits

keynote-parser was built by Peter Sobot but heavily based on prior work by Sean Patrick O'Brien. A copy of O'Brien's format documentation is included in the docs folder for posterity.

License

All code in this repository is licensed under the MIT License, save for protobuf_patch.py, which contains its own license.

Copyright 2019 Peter Sobot

Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for keynote-parser 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keynote-parser 1.0.2
File Size Uploaded
keynote-parser-1.0.2.tar.gz 398.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for keynote-parser 1.0.2
File Interpreter ABI Platform
keynote_parser-1.0.2-py2.7.egg Legacy Egg format - - Details
keynote_parser-1.0.2-py2-none-any.whl Python 2 none any Details

Total release size: 1.7 MB

Release files / keynote-parser-1.0.2.tar.gz

Download URL keynote-parser-1.0.2.tar.gz
Size 398.5 kB
Tags Source
SHA-256 checksum
How to use checksums
223f22c855b1b91f9b3b71944b35e0e571ebd5a80262de7292d431069e125f17
BLAKE2b-256 checksum
How to use checksums
129f840b39559b4439b76ec0d095642dffe6bb7d99a71409988c79483146528c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.15

Release files / keynote_parser-1.0.2-py2.7.egg

Download URL keynote_parser-1.0.2-py2.7.egg
Size 838.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
bcc5697fde96704a4457b155af200b5d725f6bdfad116891dfa0a0f8fd091664
BLAKE2b-256 checksum
How to use checksums
6b490c8542811c3782ae561f01987c7118612ffb2cf61b372932f1cc3ae70657
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.15

Release files / keynote_parser-1.0.2-py2-none-any.whl

Download URL keynote_parser-1.0.2-py2-none-any.whl
Size 414.5 kB
Tags Python 2
SHA-256 checksum
How to use checksums
00011718dbb293cdd15f0e0696c00af8077806e67d3d32aeef15afde75c6bda6
BLAKE2b-256 checksum
How to use checksums
9f85ca38046618e47c4418808140a56895cce9205633a8986a9e963aa7b3e471
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.15
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page