Skip to main content

epubcheck-bridge

PyPI test

epubcheck-bridge installs a pinned, checksum-verified copy of the official EPUBCheck distribution into the active Python environment. It exposes the upstream CLI as epubcheck and provides a small Python API for consuming JSON validation results.

It is a bridge to the official Java implementation, not a reimplementation of EPUB validation. This project is not affiliated with or endorsed by W3C or the DAISY Consortium.

The current release pins official EPUBCheck 5.3.0.

Requirements

  • Python 3.10 or newer
  • Java available as java on PATH
  • Network access when installing the pinned EPUBCheck distribution

Installation

Project dependency

Add the bridge, then explicitly install its pinned official distribution:

uv add epubcheck-bridge
uv run epubcheck-install
uv run epubcheck --version

Use uv add --dev epubcheck-bridge instead when validation is only a development or release task.

Inside an already activated virtual environment, pip can be used instead:

python -m pip install epubcheck-bridge
epubcheck-install
epubcheck --version

Standalone command

Install the two commands in an isolated uv tool environment:

uv tool install epubcheck-bridge
epubcheck-install
epubcheck --version

The installer must run from a virtual or tool environment. It places the official distribution under that environment's share/epubcheck-bridge/ directory. Re-running it is a no-op when the expected version and checksum are already installed; pass --force to replace it.

The download is explicit rather than an install hook or a first-run side effect. This keeps dependency installation predictable and lets offline validation fail with an actionable message.

Command-line usage

All arguments and the exit status are forwarded to the official command:

uv run epubcheck book.epub
uv run epubcheck --json report.json book.epub

When installed as a standalone tool, omit uv run.

Python API

Python callers can request a structured result:

from epubcheck_bridge import EpubCheckRunner

result = EpubCheckRunner().validate("book.epub")
if not result.passed:
    raise SystemExit(
        f"{result.fatals} fatal, {result.errors} error, {result.warnings} warning"
    )

EpubCheckResult includes the source and report paths, checker version, fatal, error and warning counts, subprocess exit code, parsed messages, and a passed property. Pass fail_on_warnings=True to validate() when warnings should also make the upstream command fail.

EpubCheckUnavailable reports resolution failures. EpubCheckExecutionError reports launch failures, timeouts, and unreadable or unexpected JSON reports.

Command resolution

The bridge resolves EPUBCheck in this order:

  1. command_path passed to EpubCheckRunner;
  2. the EPUBCHECK environment variable;
  3. the EPUBCHECK_JAR environment variable;
  4. the managed distribution installed by epubcheck-install;
  5. an external epubcheck command on PATH;
  6. /usr/share/java/epubcheck.jar.

An executable path is run directly. A .jar path is launched with java -jar.

Security and release policy

The upstream EPUBCheck version, archive URL, byte size, and SHA-256 digest are pinned in the package. Updating EPUBCheck requires a reviewed epubcheck-bridge release; runtime commands never resolve a moving "latest" download.

The EPUBCheck archive is downloaded directly from the upstream W3C GitHub release and retains its own license files. It is not bundled in this Python distribution.

epubcheck-bridge and EPUBCheck have independent version numbers and release cycles. A new bridge release is required whenever its pinned upstream distribution changes.

Development

The unit suite uses local fixtures and does not download EPUBCheck. The package repository owns one CI smoke test that downloads the pinned archive and runs the official Java version command.

uv sync --frozen
uv run ruff check .
uv run ruff format --check .
uv run pytest -q
uv build --no-sources

License

The Python bridge is released under the MIT License. The separately downloaded official EPUBCheck distribution is not part of this package and retains its own license.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epubcheck_bridge-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

epubcheck_bridge-0.1.1-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file epubcheck_bridge-0.1.1.tar.gz.

File metadata

  • Download URL: epubcheck_bridge-0.1.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for epubcheck_bridge-0.1.1.tar.gz
Algorithm Hash digest
SHA256 094524887a4cb638521e91b6fcc4a914470a529cc6412508db51c9713bb18568
MD5 c7166c95c7c96c0944b4d8ba02d78361
BLAKE2b-256 bc966b2d16b27df060c3a72bd314b716e70392ce79f1c190f2ae3faa66fa98a6

See more details on using hashes here.

File details

Details for the file epubcheck_bridge-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: epubcheck_bridge-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for epubcheck_bridge-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9734b024a1766e4986924d6918708dc5da61634c84362bb7e65ed58943e517c
MD5 96009da38e933392cd432eb09e6b8c2e
BLAKE2b-256 65902e0414f3583adcf0812a69d2919f857bf6901c752014930f4ade71583cd5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page