Metadata-Version: 2.4
Name: audora-epublib
Version: 1.0.0
Summary: Clean-room EPUB 2/3 writer, a drop-in replacement for the API surface of ebooklib
Project-URL: Homepage, https://github.com/Archive-WP/epublib
Author-email: Aaron <aaron@audora.art>
License: Proprietary
Keywords: ebook,ebooklib,epub,epub3,publishing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Text Processing :: Markup :: XML
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: lxml>=5.0
Provides-Extra: dev
Requires-Dist: lxml-stubs; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: types-beautifulsoup4; extra == 'dev'
Description-Content-Type: text/markdown

# audora-epublib

### A proprietary python library for creating EPUB2/3 files.

This library functions as a drop-in replacement for the AGPL-licensed `ebooklib`, but was written without referencing any AGPL source code. Only the usage documentation and interface format of `ebooklib` were consulted during the creation of this library.

It does not aim to re-implement all functionality of `ebooklib`, merely that which is utilized by `WattpadDownloader`. The most notable exclusion is reading EPUB files.

This library aims to follow the EPUB 3.3 format specification, [as defined by the World Wide Web Consortium](https://www.w3.org/TR/2026/REC-epub-33-20260113/), with minimal backwards compatibility supported for EPUB 2.

## Installation

The package is published to the Forgejo registry, **not** to PyPI — the name `epublib` on PyPI belongs to an unrelated project. Resolve it explicitly:

```bash
pip install --extra-index-url https://forge.towu.dev/api/packages/aaron/pypi/simple/ audora-epublib
```

With `uv`, add the index to `pyproject.toml` so it applies to every command in the project:

```toml
[[tool.uv.index]]
name = "forgejo"
url = "https://forge.towu.dev/api/packages/aaron/pypi/simple/"
```

## Usage

Everything public is exported from the top level:

```python
from audora_epublib import EpubBook, EpubHtml, EpubImage, write_epub

book = EpubBook()
book.set_identifier("urn:uuid:...")
book.set_title("A Title")
book.set_language("en")
book.set_modified(datetime.now(timezone.utc))
book.add_author("An Author")

chapter = EpubHtml(
    file_name="chapter_1.xhtml",
    title="Chapter 1",
    content="<h1>Chapter 1</h1><p>...</p>",
)
book.add_item(chapter)

write_epub("book.epub", book)
```

The full public surface — every class, method, signature and raised exception — is documented in [api_specification.md](https://github.com/Archive-WP/epublib/blob/master/api_specification.md).

## Development

`ruff` is the formatter and linter; `mypy --strict` is the type checker. There is no test suite. See [AGENTS.md](https://github.com/Archive-WP/epublib/blob/master/AGENTS.md) for the conventions and the release process.

```bash
ruff format .
ruff check --fix .
mypy
```
