Skip to main content

rstmdb-py

CI Python PyPI License

Python client library for communicating with the rstmdb server using the RCP (rstmdb Command Protocol).

Features

  • Async-first design using asyncio
  • Full feature parity with the Rust client
  • Type hints with pydantic models
  • Support for TLS and mTLS
  • Event streaming with async iterators

Installation

pip install rstmdb

For development:

pip install rstmdb[dev]

Quick Start

import asyncio
from rstmdb import Client

async def main():
    async with Client("127.0.0.1", 7401, token="my-secret-token") as client:
        # Create machine
        await client.put_machine("order", 1, {
            "states": ["created", "paid", "shipped"],
            "initial": "created",
            "transitions": [
                {"from": "created", "event": "PAY", "to": "paid"},
                {"from": "paid", "event": "SHIP", "to": "shipped"},
            ]
        })

        # Create instance
        result = await client.create_instance("order", 1, "order-001")
        print(f"Created: {result.instance_id} in state {result.state}")

        # Apply event
        result = await client.apply_event("order-001", "PAY", {"amount": 99.99})
        print(f"Transition: {result.from_state} -> {result.to_state}")

asyncio.run(main())

Watch Events

import asyncio
from rstmdb import Client

async def main():
    async with Client("127.0.0.1", 7401, token="my-secret-token") as client:
        # Start watching
        sub = await client.watch_all(machines=["order"], to_states=["shipped"])
        print(f"Subscription: {sub.subscription_id}")

        # Process events
        async for event in client.events():
            print(f"Event: {event.instance_id} {event.from_state} -> {event.to_state}")

asyncio.run(main())

TLS/mTLS

from rstmdb import Client

# TLS with CA verification
client = Client(
    "127.0.0.1", 7401,
    token="my-secret-token",
    tls=True,
    ca_cert="./certs/ca-cert.pem",
)

# mTLS
client = Client(
    "127.0.0.1", 7401,
    token="my-secret-token",
    tls=True,
    ca_cert="./certs/ca-cert.pem",
    client_cert="./certs/client-cert.pem",
    client_key="./certs/client-key.pem",
)

# Insecure (dev only)
client = Client(
    "127.0.0.1", 7401,
    token="my-secret-token",
    tls=True,
    insecure=True,
)

Development

# Install development dependencies
pip install -e ".[dev]"

# Run all checks with tox
tox

# Run specific tox environments
tox -e py312        # Run tests with Python 3.12
tox -e lint         # Run linting
tox -e typecheck    # Run type checking
tox -e install      # Verify package installation
tox -e format       # Auto-format code

# Or run tools directly
pytest tests/ -v    # Run tests
mypy src/           # Type checking
ruff check src/     # Linting
ruff format src/    # Formatting

License

MIT

Metadata

Release files for rstmdb 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rstmdb 0.2.1
File Size Uploaded Provenance Actions
rstmdb-0.2.1.tar.gz 24.9 kB With provenance Details for rstmdb-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rstmdb 0.2.1
File Interpreter ABI Platform Actions
rstmdb-0.2.1-py3-none-any.whl Python 3 none any Details for rstmdb-0.2.1-py3-none-any.whl

Total release size: 39.7 kB

Release files / rstmdb-0.2.1.tar.gz

Download URL rstmdb-0.2.1.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e96180094935b8072583fa2dc493ae7210bd5092da1157d317bf6a88220f67c3
BLAKE2b-256 checksum
How to use checksums
7a542e61d8751833c668587c35fe2ef4092eec24ef4de2765336c3b00c6941d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

Release files / rstmdb-0.2.1-py3-none-any.whl

Download URL rstmdb-0.2.1-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2e15cc1c1bc3736b7fda1fb252378b4f12069c3fe4b5f809d709e9202ee6fa1
BLAKE2b-256 checksum
How to use checksums
b697775f29725af7c9ed4a6b47b525e6f27c0f814bcb17d06a85fb59cd3aa36c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

Security for rstmdb 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for rstmdb-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 18, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page