pyeventsourcing/eventsourcing
60.7
Adequate · 22 September 2026
17.2k
lines of production code
Python
primary language
7
measurements over time
What this system is
This system is a Python library for building event-sourced applications, providing core infrastructure for aggregates, domain events, and persistence across SQLite and PostgreSQL. It supports advanced patterns such as Domain Consistency Boundaries for managing complex transactional scopes, along with features for snapshotting, data encryption, and compression. The framework includes tools for projections, full-text search indexing, and time-travel queries, with extensive examples demonstrating various architectural styles like vertical slices and Pydantic integration.
How it got here
2015–2024 — comprehensive test coverage and example expansion
18 changes.
This period focused on establishing robust testing infrastructure by introducing dedicated test suites for domain, persistence, system, and documentation components. Concurrently, the project expanded its educational resources with a wide variety of examples demonstrating advanced event sourcing patterns, including Pydantic integration, UUID-based aggregates, and time-travel queries.
2025 — DCB and vertical slices expansion
16 changes.
This period focused on introducing the Domain Consistency Boundary (DCB) module and expanding the example suite to demonstrate vertical slice architectures. Significant effort was dedicated to creating comprehensive test coverage for the new projection and DCB subsystems, alongside performance benchmarking and diverse aggregate implementation examples.
Features
Added 'Shop Standard' example demonstrating event-sourced application patterns
A new example located in examples/shopstandard has been added to demonstrate an event-sourced application using the library's standard approach. This example includes a Shop application class extending PydanticApplication, domain aggregates for Product and Cart, and associated exceptions. It serves as a reference implementation for building event-sourced systems with Pydantic integration, covering operations like adding products, managing inventory, and handling shopping cart workflows.
examples/shopstandard · high confidence
Added 'vertical slices' shop example
A new 'vertical slices' example has been added to the examples directory, demonstrating a domain-driven design approach where functionality is organized by vertical slices (e.g., \get\_cart\_items\, \add\_item\_to\_cart\) rather than horizontal layers. This example includes core components such as immutable domain events, command and query abstractions, and specific slice implementations for managing a shop cart, along with comprehensive tests to verify the behavior.
examples/shopvertical · high confidence
Added full-text search projection example for content management
The \examples/ftsprojection\ directory now includes a complete example demonstrating how to maintain a PostgreSQL full-text search index using event sourcing projections. This addition introduces \FtsProjection\ and \PostgresFtsView\ classes that track domain events (such as page creation and body updates) to keep the search index synchronized with the write model. A corresponding test suite (\test\_projection.py\) validates the end-to-end flow, including running the \ProjectionRunner\ to catch up the read model and verifying search results for single and multiple word queries.
examples/ftscontentmanagement, examples/ftsprojection · high confidence
Added msgspec-based aggregate example with snapshotting and serialization
The examples/aggregate9 directory now provides a complete example demonstrating how to implement event-sourced aggregates using msgspec for serialization and immutable data structures. This includes a custom MessagePackMapper for efficient JSON encoding/decoding, support for snapshotting to optimize read performance, and tests verifying functionality with compression and encryption enabled.
examples/aggregate9 · high confidence
Added new aggregate examples demonstrating snapshotting and bank account domain logic
New example code has been added to the repository root to illustrate advanced event sourcing patterns. The \examples/aggregate6\ directory provides a complete implementation of a 'Dog School' application that utilizes snapshots to optimize aggregate loading, including the necessary base classes for domain events, aggregates, and snapshots, as well as a projector and application layer. Additionally, the \examples/bankaccounts\ directory introduces a new domain example featuring a \BankAccount\ aggregate with support for opening accounts, deposits, withdrawals, fund transfers, overdraft limits, and account closure, complete with corresponding application services and tests.
examples/aggregate6 · high confidence
Added vertical slice examples for product management
The examples directory now includes a 'vertical slices' demonstration featuring two new command implementations: \AddProductToShop\, which handles adding a new product with name, description, and price while preventing duplicates, and \AdjustProductInventory\, which modifies stock levels for existing products. Each command is accompanied by unit tests verifying correct event emission and error handling for invalid states.
_examples/shopvertical/slices/add\_product\_to\_shop, examples/shopvertical/slices/adjust\_product\inventory · high confidence
Added vertical slice examples for removing items and submitting carts
The 'vertical slices' example now includes implementations and tests for the RemoveItemFromCart and SubmitCart commands. Removing an item validates that the cart is not already submitted and that the product exists in the cart, emitting a RemovedItemFromCart event. Submitting the cart checks for sufficient inventory by querying product inventory events and raises an InsufficientInventoryError if stock is lacking, otherwise emitting a SubmittedCart event.
_examples/shopvertical/slices/remove\_item\_from\_cart, examples/shopvertical/slices/submit\cart · high confidence
Added vertical slices example for shop operations
The examples/shopvertical directory now includes a 'vertical slices' implementation of a shop domain, providing concrete patterns for command and query handling. This example introduces specific slices for adding items to a cart (enforcing a three-item limit and preventing modifications after submission), clearing a cart (also blocking post-submission changes), and listing products in the shop (projecting product details and inventory adjustments from domain events).
_examples/shopvertical/slices/add\_item\_to\_cart, examples/shopvertical/slices/clear\_cart, examples/shopvertical/slices/list\_products\_in\shop · high confidence
Example 5 demonstrates manual event sourcing with explicit projection and mutation
The aggregate5 example has been updated to show a manual event-sourcing pattern where domain models explicitly define event classes, mutation logic, and projection functions. Unlike the simpler aggregate1 example that relies on framework decorators, this version requires the application layer to manually create events, save them, and use a projector function when retrieving aggregates from the repository. This change illustrates how to implement event sourcing mechanics directly in the domain model without framework assistance.
examples/aggregate5 · high confidence
Example aggregate4 demonstrates event sourcing with custom base classes and projection
The examples/aggregate4 directory introduces a new example that implements event sourcing using custom base classes (baseclasses.py) rather than the framework's built-in Aggregate. This example shows how to define a DomainEvent and Aggregate base, handle snapshots via a projector\_func, and track creation and modification timestamps. The DogSchool application and Dog domain model illustrate these concepts, including registering dogs, adding tricks, querying state with timestamps, and taking snapshots using the custom projection logic.
examples/aggregate4 · high confidence
Initial project scaffolding and configuration
The repository has been initialized with essential configuration files including a Makefile for build and test automation, .editorconfig for consistent code formatting, and .flake8 for linting. Documentation build support is added via .readthedocs.yaml, and the project license has been set to the BSD license. The README.md provides a comprehensive overview, installation instructions, and code examples for the event sourcing library.
(repo-wide) · high confidence
Initial release of the eventsourcing library
This entry introduces the eventsourcing library, providing a complete framework for event-sourced applications. It includes core domain model components (aggregates, domain events, protocols), application logic (repositories, caching, projections), and persistence infrastructure (event stores, tracking recorders, notification logs) for both SQLite and PostgreSQL. The release also adds support for data encryption (AES-GCM via pycryptodome or cryptography) and compression (zlib), along with system runners for processing events in single- and multi-threaded modes.
eventsourcing · high confidence
Introduce DCB module with consistency boundary support
Added the \eventsourcing.dcb\ module, providing a new API for managing consistency boundaries (DCB) in event-sourced applications. This includes domain models for EnduringObjects, Perspectives, and Slices, an application class for executing slices and saving decisions, and persistence implementations for both in-memory and PostgreSQL backends. The module supports event querying by type and tags, subscription via LISTEN/NOTIFY in PostgreSQL, and ensures consistency through conditional appends and position tracking.
eventsourcing/dcb · high confidence
New DCB example demonstrating vertical slices with consistency boundaries
Added a new example application in \examples/dcb\_enrolment\_with\_vertical\_slices\ that implements the DCB (Domain Consistency Boundaries) pattern using vertical slices. The \application.py\ module defines \Slice\-based commands (such as \RegisterStudent\, \UpdateStudentName\, and \RegisterCourse\) that utilize a \consistency\_boundary\ method to define their scope, replacing the previous \project\_perspective\ approach. The example includes comprehensive tests in \test\_application.py\ verifying the behavior of these slices against in-memory, PostgreSQL, and UMaDB persistence backends.
_examples/dcb\_enrolment\_with\_vertical\slices · high confidence
New DCB-based enrollment example with Postgres support
Added a new example application demonstrating Domain Consistency Boundaries (DCB) for course enrollment, including an application layer that enforces consistency rules (e.g., student capacity, course availability) via event tagging and querying, and a Postgres persistence module that creates custom types, tables, and functions to support DCB operations.
_examples/dcb\_enrolment\_with\_basic\objects · high confidence
New Pydantic-based immutable aggregate example with orjson serialization
The aggregate7 example now demonstrates an event-sourced domain model using Pydantic's frozen (immutable) dataclasses for aggregates and events, replacing the previous mutable approach. It introduces a custom PydanticApplication that leverages orjson for high-performance JSON serialization and includes support for snapshotting, compression, and encryption.
examples/aggregate7 · high confidence
New content management example with page versioning and slug indexing
The examples/contentmanagement directory now provides a complete example application demonstrating how to manage content pages with event sourcing. This includes a domain model for Pages and Slugs, an application layer that handles page creation, updates (title, body, slug), and retrieval by ID or slug, and a test suite verifying these behaviors. The example showcases features such as tracking the last modifier via context variables, handling slug conflicts, using diffs for body updates, and triggering snapshots after a set number of events.
examples/contentmanagement · high confidence
New example demonstrating DCB with enduring objects
Added a new example application (\examples/dcb\_enrolment\_with\_enduring\_objects\) that implements a course enrolment system using the Domain Consistency Boundary (DCB) pattern with enduring objects. This example introduces \Student\ and \Course\ entities that persist their state through decisions, and a \StudentAndCourse\ group to manage the interaction between them. It demonstrates how to use \trigger\_event\ for cross-entity consistency boundaries and includes tests for in-memory, PostgreSQL, and UMaDB persistence backends, as well as unit tests for the domain model and message pack mapping.
_examples/dcb\_enrolment\_with\_enduring\objects · high confidence
New example demonstrating string-based aggregate IDs
Added a new example (aggregate11) that shows how to implement and use event-sourced aggregates with string identifiers instead of UUIDs. The example includes a domain model (Dog) and application layer (DogSchool) configured to handle string IDs, along with tests verifying functionality across SQLite, PostgreSQL, and KurrentDB persistence backends.
examples/aggregate11 · high confidence
New examples demonstrating UUID-based aggregates with Pydantic and orjson serialization
Added two new example applications, aggregate6a and aggregate7a, that illustrate how to implement event-sourced aggregates using UUID identifiers. The aggregate6a example provides a baseline implementation using standard Python dataclasses for the domain model. The aggregate7a example extends this by integrating Pydantic models for the domain entities and configuring the application to use orjson for high-performance serialization via a custom transcoder and mapper. Both examples include comprehensive tests covering aggregate registration, trick addition, snapshotting, and (in aggregate7a) compression and encryption support.
examples/aggregate6a, examples/aggregate7a · high confidence
New examples demonstrating mutable aggregates with snapshots and string-based aggregate IDs
Added two new example applications: aggregate10 shows how to implement mutable aggregates with snapshotting support using msgspec, while dcb\_enrolment demonstrates a domain model using string-based aggregate IDs instead of UUIDs. The aggregate10 example includes a Dog domain model with snapshot state management and tests for snapshotting intervals and compression/encryption. The dcb\_enrolment example provides a complete student-course enrollment system with consistency boundary handling, including tests for concurrent operations and integrity errors.
examples/aggregate10 · high confidence
New local development environment with Docker and setup documentation
Developers can now spin up a complete local environment for testing and development using Docker Compose, which orchestrates Cassandra, MySQL, PostgreSQL, Redis, and Axon Server services. A new .env file centralizes configuration for these services, and a dedicated Dockerfile allows for isolated installation of project requirements. To assist with local database configuration, especially on macOS, comprehensive setup notes have been added, including instructions for PostgreSQL installation, schema creation, and PDF documentation building. Additionally, a script is provided to download and install Axon Server locally for environments where Docker is not preferred.
dev · high confidence
New searchable timestamps example for time-travel queries
Added a new example application that enables querying the state of an aggregate at a specific point in time. The implementation introduces a \SearchableTimestampsRecorder\ that persists event timestamps to dedicated database tables (SQLite or PostgreSQL), allowing the application to retrieve the correct aggregate version for any given timestamp via the new \get\_cargo\_at\_timestamp\ method.
examples/searchabletimestamps · high confidence
Test coverage
Added benchmark test suite for performance measurement; Added comprehensive test suite for domain aggregates and explicit topics; Added persistence test suite; Added system and interface tests for event processing and remote notifications; Added test suite for Dynamic Consistency Boundary (DCB) components; Added test suite for projection subsystem; Added tests for utility functions and topic management; Added tests to verify documentation code snippets; New application-level test suite for event sourcing infrastructure; Restructured test suite into a dedicated tests package.
Dependencies
Updated dependency lockfile and migrated build configuration to pyproject.toml
The project's dependency management has been updated with a new \poetry.lock\ file that resolves specific versions for development and documentation tools, including \black\ 26.5.1, \ast-serialize\ 0.8.0, and \autodoc-pydantic\ 2.2.0. Concurrently, the build system configuration has been standardized by converting \setup.py\ to \pyproject.toml\, which now explicitly defines the project metadata, core dependencies like \typing\_extensions\, and optional dependency groups for \crypto\, \cryptography\, and \postgres\.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 57 → 61 (+4.0)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 79 → 87 (+8.3)
- Architecture 99 → 95 (-3.5)
- Maturity 56 → 59 (+3.1)
- Readiness 41 → 44 (+3.1)
- Security 81 → 92 (+10.9)
- Domain Modelling 100 → 99 (-1.0)
Resolved (32)
- ApplicationRecorderTestCase.optional_test_insert_subscribe (cognitive 22) (eventsourcing/tests/persistence.py)
- ApplicationRecorderTestCase.optional_test_insert_subscribe (cyclomatic 19) (eventsourcing/tests/persistence.py)
- Cargo._ (cognitive 18) (examples/cargoshipping/domainmodel.py)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- Duplicated block (11 lines × 2) (eventsourcing/domain.py)
- Duplicated block (11 lines × 2) (eventsourcing/postgres.py)
- Duplicated block (12 lines × 2) (eventsourcing/postgres.py)
- Duplicated block (12 lines × 2) (examples/shopvertical/slices/add_item_to_cart/cmd.py)
- Duplicated block (14 lines × 2) (eventsourcing/dcb/postgres_tt.py)
- Duplicated block (14 lines × 2) (eventsourcing/system.py)
- Duplicated block (14 lines × 2) (eventsourcing/system.py)
- Duplicated block (17 lines × 2) (examples/dcb_enrolment_with_basic_objects/application.py)
- Duplicated block (6 lines × 2) (eventsourcing/application.py)
- Duplicated block (7 lines × 3) (examples/aggregate5/domainmodel.py)
- Duplicated block (9 lines × 2) (eventsourcing/system.py)
- EnrolmentWithDCB.join_course (cognitive 17) (examples/dcb_enrolment_with_basic_objects/application.py)
- High CVE: [GHSA redacted] (poetry.lock)
- High: security finding (details withheld)
- High: security finding (details withheld)
- …and 12 more
New (80)
- Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency
- Documentation: no installation or build instructions (docs/topics/installing.rst)
- Duplicated block (10 lines × 2) (eventsourcing/dcb/postgres_tt.py)
- Duplicated block (10 lines × 2) (examples/aggregate6a/domainmodel.py)
- Duplicated block (11 lines × 2) (eventsourcing/cipher.py)
- Duplicated block (11 lines × 2) (eventsourcing/domain.py)
- Duplicated block (12 lines × 2) (eventsourcing/postgres.py)
- Duplicated block (12 lines × 2) (eventsourcing/system.py)
- Duplicated block (12 lines × 3) (examples/aggregate1/application.py)
- Duplicated block (13 lines × 2) (eventsourcing/postgres.py)
- Duplicated block (14–15 lines × 2) (examples/shopvertical/slices/add_item_to_cart/cmd.py)
- Duplicated block (16 lines × 2) (examples/aggregate7/application.py)
- Duplicated block (17 lines × 2) (eventsourcing/dcb/postgres_tt.py)
- Duplicated block (17 lines × 2) (examples/aggregate10/application.py)
- Duplicated block (20 lines × 2) (eventsourcing/dcb/domain.py)
- Duplicated block (20 lines × 2) (eventsourcing/system.py)
- Duplicated block (22–25 lines × 2) (eventsourcing/system.py)
- Duplicated block (37 lines × 2) (examples/dcb_enrolment_with_basic_objects/application.py)
- Duplicated block (6 lines × 2) (eventsourcing/application.py)
- Duplicated block (7 lines × 2) (eventsourcing/domain.py)
- …and 60 more
Changes since last survey
- 8 commits — 8 feature/other, 0 fixes
By area
- (root) — 6 commits
- eventsourcing/dispatch.py — 1 commit
- eventsourcing/domain.py — 1 commit
Notable commits
- change: Added CPY001 to excluded linter rules in pyproject.toml.
- change: Added RUF063 to excluded linter rules for class annotations.
- change: Drop Python 3.10, update dependencies.
- change: Refactored singledispatchmethod to improve type handling, thread safety, and registration logic.
- change: Replaced TypeVar from typing with typing_extensions, and updated dependencies.
- change: Synced dependencies to version 9.5.5 and added event comparison helper methods in test utilities.
- change: Updated poetry.lock with new dependencies and version upgrades.
- change: Updated pyproject.toml and poetry.lock to use packaged eventsourcing-umadb dependency instead of local development version.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
pyeventsourcing/eventsourcing was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 22 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 575d42c10a821828639b90178ed56703abe9c9f1 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-821afab8930d.