Skip to content

Repository files navigation

kindlestrip

A pip install-able conversion of Paul Durrant's kindlestrip library to strip the penultimate record from a Mobipocket file. (http://www.mobileread.com/forums/showthread.php?t=96903)

Scope

kindlestrip targets legacy .mobi files produced by KindleGen 1.1+, which embed a compressed copy of the book's source files in an SRCS record — roughly doubling the file size. Stripping that record reclaims the space without affecting the book.

This is a niche, maintenance-mode utility. Amazon has since deprecated KindleGen and moved away from the MOBI format (Send to Kindle no longer accepts .mobi), so it's most useful for archiving or slimming down an existing collection of older KindleGen-built .mobi files. It does nothing for EPUB or KFX.

Usage

To install:

pip install kindlestrip

To use:

$ kindlestrip input.mobi output.mobi

$ du -sh *
268K    input.mobi
200K    output.mobi

Or run it without installing, straight from PyPI with uv:

$ uvx kindlestrip input.mobi output.mobi

kindlestrip.py is also a self-contained PEP 723 script, so you can run the local file without installing anything:

$ uv run kindlestrip.py input.mobi output.mobi

Options:

$ kindlestrip --help
$ kindlestrip -d input.mobi output.mobi   # also dump the stripped SRCS records

Development

Requires Python 3.10–3.14. Common tasks are in the justfile:

$ just test    # run pytest
$ just lint     # ruff check + format
$ just build    # build sdist + wheel

Releasing

Versions follow CalVer (YYYY.MM.PATCH) and are managed by bump-my-version. Releases publish to PyPI automatically via GitHub Actions using Trusted Publishing (OIDC — no API tokens).

To cut a release:

$ just release          # bump the patch (e.g. 2026.7.0 -> 2026.7.1), commit, tag, push
$ just release month    # start a new month (recomputes YYYY.MM from today's date)

just release bumps the version in kindlestrip.py and pyproject.toml, creates a commit and a bare CalVer git tag (e.g. 2026.7.1), and runs git push --follow-tags. Pushing that tag triggers .github/workflows/release.yml, which builds with uv build and publishes to PyPI. Only a version tag publishes — a plain git push never does.

About

📖 A pip-installable conversion of Paul Durrant's kindlestrip

Resources

Code of conduct

Stars

69 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages