Skip to main content

kindlegarten

简体中文 · Changelog

Scope of use

Use this project only to back up Kindle books you have legally purchased from Amazon and comics you have legally purchased from Comipo.

Download books from your Amazon Kindle library and save them locally as EPUB or CBZ. kindlegarten downloads the Kindle for iPad edition and preserves the color illustrations Amazon supplies for that edition.

  • Automatically exports text-based books as EPUB and fixed-layout comics and magazines as CBZ when their pages can be extracted as images.
  • Names output files after the book title, replaces characters disallowed in filenames, and shortens long titles. One progress bar tracks the entire download.
  • Supports Amazon Japan and Amazon US and saves your sign-in locally for future downloads.

Comipo comics are saved as CBZ. A series download exports the purchased volumes in volume order to a folder named after the series.

Installation

You need Python 3.11 or later. Kindle downloads also require Calibre and a browser for Amazon sign-in. The CLI is designed for macOS, Windows, and Linux and has been tested on macOS.

python3 -m pip install kindlegarten
kindlegarten setup

On Windows, use py -3 -m pip install kindlegarten. If your Python installation is managed by your system package manager, install kindlegarten in a virtual environment or run pipx install kindlegarten. Run kindlegarten setup once to install the components used for export.

Login methods

Running kindlegarten login with no options signs in to Amazon Japan. The default login method depends on the service.

Service Default when --method is omitted Explicit methods
Amazon Kindle Opens your system browser and prompts you to paste the final redirect URL. browser captures the redirect automatically. callback prints the login URL and accepts the redirect in the terminal.
Comipo (--source comipo) Opens a Playwright browser. Sign in, return to Comipo Play, then press Enter in the terminal. browser uses the default flow. credentials uses headless Chromium. cookie imports an existing Comipo Play session and needs no browser.

Run kindlegarten login --help for the full list.

Amazon Kindle

kindlegarten login --region jp
kindlegarten d B0EXAMPLE0

After you paste the redirect URL, the CLI registers a Kindle for iPad client. If it cannot open your system browser, it prints the sign-in URL. Over SSH, use --method callback to print the sign-in URL directly. Open it on another device, then paste the final redirect URL into the remote terminal. The terminal hides the pasted URL.

To let Playwright detect the redirect automatically, install the browser extra and select --method browser. Complete Amazon's sign-in and any verification in the window the CLI opens.

python3 -m pip install 'kindlegarten[browser]'
kindlegarten login --region jp --method browser
kindlegarten login --region jp --method callback

The browser method uses Chrome or Playwright's Chromium. If neither is installed, run python -m playwright install chromium in the CLI's Python environment.

d is shorthand for download and accepts the same options. Replace B0EXAMPLE0 with the book's ten-character ASIN. You can also pass an Amazon product URL, which selects the region from its domain. A bare ASIN defaults to Amazon Japan. For an Amazon US account, pass --region us to both login and ASIN-based downloads.

kindlegarten download "https://www.amazon.co.jp/dp/B0EXAMPLE0"
kindlegarten download B0EXAMPLE0 --output "My Book.epub"
kindlegarten download --help

By default, books are saved as books/<title>.epub or books/<title>.cbz under the current directory. If the title is missing, the filename uses the ASIN. Use --output to specify a filename and format. Relative paths start from the current directory. CBZ export requires pages that can be safely extracted as images. The CLI reports a conflict if the output file already exists.

Comipo

Install the Comipo extra and sign in with your viviON ID. The CLI saves a local session for later downloads.

python3 -m pip install 'kindlegarten[comipo]'
kindlegarten login --source comipo
kindlegarten work BJ123456
kindlegarten series TITLE12345678
kindlegarten logout --source comipo

On servers without a GUI, run kindlegarten login --source comipo --method credentials from an interactive terminal. This method uses viviON's official form in a headless browser. It prompts in the terminal for your login ID, password, and six-digit authenticator code when requested. Password and code input are hidden.

If you are already signed in on another machine, import that Comipo Play session from the terminal. In your browser's developer tools, open Network, reload Comipo Play, and copy the Cookie value under Request Headers for the /api/comipo/authorize request to play.comipo.app. Paste it when prompted. You can also import the comipo-session.json saved by kindlegarten. The CLI checks the session with Comipo Play before saving it. Both options work without launching a browser.

kindlegarten login --source comipo --method cookie
kindlegarten login --source comipo --method cookie --session-file ~/comipo-session.json

If viviON requests interactive verification such as a Cloudflare challenge, complete it in the browser before copying the Cookie or exporting the session. Keep Cookies and session files private. The final address-bar URL does not carry the Comipo Play session.

Use your own work ID or series ID. w is shorthand for work, and s is shorthand for series. The download and d commands still accept work:ID, series:ID, bare Comipo IDs such as BJ123456 or TITLE12345678, Comipo Play reader and series links, and Comipo store product links.

A work is saved to books/<work title>.cbz. A series is saved under books/<series name>/ with one CBZ per purchased volume. Re-running a series skips files previously saved for the same work ID. For a work, --output sets the CBZ filename. For a series, it sets the parent of the series folder. The browser and credentials methods use Chrome or Playwright's Chromium. If neither is available, run python -m playwright install chromium in the CLI's Python environment. Comipo downloads do not require Calibre or kindlegarten setup.

Releasing a version

Update __version__ in kindlegarten/__init__.py and add a matching ## X.Y.Z section to CHANGELOG.md. A push to main publishes the version to PyPI and creates a GitHub Release with that changelog section. A version already available on both services is skipped. If publishing fails after the version tag is created, rerun the workflow for the tagged commit.

Local data

The pip-installed CLI stores sign-in state and export dependencies in a per-user directory.

  • macOS uses ~/Library/Application Support/kindlegarten/.
  • Windows uses %LOCALAPPDATA%\kindlegarten\.
  • Linux uses $XDG_DATA_HOME/kindlegarten/, which defaults to ~/.local/share/kindlegarten/.

Set KINDLEGARTEN_DATA_DIR to use a different directory. To reuse sign-in state and dependencies from a source checkout, set it to the absolute path to that checkout's .kindle-data/ directory. Running python3 kindle.py directly from a checkout uses its own .kindle-data/ and books/ directories.

Troubleshooting

  • Calibre cannot be found. Set KINDLE_CALIBRE_BIN to the directory containing calibre-debug and calibre-customize. On Windows, these files have the .exe extension.
  • Amazon sign-in has expired or you want to switch accounts. Run kindlegarten logout --region jp to clear the local sign-in state for Japan, then sign in again. You can deregister the device from Amazon's Manage Your Content and Devices page.
  • Comipo rejects a session. Sign in again with kindlegarten login --source comipo or import a fresh session. Use kindlegarten logout --source comipo to clear the saved session.
  • A book fails to download or convert. Check that you can open it in your Kindle library for the selected region. Format and encryption compatibility depend on the files Amazon delivers for the book.
  • Setting up Kindle downloads on another computer. Install Calibre and kindlegarten, then run kindlegarten setup to install the export dependencies.

kindlegarten uses kindl for downloading, DeDRM Tools for decryption, and KFX Input for conversion. The project is licensed under the MIT License.

Metadata

Release files for kindlegarten 0.2.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 kindlegarten 0.2.0
File Size Uploaded Provenance Actions
kindlegarten-0.2.0.tar.gz 30.3 kB With provenance Details for kindlegarten-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kindlegarten 0.2.0
File Interpreter ABI Platform Actions
kindlegarten-0.2.0-py3-none-any.whl Python 3 none any Details for kindlegarten-0.2.0-py3-none-any.whl

Total release size: 57.1 kB

Release files / kindlegarten-0.2.0.tar.gz

Download URL kindlegarten-0.2.0.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e1f41b3360355568e78282808e3f2bdd5a4c95830465b579484dca3169064ff5
BLAKE2b-256 checksum
How to use checksums
f58abdd7c4b9c272856d26d2bb0ef73bf452df58247f09efcb2b90d66f237e3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / kindlegarten-0.2.0-py3-none-any.whl

Download URL kindlegarten-0.2.0-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b33a50985067600cd568a8ff1e00d582e790e51fbe0f8ffedc03f60b6d6e28ec
BLAKE2b-256 checksum
How to use checksums
04632f69e871dd1d83f4016569bcbc64f57d571b9d9a3c93b7dfc492fe13ce31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for kindlegarten 0.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kindlegarten-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

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