Skip to main content

Asyncio-first Python client for the Fluxum realtime database

Project description

Fluxum Python SDK

The asyncio-first Python client for the Fluxum realtime database (SPEC-011, T7.4). Zero runtime dependencies — the SDK carries its own minimal MessagePack codec and FluxBIN row reader.

pip install fluxum-sdk
import asyncio
from fluxum import Connection, TableSchema

async def main():
    db = await Connection.connect(
        "fluxum://127.0.0.1:15801",
        token=b"my-token",
        tables=[...],  # from `fluxum generate --lang python`
    )
    await db.subscribe(["SELECT * FROM ChatMessage"])
    await db.call_reducer("send_chat", [1, "hello"])
    # TxUpdates land in db.cache; poll or read db.cache.rows("ChatMessage").
    await db.close()

asyncio.run(main())

What you get

  • Connection — one asyncio session over FluxRPC/TCP: authenticate, subscribe (each query's InitialData populates a local row cache), call reducers, and receive TxUpdate diffs on the same socket.
  • Transparent reconnect (SDK-047): on connection loss the client reconnects, re-authenticates, resubscribes every active query and reconciles its cache — the application keeps its handle across the outage.
  • A per-table row cache keyed by primary key, with per-query ownership so an unsubscribe drops only the rows that query held (SDK-044).
  • Full type hints (py.typed, SDK-062).

Typed bindings

Generate typed row classes and reducer wrappers from a running server's schema (or a saved schema.json):

fluxum generate --lang python --schema http://127.0.0.1:15800 --out ./gen

This emits tables.py (a @dataclass row + decoder + cache hooks per table), reducers.py (a typed async def per client-callable reducer), __init__.py, and py.typed. Offline generation from a saved schema produces byte-identical output (SPEC-011 acceptance 11).

Testing

The SDK is validated by the shared conformance corpus (tests/conformance/) — the same declarative scenarios every Fluxum SDK runs against the same server build (TST-052). The runner boots a fresh fluxum-server per scenario, so build it first:

cargo build -p fluxum-server
cd sdks/python && python -m pytest -q

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fluxum_sdk-0.2.0.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fluxum_sdk-0.2.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file fluxum_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: fluxum_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fluxum_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ab72ccbaa55132c235b79fe35f4fc8f65d5a184072ba9e783085bae93d69e335
MD5 26afb3d51cc6041fb309ee9eb67170df
BLAKE2b-256 d96bbe3bf6e0f9506eeddeed21fcbb275a60899a1cc5a9b1f02b4baa2294c7d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxum_sdk-0.2.0.tar.gz:

Publisher: sdk-publish.yml on hivellm/fluxum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fluxum_sdk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fluxum_sdk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for fluxum_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe06dd8e5e3ba2bf92d7636ed23819df133498c3b687c8431a8979db022b465f
MD5 302ba76ef8efb3752e6be8e47f1464c1
BLAKE2b-256 b9ca696416a0947b857b77f0ef5960945ea0d8e396549b424a631933268f78ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for fluxum_sdk-0.2.0-py3-none-any.whl:

Publisher: sdk-publish.yml on hivellm/fluxum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page