skillfed

eventsourcing

Event sourcing in Python

eventsourcing v9.5.4 91.5K downloads/30d#13,515 on PyPI1,681
Permissive license Active released

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 eventsourcing

uv

uv add eventsourcing

poetry

poetry add eventsourcing

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules

Tags

event sourcing libraryevent store pythondomain-driven design dddcqrs event sourcingevent replay state managementaggregate event sourcingdomain events python
event-sourcingdomain-driven-designcqrs

More Python Modules packages