skip to navigation
skip to content

mkepub 1.1

Simple minimalistic library for creating EPUB3 files


mkepub is a minimalistic library for creating .epub files.


  • Easy to use, minimalistic API.
  • Automatically generated TOC.
  • Support for nested TOC of any depth.
  • Support for embedded images.
  • In-progress books are stored on disk rather than in memory, enabling creation of large (5000+ pages, 20+ MiBs) epub files.
  • Adherence to the EPUB3 specs.
  • Support for most of the EPUB metadata, including language, subject, description, and rights.


  • No support for custom page filenames or directory structure.
  • No support for reading or editing epub files.
  • No support for font-embedding or most other less commonly used EPUB features.
  • No content validation - using broken or unsupported html code as page content will lead to mkepub successfully creating a .epub file that does not meet EPUB3 specifications.
  • Probably other issues.

Basic Usage

import mkepub

book = mkepub.Book(title='An Example')
book.add_page(title='First Page', content='Lorem Ipsum etcetera.')'example.epub')

Advanced Usage

import mkepub

book = mkepub.Book(title='Advanced Example', author='The Author')
# multiple authors can be specified as a list:
# mkepub.Book(title='Advanced Example', authors=['The First Author', 'The Second Author'])
with open('cover.jpg', 'rb') as file:
with open('style.css') as file:

first = book.add_page('Chapter 1', 'And so the book begins.')

child = book.add_page('Chapter 1.1', 'Nested TOC is supported.', parent=first)
book.add_page('Chapter 1.1.1', 'Infinite nesting levels', parent=child)
book.add_page('Chapter 1.2', 'In any order you wish.', parent=first)

book.add_page('Chapter 2', 'Use <b>html</b> to make your text <span class="pink">prettier</span>')

book.add_page('Chapter 3: Images', '<img src="images/chapter3.png" alt="You can use images as well">')
# as long as you add them to the book:
with open('chapter3.png', 'rb') as file:
File Type Py Version Uploaded on Size
mkepub-1.1-py3-none-any.whl (md5) Python Wheel 3.4 2017-01-24 10KB
mkepub-1.1.tar.gz (md5) Source 2017-01-24 5KB