eventsourcing
Event sourcing in Python
What it is and what it does
Eventsourcing provides a framework for building applications where every state change is recorded as an immutable event. Rather than storing current state directly, you define domain aggregates (like a Dog class) decorated with @event methods, then use an Application class to manage persistence and retrieval. The library handles event storage, replay, snapshotting, versioning, and optional encryption—supporting multiple backends (in-memory, SQLite, and external databases) configured through environment variables.
The core workflow is: define domain models with event decorators, create an application class that orchestrates saves and queries, then run your code against any configured persistence layer. Built-in features include optimistic concurrency control, compression, application-level encryption for PII compliance, and notification-based projections for CQRS patterns. It requires Python 3.10+ and depends only on typing_extensions.
Use it for:
- Build audit-trail systems where every state change must be recorded and replayed for compliance or debugging
- Implement CQRS architectures with separate read and write models using notifications and projections
- Create domain-driven applications with strong consistency boundaries and event-based communication between aggregates
- Develop distributed systems where event logs serve as the source of truth for replication across nodes
- Encrypt sensitive domain events at the application level to meet GDPR or similar data protection requirements
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Eventsourcing is a Python library for implementing event sourcing, a design pattern where all application state changes are stored as a sequence of immutable events that can be replayed to reconstruct state.
Yes. Eventsourcing is a mature, actively maintained library (stable since 2015, production-ready) with low install friction, no security vulnerabilities, and a permissive license. It's the right choice if you need event sourcing as a core pattern; if you're unsure whether event sourcing fits your problem, evaluate that architectural decision first before installing.
Install
eventsourcing on PyPI
pip
pip install eventsourcinguv
uv add eventsourcingpoetry
poetry add eventsourcingInstalling eventsourcing
Before you install
Low friction: pure Python wheel with a single runtime dependency (typing_extensions). Actively maintained with a recent release 140 days ago and ongoing commits; repository shows 1681 stars and is not archived.
License in practice
Permissive license allows commercial and private use without restriction; suitable for most projects without legal concern.
Quickstart
pip install eventsourcing
from eventsourcing.domain import Aggregate, event
from eventsourcing.application import Application
class Dog(Aggregate):
@event('Registered')
def __init__(self, name: str) -> None:
self.name = name
class DogSchool(Application):
def register_dog(self, name: str):
dog = Dog(name)
self.save(dog)
return dog.id
school = DogSchool()
dog_id = school.register_dog('Fido')
Requires Python 3.10 or later; by default events are stored in memory using Python objects, but persistence modules can be configured via environment variables.
Verify before relying
- Performance characteristics under high-volume event streams or with large aggregates
- Scalability limits when using in-memory persistence versus external databases
- Compatibility of encryption/compression features with all supported database adapters
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing_extensions |
| Maintenance | actively maintained — 140 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 91,476/month — #13,515 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: eventsourcing-9.5.4-py3-none-any.whl
Keywords: event sourcing, event store, domain driven design, domain-driven design, ddd, cqrs, cqs
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
django-concurrencyAdds optimistic locking to Django models to…
permissive · top 15,000 on PyPI
autogen-coreAutoGen Core provides a runtime and…
permissive · top 5,000 on PyPI
taskflowTaskFlow is a library for defining and…
permissive · top 15,000 on PyPI
pyobjc-framework-CalendarStoreProvides Python bindings to macOS's…
permissive · top 15,000 on PyPI
launchdarkly-eventsourceConsumes Server-Sent Events (SSE) from remote…
permissive · top 5,000 on PyPI
adagioAdagio provides a directed acyclic graph (DAG)…
permissive · top 5,000 on PyPI
safe-initSafe Init wraps AWS Lambda handlers to provide…
permissive · top 15,000 on PyPI
eventkiteventkit provides an event-driven framework for…
permissive · top 5,000 on PyPI
aeventkitaeventkit provides event-driven data pipelines…
permissive · top 15,000 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI