Durable, dependency-free Python client for the hosted Flatland engine. Your model is a file you own; the server is a pure function that holds nothing at rest.
Project description
flatland-client
The durable, dependency-free Python client for the hosted Flatland engine.
Your model is a file you own. It lives at ~/.flatland/models/<name>.flatland.json
on your machine — versioned in your own git, diffable, re-runnable anywhere.
The hosted server is a pure function (/api/v2/*): the client ships the model IR
in, the server computes/transforms and returns, and retains nothing at rest.
This package is pip install-light: stdlib urllib only, no engine, no
fastapi/uvicorn/stripe. It is the supported durable, metered hosted path for
Python users.
Install
pip install flatland-client
Quickstart
from flatland_client import create, load, http_transport
t = http_transport(api_key="fl_live_...") # HTTPS to api.flatlandfi.com
h = create("acme_plan", t) # writes ~/.flatland/models/acme_plan.flatland.json
h.bulk_add([
{"name": "revenue", "type": "Currency", "value": 1000},
{"name": "cost", "type": "Currency", "value": 400},
{"name": "profit", "type": "Currency", "formula": "revenue - cost"},
])
print(h.compile()["values"]["profit"]["value"]) # metered compute, nothing stored server-side
# --- new session / a new machine that has the file ---
h = load("acme_plan", t) # durable across restart
Durability + safety contract
- Atomic writes. Every mutation persists the new IR with a tmp +
os.replacerename, so a crash never leaves a half-written model file. - Fail-loud (F2). A failed mutation (a
5xx, or a rejected4xx) raises and leaves the local file untouched — a failure is never silently mistaken for success. - No server fallback.
load()of a missing file raises — the server never held your model, so it cannot supply one. - Envelope versioning. The file is
{ "flatland_ir_version": 1, "ir": {...} }. A file written by an older client keeps loading; a too-new envelope is refused before it is persisted. - Path-traversal-safe model names.
Get a key at https://flatlandfi.com/install.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flatland_client-0.1.0.tar.gz.
File metadata
- Download URL: flatland_client-0.1.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c04681609808ecc78c923f216cd9fe6f0d798cacfff67b8d3780f7080ef5bcf6
|
|
| MD5 |
26fa420e271636dbf19fe3d1219d2bee
|
|
| BLAKE2b-256 |
db59dddaccf512c178867f597ec5b0a589422e6b2431db4827ddeb38f04693af
|
File details
Details for the file flatland_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flatland_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1667d69bc0217bd19f88f07a4312230d00ce1b173579eb853bedea0db33eb867
|
|
| MD5 |
2772ec16616aafac30ccebf90a48cb7e
|
|
| BLAKE2b-256 |
b63bce04c9a05730e26fb8beb379a95b6601465ace63cfeac950706d9b63c6eb
|