Metadata-Version: 2.4
Name: papir-kindle
Version: 1.0
Summary: Beam reading material to your e-reader via API, with correct Author + Title.
Author-email: "Benjamin M. Duivesteyn" <duivesteyn@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/duivesteyn/Papir
Keywords: kindle,e-reader,send-to-kindle,epub,pdf
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Topic :: Utilities
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Dynamic: license-file

<img src="_screenshots/Papir-256.png" width="128" alt="Papir icon — folded ivory paper P on forest green">

# Papir

A lightweight utility to beam reading material directly to your e-reader via API.

> **Python CLI + native Mac companion.** `papir` remains the Python CLI.
> A self-contained, on-demand SwiftUI `Papir.app` lives in `macos/`, with bundled
> Python and browser sign-in; see [Mac setup](macos/README.md).

<img src="_screenshots/Papir-app-window.png" width="480" alt="Papir Mac app: forest-green window with serif papir header inline with the traffic lights, destination pill and document drop zone">

`papir` is Norwegian for paper. p-[api]-r hides API in the middle.

Unofficial. Not affiliated with Amazon / Kindle. Speaks the private protocol used by
Amazon's Send to Kindle desktop app (following `stkclient` by Max Johnson, MIT, and
`cyrgim/stk`). Amazon can break it without notice — use on an account you own.

# Downloads and project layout

[Mac releases](https://github.com/duivesteyn/Papir/releases) ·
[Mac installation](macos/INSTALL.md) · [Local builds](macos/README.md)

The Mac download includes Python and browser sign-in. Releases are unnotarized;
see the install instructions for macOS approval. Early releases are marked as
pre-releases while fresh-account/device-delivery and older-OS testing continues.

Everything for this mini project lives in this repository:

- `papir/`: Python CLI, protocol and shared sending engine.
- `macos/`: native Mac UI, bundling, verification and packaging.
- `planning/`: current plan and retained protocol/package research.
- `art/`: original icon master, fixed exports, asset catalog and style spec.
- `.github/workflows/`: offline CI and tagged Mac release builds.

Build environments and generated releases stay local and are ignored by Git.
Downloadable binaries belong in GitHub Releases, not in source commits.

# Example Usage

An example usage file is included called main.py. It contains the basics. In essence:

```python
from papir import papirSend

sku = papirSend("report.pdf", author="deCapital", title="Imperial Investment Case", target="all")
print(sku)

# author/title optional — author falls back to your stored default, title to the filename:
sku = papirSend("report.pdf")
```

CLI:

```
pip install .
papir login                          # sign in, set default author + Kindle
papir login --url URL --verifier VERIFIER  # non-interactive (or --code CODE for a bare pasted code)
papir devices                        # SERIAL: Name (* marks the default)
papir devices --json                 # machine-readable devices + default
papir set-default                    # arrow-key/number picker (or `papir --set-default`)
papir set-default SERIAL             # non-interactive (or `all` to clear)
papir set-default --author "deCapital"
papir send report.pdf
papir send report.pdf --author "deCapital" --title "Imperial Investment Case" --to DEVICE_SERIAL
papir send report.pdf --convert      # convert PDF to Kindle format (default keeps native PDF)
papir document.pdf --title "Design Systems"   # shorthand, uses defaults
papir doctor [--live]
papir logout
```

`papir send` without `--to` uses your default Kindle (else all devices).
`--to` accepts a serial, `all`, or `library` (cloud-library-only, no device needed).
`--format` overrides the detected file type (default `auto`); `--no-archive` skips saving to your Kindle library.
`--client PATH` overrides the credential file (default `~/.config/papir/client.json`).

# Example Output Data

`papirSend` returns the sku Amazon assigns:

```
8A47909664E246F0BAAB1738D7E9A154
```

# Brand

Folded ivory paper P on forest green (`#123325` / ivory `#F3EADB`).
Full spec: [art/Papir-art-style-spec.md](art/Papir-art-style-spec.md). The Mac app uses an on-demand forest-green window and the retained app icon.
The CLI's only artwork is 📤/✅ in terminal output.

# Changelog

- v1.0 2026-10-17 Stable 1.0. Python package `papir-kindle` (`pip install papir-kindle`, CLI stays `papir`), Mac app + CLI.
- v0.2.2 2026-10-06 Forest-green native title bars across app windows.

- v0.2.0 2026-10-06 Self-contained native Mac app, browser sign-in/preferences, JSON desktop bridge, shared library-only default fix, consolidated planning/art and release builds.

- v0.1.1 2026-10-06 Native-PDF fix: dropped stkclient's invented `outputFormat=MOBI`/`deliveryMechanism` (backend converted PDFs), send `forceConvert:false` like the official app. Added `--convert` opt-in.
- v0.1.0 2026-10-06 Initial revision. login/devices/send/logout/doctor, correct Author+Title via DocumentMetadata.

# Python package

```bash
pip install papir-kindle
papir --help
```

Releases: pushing tag `v*` runs `.github/workflows/pypi.yml` — offline tests, `python -m build`, Trusted Publishing to PyPI as `papir-kindle`, then attaches `dist/*` to the GitHub Release. First publish needs a PyPI Trusted Publisher for this repo + workflow.

# Inspirations

- https://github.com/maxdjohnson/stkclient
- https://github.com/cyrgim/stk

# Credits

designed in 2026 by bmd. Protocol work: `maxdjohnson/stkclient` (MIT) + `cyrgim/stk`
(bare-digest signing quirk, per-install serials).
