epub-utils#
A Python CLI and utility library for manipulating EPUB files.
epub-utils is a Python library and command-line tool that helps you inspect and manipulate EPUB files. It provides both a programmatic API and a CLI interface for working with EPUB metadata, content, and structure.
Features#
Parse and validate EPUB container and package files
Extract metadata like title, author, and identifier
Command-line interface for quick file inspection
Syntax highlighted XML output
Installation#
To install epub-utils, run:
pip install epub-utils
Quick Start#
Command Line Usage#
# Show container.xml contents
epub-utils your-book.epub container
# Show package OPF contents with syntax highlighting
epub-utils your-book.epub package
# Show table of contents
epub-utils your-book.epub toc
Python Library Usage#
from epub_utils import Document
# Load an EPUB document
doc = Document("path/to/book.epub")
# Access container metadata
print(f"Package file location: {doc.container.rootfile_path}")
# Access package metadata
print(f"Title: {doc.package.title}")
print(f"Author: {doc.package.author}")
print(f"Identifier: {doc.package.identifier}")