Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

EvidentSource Client for Python

Python client for the EvidentSource event sourcing database.

Installation

pip install evidentsource-client

Usage

import asyncio
from evidentsource_client import EvidentSource
from evidentsource_core import DatabaseName, Selector, ProspectiveEvent, StringEventData

async def main():
    # Connect to the server
    async with await EvidentSource.connect("localhost:50051") as es:
        # Create a database
        db_name = DatabaseName("my-app")
        await es.create_database(db_name)

        # Connect to the database
        conn = await es.connect_database(db_name)

        # Transact events
        events = [
            ProspectiveEvent(
                id="evt-1",
                stream="orders",
                event_type="OrderCreated",
                data=StringEventData('{"orderId": "123"}'),
            )
        ]
        db = await conn.transact(events)
        print(f"Committed at revision: {db.revision}")

        # Query events
        db = await conn.latest_database()
        async for event in db.query_events(Selector.stream("orders")):
            print(f"Event: {event.id} - {event.event_type}")

asyncio.run(main())

API

EvidentSource

The main entry point for connecting to an EvidentSource server.

  • EvidentSource.connect(address) - Connect to a server
  • create_database(name) - Create a new database
  • connect_database(name) - Connect to an existing database

Connection

Represents a connection to a specific database.

  • transact(events, constraints?) - Commit events atomically
  • latest_database() - Get the latest database state

DatabaseAtRevision

A point-in-time view of the database.

  • query_events(selector) - Query events matching a selector
  • view_state(name, version, params) - Get a state view

License

MIT OR Apache-2.0

Metadata

Release files for evidentsource-client 1.0.0rc1

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

Source distribution (sdist)

Source distribution for evidentsource-client 1.0.0rc1
File Size Uploaded
evidentsource_client-1.0.0rc1.tar.gz 34.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for evidentsource-client 1.0.0rc1
File Interpreter ABI Platform
evidentsource_client-1.0.0rc1-py3-none-any.whl Python 3 none any Details

Total release size: 77.0 kB

Release files / evidentsource_client-1.0.0rc1.tar.gz

Download URL evidentsource_client-1.0.0rc1.tar.gz
Size 34.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9a27fc18986e765a466420936cf1eed839e747b931d5e8278ff2c383d42f6e20
BLAKE2b-256 checksum
How to use checksums
518833a416cad97aea633b26ad74656e89c08a7f1c5327cc7d1f25e8cf4229b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / evidentsource_client-1.0.0rc1-py3-none-any.whl

Download URL evidentsource_client-1.0.0rc1-py3-none-any.whl
Size 42.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73bcea0384b157e458815f81a16ac6f8ee679aaa53404b5871d5632d9998f93f
BLAKE2b-256 checksum
How to use checksums
4d5bf6777db7517ba54f8914121c0e5c32d9fff2006fe075b3599e85223a059a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

1.0.0rc1 This release

2 release files

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