Skip to main content

Plasmite Python Bindings (v0)

These bindings wrap the libplasmite C ABI via ctypes.

Installation

Published wheels bundle native assets under plasmite/_native/ on the platforms where wheels are currently shipped:

  • libplasmite.(dylib|so) for ctypes loading
  • plasmite CLI binary (invoked via Python console script entrypoint)

Current packaged-wheel targets:

  • macOS: x86_64, arm64
  • Windows: x86_64

Linux currently falls back to source distribution, so runtime use there should come from a system SDK install (for example Homebrew or a GitHub release tarball) unless/until Linux wheels are added.

Using uv (recommended)

uv tool install plasmite

For project dependencies in a uv-managed workspace:

uv add plasmite

Runtime load order is:

  1. PLASMITE_LIB_DIR override (development escape hatch)
  2. Bundled plasmite/_native/libplasmite.(dylib|so) absolute path
  3. System linker fallback (plasmite / libplasmite)

For development/testing from this repo, see Install & Test below.

Build Requirements

  • Python 3.10+
  • libplasmite built from this repo (cargo build -p plasmite) for local development

Install & Test

From the repo root:

cargo build -p plasmite

Canonical repo-root command:

just bindings-python-test

Equivalent manual commands (from bindings/python):

uv venv
source .venv/bin/activate
PLASMITE_LIB_DIR="$(pwd)/../../target/debug" uv pip install -e .
PLASMITE_LIB_DIR="$(pwd)/../../target/debug" PLASMITE_BIN="$(pwd)/../../target/debug/plasmite" python3 -m unittest discover -s tests

Build a wheel with bundled native assets from a specific SDK directory:

PLASMITE_SDK_DIR=/path/to/sdk python -m build

Conformance runner (manifest parity with Rust/Go/Node):

cargo build -p plasmite
cd bindings/python
PLASMITE_LIB_DIR="$(pwd)/../../target/debug" \
PLASMITE_BIN="$(pwd)/../../target/debug/plasmite" \
python3 cmd/plasmite_conformance.py ../../conformance/sample-v0.json

Usage

from plasmite import Client, Durability, NotFoundError

with Client("./data") as client:
    with client.pool("docs", 64 * 1024 * 1024) as pool:
        msg = pool.append({"kind": "note", "text": "hi"}, ["note"], Durability.FAST)
        print(msg.seq, msg.tags, msg.data["text"])

        fetched = pool.get(msg.seq)
        print(fetched.data["text"])

        for item in pool.tail(tags=["note"], max_messages=1, timeout_ms=100):
            print(item.seq, item.tags, item.data)

    try:
        client.open_pool("missing")
    except NotFoundError:
        print("pool not found")

Pool.append(...), Pool.get(...), Pool.tail(...), and Pool.replay(...) return typed Message values by default.

Use append_json(...) / get_json(...) only when you explicitly need raw wire bytes.

Pool.tail(..., tags=[...]) uses exact tag matching and composes with other filters using AND semantics.

Pools have bounded retention. A tail normally resumes at the next retained message if writes overtake it. Set error_on_gap=True when the consumer must distinguish that loss from an ordinary lack of matching messages:

from plasmite import RetentionGapError

try:
    for item in pool.tail(since_seq=last_seq + 1, error_on_gap=True):
        process(item)
except RetentionGapError as err:
    print(f"rebuild required; first missing sequence: {err.seq}")

Error behavior

  • Invalid local arguments raise ValueError / TypeError.
  • ABI/runtime failures raise typed subclasses of PlasmiteError (NotFoundError, AlreadyExistsError, BusyError, PermissionDeniedError, CorruptError, IoError, UsageError, InternalError, RetentionGapError).
  • All PlasmiteError values expose kind, path, seq, and offset when present.

Troubleshooting

  • Missing pool directory: pool creation creates parent directories automatically. If you call open_pool(...) on a missing pool, catch NotFoundError or use client.pool(...) to create-or-open.
  • Permission denied: choose a writable pool directory (Client("/path/to/pools")) and verify directory permissions/ownership. Errors include err.path when available.

Download files

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

Source Distribution

plasmite-0.8.0.tar.gz (17.0 kB view details)

Uploaded Source

Built Distributions

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

plasmite-0.8.0-cp311-cp311-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.11Windows x86-64

plasmite-0.8.0-cp311-cp311-macosx_11_0_universal2.whl (16.4 MB view details)

Uploaded CPython 3.11macOS 11.0+ universal2 (ARM64, x86-64)

plasmite-0.8.0-cp311-cp311-macosx_10_12_universal2.whl (17.0 MB view details)

Uploaded CPython 3.11macOS 10.12+ universal2 (ARM64, x86-64)

File details

Details for the file plasmite-0.8.0.tar.gz.

File metadata

  • Download URL: plasmite-0.8.0.tar.gz
  • Upload date:
  • Size: 17.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for plasmite-0.8.0.tar.gz
Algorithm Hash digest
SHA256 31c76fc6a9661c642f7d49853902065e7ff1b4bab125d17b7839fb9da3511048
MD5 719e4ac9bc085b31a8865afb27fcebd7
BLAKE2b-256 9841a714a971a5f311ab149fb12112dd02ac71d1554d64e2c57cc27c3822f801

See more details on using hashes here.

File details

Details for the file plasmite-0.8.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: plasmite-0.8.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 5.1 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for plasmite-0.8.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 499055957fd36ab7cfd5c8b04fff946c535b92f4c6971a922f4c9e81add84abf
MD5 b3f013c333d1a493f768a19e10363cd4
BLAKE2b-256 efecc6fe542a7eb84d68953bb5d1d778fe8dd5d36a833fd084073d37dcbbb7bd

See more details on using hashes here.

File details

Details for the file plasmite-0.8.0-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for plasmite-0.8.0-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 fec6465b73a5563f5a929696839e64feba9319c4c9f99a4c5e4241be9814564d
MD5 014ba51fcbfd6b61abd9d9c66eefc3b0
BLAKE2b-256 5b3658aebac5673cacfcf1e97e7adfae958be2c36204ab9f062a1b0c076ed8bb

See more details on using hashes here.

File details

Details for the file plasmite-0.8.0-cp311-cp311-macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for plasmite-0.8.0-cp311-cp311-macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 fa7b73d0b16ee08f5c6a0cf3612dcf4957c870bdde0ed57a698d873ec0ee3548
MD5 1d63888d927d37f655422d02eb117a3c
BLAKE2b-256 caccc891a5c6a58fb486be029141bd578c29a094dff151a3a4a91f6cd73f8cf3

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.8.0 This release

4 files

0.7.2

4 files

0.7.1

4 files

0.7.0

4 files

0.6.1

4 files

0.6.0

4 files

0.5.1

4 files

0.5.0

4 files

0.3.0

4 files

0.2.0

4 files

0.1.14

3 files

0.1.13

3 files

0.1.9

3 files

0.1.8

3 files

Supported by

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