Skip to main content

Send To Kindle

PyPI Status Python Version License

Read the documentation at https://stkclient.readthedocs.io/ Tests Codecov

stkclient implements a client for amazon’s “Send to Kindle” service. It allows python programs to send files to a kindle device without the 10mb limit that applies to email files.

Features

  • OAuth-based authorization

  • Send large (>10MB) files to Kindle devices

Installation

Python 3.11 or later is required. You can install Send To Kindle via pip from PyPI:

$ pip install stkclient

Creating a Client

To create a client, you must authenticate the user. Currently the only supported authentication mechanism is OAuth2:

import stkclient

a = stkclient.OAuth2()
signin_url = a.get_signin_url()
# Open `signin_url` in a browser, sign in and authorize the application, pass
# the final redirect_url below
client = a.create_client(redirect_url)

Once a client is created, it can be serialized and deserialized using Client.load / Client.loads and client.dump / client.dumps

with open('client.json', 'w') as f:
    client.dump(f)
with open('client.json', 'r') as f:
    client = stkclient.Client.load(f)

Sending a File

Once you have a Client object, you can list devices and send files to specified devices.

devices = client.get_owned_devices()
destinations = [d.device_serial_number for d in devices]
client.send_file(filepath, destinations, author=author, title=title, format="epub")

The format argument describes the input file. PDFs are delivered with their original page layout by default. To convert a PDF to Kindle format, set force_convert=True:

client.send_file(
    filepath, destinations, author=author, title=title,
    format="pdf", force_convert=True,
)

Development

Install uv 0.13.0 or later, then create the development environment and run the tools directly. The checked-in .python-version selects Python 3.12; uv downloads it automatically if needed.

$ uv sync --locked
$ uv run --locked pytest
$ uv run --locked mypy --pretty src tests docs/conf.py
$ uv run --locked pytest --typeguard-packages=stkclient
$ uv run --locked python -m xdoctest --modname=stkclient --command=all
$ uv run --locked pre-commit run --all-files --show-diff-on-failure

GitHub Actions owns the Python and operating-system test matrix in .github/workflows/tests.yml. To test a specific Python version locally, select it explicitly and install only the test dependency group:

$ uv run --locked --no-default-groups --group test --no-editable --python 3.11 pytest

To collect and report coverage locally:

$ uv run --locked coverage run -m pytest
$ uv run --locked coverage report

Build the same documentation formats as CI with warnings treated as errors:

for builder in html epub latex; do
  uv run --locked sphinx-build -W --keep-going -b "$builder" \
    -d "docs/_build/doctrees/$builder" docs "docs/_build/$builder"
done

Use uv run --locked sphinx-autobuild --open-browser docs docs/_build/html to preview the documentation with live reloading.

Audit all locked runtime, test, and development dependencies against the PyPI vulnerability database:

requirements=$(mktemp)
uv export --locked --all-groups --no-emit-project --output-file "$requirements" > /dev/null
uv run --locked pip-audit --strict --disable-pip --no-deps -r "$requirements"
rm "$requirements"

Dependencies live in pyproject.toml and their resolved versions in uv.lock. Commit both files when dependencies change. Use uv add for runtime dependencies, uv add --group test for test dependencies, and uv lock --upgrade-package NAME for targeted updates. Purpose-specific groups keep CI environments small; the default dev group includes all development tools. For example, uv sync --locked --no-default-groups --group test --python 3.11 installs only the package and test tools on Python 3.11.

Build distributions with uv build --no-sources. Update the package version with uv version --bump patch (or minor / major), committing the updated pyproject.toml and uv.lock together.

Pre-commit runs Ruff for Python linting, import sorting, syntax upgrades, and formatting. Its configuration lives in pyproject.toml and checks for unused or invalid noqa comments. Install the Git hooks with uv run --locked pre-commit install. Local hooks invoke uv directly, so the environment does not need to be activated when committing.

CI tests Python 3.11 through 3.15 and runs the newest version on Linux, macOS, and Windows. The minimum Python version follows the Python support schedule. Maintenance tools run on Python 3.12. Pull requests also build the release distributions; publishing remains limited to pushes to the main branch.

License

Distributed under the terms of the MIT license, Send To Kindle is free and open source software.

Metadata

Release files for stkclient 0.3.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 stkclient 0.3.0
File Size Uploaded
stkclient-0.3.0.tar.gz 13.6 kB Details

Built distribution (wheel)

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

Total release size: 29.0 kB

Release files / stkclient-0.3.0.tar.gz

Download URL stkclient-0.3.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9a692a1edbf1880b51f0023a9233c6debde09ae52cac2a14a73cdebe019a0704
BLAKE2b-256 checksum
How to use checksums
ce457ab5905a46912e15d900f712d6573682e3813ec9cf273ee361670d2e773c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release files / stkclient-0.3.0-py3-none-any.whl

Download URL stkclient-0.3.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40e80eed85b0b2c81101824340957734033019f02063a62051cdc70d51b336de
BLAKE2b-256 checksum
How to use checksums
f706d49b8e0ec3fccf9aa0ca77d7002590ad7ada41a7e3a25babf339a932954e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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