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 loadingplasmiteCLI binary (invoked via Python console script entrypoint)
Current packaged-wheel targets:
- macOS:
x86_64,arm64 - Windows:
x86_64 - Linux:
x86_64, glibc 2.35 or newer (1.3.0 and later)
The Linux wheel bundles the CLI and library. Both plasmite and pls use the
bundled binary. Version 1.2.1 on Linux uses the source package and needs a
system SDK (Homebrew or a GitHub SDK archive). Wheels since 1.3.0 use the
stable C ABI through ctypes and support Python 3.10 and newer.
Using uv (recommended)
uv tool install plasmite
For project dependencies in a uv-managed workspace:
uv add plasmite
Runtime load order is:
PLASMITE_LIB_DIRoverride (development escape hatch)- Bundled
plasmite/_native/libplasmite.(dylib|so)absolute path - System linker fallback (
plasmite/libplasmite)
For development/testing from this repo, see Install & Test below.
Build Requirements
- Python 3.10+
libplasmitebuilt 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.
UDP sender and follower
The UDP client names its server endpoint explicitly. send_json and
send_lite3 return no storage receipt: success means the operating system
accepted the datagram. A follower yields original Lite3 frames, sequence gaps,
and progress records. The server must opt in with serve --udp-follow.
from plasmite import UdpClient, UdpFollowOptions, UdpFrame, UdpStart
with UdpClient("udp://127.0.0.1:9701") as client:
with client.open_pool("sensors") as pool:
with pool.follow(UdpFollowOptions(start=UdpStart.new(), live=True)) as follow:
pool.send_json({"temperature": 23}, tags=["sensor"])
for event in follow:
if isinstance(event, UdpFrame):
message = event.message()
print(message.seq, message.data)
Use UdpStart.last(count), UdpStart.since_ns(timestamp_ns), or
UdpStart.sequence(seq) to select retained history. Pass a finite
timeout_ms to next_event when a caller needs a bounded wait; close() and
cancel() interrupt an active wait within 50 milliseconds.
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
PlasmiteErrorvalues exposekind,path,seq, andoffsetwhen present.
Troubleshooting
- Missing pool directory: pool creation creates parent directories automatically. If you call
open_pool(...)on a missing pool, catchNotFoundErroror useclient.pool(...)to create-or-open. - Permission denied: choose a writable pool directory (
Client("/path/to/pools")) and verify directory permissions/ownership. Errors includeerr.pathwhen available.
Threads and handle ownership
The Python wrapper serializes native operations and close() on each Client,
Pool, Stream, and Lite3Stream instance. You can share an instance between
threads without racing its native handle or freeing it during a call. Independent
handles can operate concurrently. Message values are owned snapshots and can
outlive the pool.
Each opened stream owns an independent handle. tail() and replay() release
handle locks between reads, including while yielding messages or sleeping for
replay timing. Consume each generator from one thread at a time.
close() waits for an active native call to finish; it does not interrupt a
blocking stream read. Pass a finite timeout_ms when opening a stream if another
thread needs to close it within a bounded wait. A stream without a timeout can
keep close() waiting indefinitely.
Metadata
Release files for plasmite 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| plasmite-1.3.0.tar.gz | 30.1 kB | Without provenance | Details for plasmite-1.3.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| plasmite-1.3.0-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for plasmite-1.3.0-py3-none-win_amd64.whl |
| plasmite-1.3.0-py3-none-manylinux_2_35_x86_64.whl | Python 3 | none | Linux glibc 2.35+ x86-64 | Details for plasmite-1.3.0-py3-none-manylinux_2_35_x86_64.whl |
| plasmite-1.3.0-py3-none-macosx_11_0_arm64.whl | Python 3 | none | macOS 11.0+ ARM64 | Details for plasmite-1.3.0-py3-none-macosx_11_0_arm64.whl |
| plasmite-1.3.0-py3-none-macosx_10_12_x86_64.whl | Python 3 | none | macOS 10.12+ x86-64 | Details for plasmite-1.3.0-py3-none-macosx_10_12_x86_64.whl |
Total release size: 24.8 MB
Release files / plasmite-1.3.0.tar.gz
| Download URL | plasmite-1.3.0.tar.gz |
|---|---|
| Size | 30.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f7910138da17aad5b5d184d5d8f28f8f40636bc03cd8ece54250239eaffd0e82
|
|
BLAKE2b-256 checksum How to use checksums |
70fa57a1ec4375a46e7495f3f4cd593d800dbe476d513b930ef2ab76320aeedf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / plasmite-1.3.0-py3-none-win_amd64.whl
| Download URL | plasmite-1.3.0-py3-none-win_amd64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
14a325ae7eaecb82372e98c825769053aaafc76233f94917a30c9cbcb07a2bd5
|
|
BLAKE2b-256 checksum How to use checksums |
dc41647cad1d1c9301533ac34ca79146d6c833453b1e1805988a4126db2e55a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / plasmite-1.3.0-py3-none-manylinux_2_35_x86_64.whl
| Download URL | plasmite-1.3.0-py3-none-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 6.6 MB |
| Tags | Linux glibc 2.35+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
20032735b46f1a78fa0e1d000e01ee1c79a68e5dc8b608dd58dba65d05b99634
|
|
BLAKE2b-256 checksum How to use checksums |
5408c3362c29b201b459bbb2f054a0a6b36216b241a0953cfcb56abe4752f081
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / plasmite-1.3.0-py3-none-macosx_11_0_arm64.whl
| Download URL | plasmite-1.3.0-py3-none-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.0 MB |
| Tags | Python 3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9f92082841a3145cfa522b669824094d8774dea2a95e9d1e2ba998c3721da685
|
|
BLAKE2b-256 checksum How to use checksums |
31d3bab192071c1e9c2b2a167032b77a89d0d03b1e7db16597a6bfd226315327
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / plasmite-1.3.0-py3-none-macosx_10_12_x86_64.whl
| Download URL | plasmite-1.3.0-py3-none-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.2 MB |
| Tags | Python 3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
1dfcfc9be5cae71071ba2ce5cb6e7bb696c94afc3c25c8ed81207849dd92e1f6
|
|
BLAKE2b-256 checksum How to use checksums |
6fe68dbcb3958e69f01df64cb33a366302202ef5c6842c0e93b71405aa2669c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for plasmite 1.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.