Skip to main content

epub-explorer

Epx reads epub files directly from ZIP, with no extraction needed. It auto-discovers a single .epub in the current directory, or you can pass a path explicitly.

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/AnswerDotAI/epub-explorer.git

How to use

Use the Epx() class to load a book. By default it will try to grab one in the current folder (if it’s the only one).

You can also pass a path to the book or set the env var EPX_BOOK.

b = Epx() # loads epub in the current folder
b
Chuang Tzu: Mystic, Moralist, and Social Reformer by Zhuangzi (42 sections)
b = Epx(path='chuang-tzu.epub')
b
Chuang Tzu: Mystic, Moralist, and Social Reformer by Zhuangzi (42 sections)

Table of contents

toc() maps spine indices to their TOC labels — these indices are what you pass to section():

b = Epx()
print(b.toc()[:300])
section  name
      0  wrap0000.xhtml
      1  Chuang Tzŭ
      2  CONTENTS.
      3  Introduction.
      4  Note on the Philosophy of Chaps. i-vii.
      5  CHAPTER I.
      6  CHAPTER II.
      7  CHAPTER III.
      8  CHAPTER IV.
      9  CHAPTER V.
     10  CHAPTER VI.
     11  CHAPTER VII.

Reading a section

section() converts any spine section to markdown:

print(b.section(5)[:200])
_Chuang Tzŭ._

![](2384639977200309426_i_decoline.jpg)

## CHAPTER I.

Transcendental Bliss.

_Argument_ :—Space infinite—Time infinite—Relativity of magnitudes, physical and moral—The magnitude absol

Searching

search() finds text anywhere in the book, ignoring case and markdown formatting; it returns section, line, internal path, and text records:

b.search('transcendental bliss')
[{'section': 2, 'line': 7, 'href': '887456179853867412_59709-h-1.htm.xhtml', 'text': 'CHAPTER| I | —Transcendental Bliss | [1](887456179853867412_59709-h-4.htm.xhtml#Page_1)  '}, {'section': 5, 'line': 7, 'href': '887456179853867412_59709-h-4.htm.xhtml', 'text': 'Transcendental Bliss.'}]

Images

Images can be extracted by their epub-internal path:

b.images()
['2384639977200309426_cover.jpg',
 '2384639977200309426_i_title.jpg',
 '2384639977200309426_i_title-image.jpg',
 '2384639977200309426_i_decoline.jpg',
 '2384639977200309426_i_decoline2.jpg']
b.img('2384639977200309426_cover.jpg')

Metadata

Release files for epub-explorer 0.0.3

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

Source distribution (sdist)

Source distribution for epub-explorer 0.0.3
File Size Uploaded Provenance Actions
epub_explorer-0.0.3.tar.gz 11.5 kB Without provenance Details for epub_explorer-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for epub-explorer 0.0.3
File Interpreter ABI Platform Actions
epub_explorer-0.0.3-py3-none-any.whl Python 3 none any Details for epub_explorer-0.0.3-py3-none-any.whl

Total release size: 24.1 kB

Release files / epub_explorer-0.0.3.tar.gz

Download URL epub_explorer-0.0.3.tar.gz
Size 11.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d9d3fffe7b4ca67bf7b86856d3176aff3b1c63a3103f86f9cfc43eadfcfd008b
BLAKE2b-256 checksum
How to use checksums
4806d0a110d9bfd1068a9d0a321fdd439b20ebb94297c1aa07198f88a87a3a5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / epub_explorer-0.0.3-py3-none-any.whl

Download URL epub_explorer-0.0.3-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
623ea4087c919a3e40fa1a28dd4c2cf753d8b2b623677577a4a9c6aae6aa0767
BLAKE2b-256 checksum
How to use checksums
32ae4477faf34c2eb512f84225be3b4f905b5b7a7b9c8f00dcecc0b3469692c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for epub-explorer 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

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