semvec/pypi-packages huggingface dataset:
evidentsource-client 1.0.0rc1
Python client for EvidentSource event sourcing database
Requires Python: >=3.12
Keywords: cqrs, event-driven, eventsourcing, grpc

# EvidentSource Client for Python

Python client for the EvidentSource event sourcing database.

## Installation

```bash
pip install evidentsource-client
```

## Usage

```python
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
evidentsource-core 1.0.0rc1
Core domain types for EvidentSource event sourcing platform
Requires Python: >=3.12

# EvidentSource Core for Python

Core domain types for the EvidentSource event sourcing platform.

## Installation

```bash
pip install evidentsource-core
```

## Types

### Events

- **Event**: A stored event with full metadata (id, stream, type, subject, time, data, etc.)
- **ProspectiveEvent**: An event before storage (for state changes)
- **EventData**: Binary or string event data
- **BinaryEventData**: Binary event payload
- **StringEventData**: String event payload

### Selectors

- **Selector**: Complex event selectors (subject, type, stream combinations)
- **EventSelector**: Parameters for event queries

### Constraints

- **Constraint**: Individual constraint on event sequences
- **AppendCondition**: Constraint to apply when committing events

### Identifiers

- **DatabaseName**: Database name identifier
- **StreamName**: Stream name identifier
- **EventId**: Event ID identifier
- **EventType**: Event type identifier
- **EventSubject**: Event subject identifier
- **StateViewName**: State view name identifier
- **StateChangeName**: State change name identifier

### State Views

- **StateView**: Rendered state view result
- **StateViewCodec**: Protocol for state view serialization

### State Changes

- **Command**: Command received by a state change
- **CommandRequest**: Full command request with headers
- **StateChangeDefinitionSummary**: State change definition info

## License

MIT OR Apache-2.0