Skip to main content

ebook-convert

Command-line ebook converter, carved out of the Calibre project. It is only the conversion pipeline: no GUI, no library management, no Qt, no device drivers. Just:

$ ebook-convert book.epub book.mobi

The package is pure Python and every dependency ships binary wheels, so it installs anywhere with a stock Python 3.10+ and no compiler.

This is a packaging-focused fork of gryf’s ebook-converter, which did the hard work of extracting the converter from Calibre and removing Qt. All credit for that goes to gryf and, of course, to Kovid Goyal and the Calibre contributors. The fork exists to publish the tool on PyPI under the name ebook-convert, to make it installable with uvx, and to ship single-file binaries.

Installation

Run it without installing anything permanently, with uv:

$ uvx ebook-convert book.epub book.mobi

Or install it as a tool:

$ uv tool install ebook-convert      # with uv
$ pipx install ebook-convert         # with pipx
$ pip install ebook-convert          # into the current environment

Single-file executables for Linux (x86_64, aarch64) and macOS (arm64, x86_64) that need no Python at all are attached to each GitHub release.

Optional system tools:

  • pdftohtml, pdfinfo and pdftoppm from poppler are needed in $PATH for conversion from PDF.

  • Liberation fonts are used when embedding fonts into LRF output.

Markdown-formatted text input additionally needs the markdown package: pip install 'ebook-convert[markdown]'.

Usage

$ ebook-convert INPUT OUTPUT [-v|-q]

The formats are taken from the file extensions. -v makes the output more verbose (repeat for more), -q quieter.

What’s supported

Input formats

  • EPUB, both v2 and v3 (epub)

  • Mobipocket and Kindle (mobi, prc, azw, azw3)

  • Microsoft Word 2007 and up (docx)

  • LibreOffice / OpenDocument text (odt)

  • Rich Text Format (rtf)

  • FictionBook (fb2)

  • HTML (html, htm, xhtml, opf) and zipped HTML (htmlz)

  • Plain text (txt, txtz), Markdown (md) and Textile

  • PDF (pdf), via poppler

  • Broadband eBooks (BBeB) (lrf)

  • PalmOS databases (pdb, updb): Plucker, eReader, zTXT, PalmDOC, Haodoo

The old binary Microsoft doc format is not supported; convert it to docx or odt with Word or LibreOffice first.

Output formats

  • EPUB v2 (epub)

  • Mobipocket (mobi)

  • Microsoft Word (docx)

  • FictionBook (fb2)

  • Zipped HTML with assets (htmlz)

  • Plain text (txt) and zipped text (txtz)

  • Broadband eBooks (BBeB) (lrf)

  • Unpacked OEB directory (oeb)

Calibre’s remaining formats (LIT, AZW3/KF8 output, PDB output, PDF output, RB, SNB, TCR, PML, CHM, DJVU, comics, recipes) were never ported and are not registered.

Known limitations

  • SVG images are not rasterized (Calibre does that with Qt). Formats that cannot display SVG, like mobi, will show such images as missing. A warning is logged when this happens.

  • The Kindle periodical format (discontinued by Amazon in 2023) is treated as an ordinary book.

  • Windows is not tested.

  • Conversion options are not exposed on the command line yet; Calibre’s defaults are used.

Development

$ git clone https://github.com/NunoSempere/ebook-convert
$ cd ebook-convert
$ ./make.sh install        # uv sync: creates .venv with dev dependencies
$ ./make.sh test           # pytest
$ ./make.sh build          # sdist + wheel into dist/
$ ./make.sh binary         # single-file executable via PyInstaller

Releasing: bump version in pyproject.toml and numeric_version in ebook_convert/constants_old.py, commit, then tag vX.Y.Z and push the tag. The release.yml workflow runs the tests, publishes to PyPI through trusted publishing, builds the binaries and attaches everything to a GitHub release. To publish by hand instead, run UV_PUBLISH_TOKEN=pypi-... ./make.sh publish after ./make.sh build.

Background

In gryf’s words, the original project started as “an impudent ripoff of the conversion bits from Calibre”, with the aim of having only the converter, runnable from the command line, without the rest of Calibre, and with a cleaner, more pythonic code base. Qt and GUI code were removed and most vendored third-party modules replaced by their PyPI versions. This fork adds PyPI packaging, binaries, a test-suite, and swaps the HTML5 parser for the pure-Python html5lib instead of a C extension that had to be compiled against a matching libxml2.

Note that Calibre itself installs a command with the same name, ebook-convert. If you have Calibre installed, whichever comes first on your $PATH wins; uvx ebook-convert always runs this one.

There is no Python 2 support and there will not be.

License

This work is licensed under GPL3, like the original. See LICENSE for details.

Metadata

Release files for ebook-convert 4.13.0

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

Source distribution (sdist)

Source distribution for ebook-convert 4.13.0
File Size Uploaded Provenance Actions
ebook_convert-4.13.0.tar.gz 1.5 MB Without provenance Details for ebook_convert-4.13.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ebook-convert 4.13.0
File Interpreter ABI Platform Actions
ebook_convert-4.13.0-py3-none-any.whl Python 3 none any Details for ebook_convert-4.13.0-py3-none-any.whl

Total release size: 3.2 MB

Release files / ebook_convert-4.13.0.tar.gz

Download URL ebook_convert-4.13.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
802573bd92bb8db42093a262557a03b05a978bb182092e87d8e42150621b28b8
BLAKE2b-256 checksum
How to use checksums
fff1cc026bf88db0d9dde51858d0981b90c5afd19752a8abbe73995d591db809
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release files / ebook_convert-4.13.0-py3-none-any.whl

Download URL ebook_convert-4.13.0-py3-none-any.whl
Size 1.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
94f009633719e1ca30752339e94d834c6d38f9b504a01cc2aa6c8b5276734183
BLAKE2b-256 checksum
How to use checksums
bab9fb3469a5a4c25d3d0cd0e8df11e1b96e56bb8d97a23a3912943656e69d9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Security for ebook-convert 4.13.0

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.

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