statepath
Move a Python app that keeps its state in files onto Postgres without rewriting its file code.
Buy statepath for $99One payment of $99, plus sales tax where it applies, and every future update. Delivered as a private GitHub repository you're invited to.
Runs inside Lina. Extracted from the state layer that lets Lina keep its files in Postgres.
See it work
statepath seed --state-dir ./data --apply
copied 4 files (4 documents, 0 logs, 0 blobs)
every file was read back and matches byte for byte
statepath verify --state-dir ./data
compared 4 of 4 files
OK - every compared file matches byte for byte
echo '{"plan":"team"}' > data/settings.json
statepath verify --state-dir ./data
compared 4 of 4 files
CONTENT DIFFERS: 1
settings.json
What it does
statepath replaces the path object your app already uses, so its read_text, write_text, glob and open calls go to Postgres. You move in steps you can undo, and a verifier tells you when the next step is safe. It also backs the Postgres store up, restores it safely and prunes old backups.
- A Path that lives in Postgres
- statepath.root() returns a plain Path, a dual-write path or a Postgres path depending on one environment variable. The file operations your app uses keep working.
- Dual-write that can't take a request down
- Reads come from disk and writes are mirrored to Postgres. If Postgres is slow or down, the disk write still succeeds and a circuit breaker backs off.
- No lost updates
- JsonStore.mutate() reads, changes and writes under a lock, a file lock on disk and a Postgres advisory lock in the database, across threads, processes and servers.
- Logs and binary files
- Append-only logs are stored one row per line, so appending never rewrites them. Images and PDFs come back byte for byte.
- seed, verify, repair, drain
- Copy files in and check each one, compare the two stores by content, re-copy what differs, or copy everything back to disk.
- Snapshot, check and restore
- One .tar.gz of the store with a checksum for each key, read back before it is renamed into place. An empty or incomplete snapshot exits 1. A restore is a dry run until --apply, saves what it overwrites first and never deletes.
- Retention you can preview
- retain lists the exact files it would delete before --apply, and keeps the newest N backups of each kind.
- A soft-delete sweep
- Expired records are copied to a uniquely named file first, and nothing is removed if the copy fails.
- Refuses the dangerous mistakes
- drain won't delete when the database holds nothing in scope, and the test suite refuses to empty any database not named for tests.
What you get
statepath 1.1.1: the Python library and the statepath command, with 484 automated tests.
A commercial license. Use it and change it in your own projects and your clients' projects. Don't share or resell the source. Read the license.
Every update. New versions land in the same repository; git pull to get them.
Requirements
Python 3.10 or newer. A Postgres database. psycopg 3 is installed with it.
How buying works
- Enter your GitHub username. You'll see the account before you pay, so you can check it's yours.
- Pay $99, plus any sales tax shown at checkout, on Stripe's checkout page.
- Accept the invitation GitHub emails you. Signed in as that account, you'll also find it at
github.com/dominares-tools/statepath/invitations. Invitations expire after 7 days; you can get a new one any time. - Clone and install:
git clone https://github.com/dominares-tools/statepath.gitPrivate repo: sign in to GitHub on this computer first. Run
gh auth loginand choose HTTPS, or give git a personal access token when it asks for a password. To use an SSH key instead, clonegit@github.com:dominares-tools/statepath.git.python3 -m venv .venv && . .venv/bin/activate pip install ./statepath
Questions
Do I need GitHub?
Yes. Access is a read-only invitation to a private repository, sent to the GitHub account you choose.
Can I get a refund?
Yes, within 14 days, no questions asked. Access ends when the refund goes through. Refund policy.
Who takes the payment?
Payments are handled by Stripe, which works out sales tax. Your receipt and card statement show Link (LINK.COM*), Stripe's checkout service.
Something wrong?
Email support@dominares.org. Every buyer of a tool shares its repository, so support happens by email rather than in GitHub issues.