Skip to main content
Pre-release

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

Event Sourcing with UmaDB

This package supports using the Python eventsourcing library with UmaDB.

Installation

Add the Python eventsourcing package to your project with the umadb option. Run uv init to start a new project.

uv add "eventsourcing[umadb,pydantic]~=10.0.0a10"

Pydantic is recommended for modelling and serialising events.

After installing, you can start the UmaDB server with uv run umadb.

Getting started

Use the eventsourcing.dcb package to define a DCB application. Read the docs for more information.

from typing import TypedDict
from uuid import uuid4

from eventsourcing.decorator import triggers
from eventsourcing.pydantic import DcbApplication, Decision, EnduringObject


class Dog(EnduringObject):
    class Registered(Decision):
        dog_id: str
        name: str

    class TrickAdded(Decision):
        dog_id: str
        trick: str

    @triggers(Registered)
    def __init__(self, *, name: str) -> None:
        self.name = name
        self.tricks: list[str] = []

    @triggers(TrickAdded)
    def add_trick(self, trick: str) -> None:
        self.tricks.append(trick)


class TrainingSchool(DcbApplication):
    def register(self, name: str) -> str:
        dog = Dog(name=name)
        self.repository.save(dog)
        return dog.id

    def add_trick(self, dog_id: str, trick: str) -> None:
        dog = self.repository.get(dog_id, Dog)
        dog.add_trick(trick)
        self.repository.save(dog)

    def get_dog(self, dog_id: str) -> DogSummary:
        dog = self.repository.get(dog_id, Dog)
        return {"name": dog.name, "tricks": tuple(dog.tricks)}


class DogSummary(TypedDict):
    name: str
    tricks: tuple[str, ...]

Configure the application to use UmaDB. Set environment variable PERSISTENCE_MODULE to 'eventsourcing_umadb', and set UMADB_URL to your UmaDB URL.

app = TrainingSchool(env={
    "PERSISTENCE_MODULE": "eventsourcing_umadb",
    "UMADB_URL": "http://127.0.0.1:50051",
})

The application's methods may be then called, from tests and user interfaces.

# Register dog.
dog_id = app.register("Fido")

# Add tricks.
app.add_trick(dog_id, "roll over")
app.add_trick(dog_id, "play dead")

# Get details.
dog = app.get_dog(dog_id)
assert dog["name"] == "Fido"
assert dog["tricks"] == ("roll over", "play dead")

For more information, please refer to the Python eventsourcing library and the UmaDB project.

Community

Join the Event Sourcing in Python Discord server today.

Contributors

Clone the GitHub repo and the use the following make commands.

Install Poetry.

make install-poetry

Install packages.

make install

Start UmaDB.

make start-umadb

Run tests.

make test

Stop UmaDB.

make stop-umadb

Check the formatting of the code.

make lint

Reformat the code.

make fmt

Tests belong in ./tests.

Edit package dependencies in pyproject.toml. Update installed packages (and the poetry.lock file) using the following command.

make update

Metadata

Release files for eventsourcing-umadb 0.5.0a3

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

Source distribution (sdist)

Source distribution for eventsourcing-umadb 0.5.0a3
File Size Uploaded Provenance Actions
eventsourcing_umadb-0.5.0a3.tar.gz 5.4 kB Without provenance Details for eventsourcing_umadb-0.5.0a3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eventsourcing-umadb 0.5.0a3
File Interpreter ABI Platform Actions
eventsourcing_umadb-0.5.0a3-py3-none-any.whl Python 3 none any Details for eventsourcing_umadb-0.5.0a3-py3-none-any.whl

Total release size: 11.4 kB

Release files / eventsourcing_umadb-0.5.0a3.tar.gz

Download URL eventsourcing_umadb-0.5.0a3.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5814197e61ba77276e9622ebde1d18d67202534d5089c0c8a6ca7c64b944dcb0
BLAKE2b-256 checksum
How to use checksums
079ba01236c99d6d9712003d5be47e78fe106bf6e82eb6ad666e2ee287a6ed52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.14.10 Darwin/25.6.0

Release files / eventsourcing_umadb-0.5.0a3-py3-none-any.whl

Download URL eventsourcing_umadb-0.5.0a3-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3787c511867bcc306c345ad64065b5dd39f8b5501799be9096239ff805ff8ab
BLAKE2b-256 checksum
How to use checksums
4c3d3a2b4e24da63cf7b5de404f9ee6c2dbe848a0dc8f93d27c094d0194bab2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.14.10 Darwin/25.6.0

Security for eventsourcing-umadb 0.5.0a3

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.

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