Metadata-Version: 2.5
Name: keep-to-memos
Version: 1.0.0
Summary: Import a Google Keep Takeout export into a Memos instance through its HTTP API.
Project-URL: Homepage, https://github.com/MohammadKanaan/keep-to-memos
Project-URL: Repository, https://github.com/MohammadKanaan/keep-to-memos
Project-URL: Issues, https://github.com/MohammadKanaan/keep-to-memos/issues
Project-URL: Changelog, https://github.com/MohammadKanaan/keep-to-memos/releases
Author-email: Mohammad Kanaan <mohammadkanaan.me@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: google-keep,memos,migration,notes,takeout
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# keep-to-memos

[![CI](https://github.com/MohammadKanaan/keep-to-memos/actions/workflows/ci.yml/badge.svg)](https://github.com/MohammadKanaan/keep-to-memos/actions/workflows/ci.yml)

Moves a [Google Keep](https://keep.google.com) Takeout export into a
[Memos](https://usememos.com) instance over HTTP. Stdlib only, Python 3.10+.

## Usage

1. Download a Takeout export from https://takeout.google.com.
2. Create a personal access token in Memos under Settings -> Access Tokens.

Then run the importer:

```bash
uvx --from keep-to-memos keep-to-memos \
  --url https://your-memos-instance \
  --token memos_pat_... \
  /path/to/takeout-*.zip
```

The source argument takes the zip or an unpacked `Takeout/Keep` folder. Set
`MEMOS_URL` and `MEMOS_TOKEN` instead of the flags to keep the token out of your
shell history. `--url` defaults to `http://localhost:5230`.

Run from a terminal and the importer prompts for whatever is missing, with the
token hidden. Non-interactive runs fail fast. To install permanently, use
`uv tool install keep-to-memos` or `pipx install keep-to-memos`.

Flags:

- `--dry-run` prints what would be imported. Needs no token or server.
- `--include-trashed` also imports trashed notes. Off by default.
- `--no-throttle` skips the 0.5s pause between writes. Only safe on Postgres or
  MySQL; SQLite returns `SQLITE_BUSY` under back-to-back writes.

## What it imports

- Images as embedded attachments
- Original created and edited timestamps
- Labels as `#tags`, title as a heading, pinned state, color as a `#color/*` tag
- Archived notes stay archived
- Checklists as markdown task lists

Re-running is safe. Each note maps to a deterministic memo ID, so the second run
skips what exists; empty memos from a failed run are deleted and retried.

## Notes

- Zip input is extracted to a temp dir and deleted afterward.
- Writes are spaced 0.5s apart with 5xx retries; memos' SQLite path returns
  `SQLITE_BUSY` under back-to-back writes.
- Attachments are created unbound, then attached via `SetMemoAttachments`;
  binding at creation fails on some builds.
- The gateway is protobuf-backed: bodies use camelCase (`createTime`),
  `update_mask` snake_case (`update_time`).

## Development

See [CONTRIBUTING.md](CONTRIBUTING.md). After editing `testdata/Takeout`, rebuild
the fixture with `python3 testdata/make_zip.py`.

## License

MIT, see [LICENSE](LICENSE).
