pypatterns/python-cqrs
43.7
Weak · 9 November 2026
22.8k
lines of production code
Python
primary language
7
measurements over time
What this system is
Features
Add CQRS dependency injection container adapters
Users can now resolve dependencies in CQRS handlers using two supported backends: the \dependency-injector\ library and the \di\ library. The \DependencyInjectorCQRSContainer\ adapter automatically discovers providers from an external \dependency-injector\ container, supporting both exact type matches and inheritance-based resolution for interfaces. The \DIContainer\ adapter integrates with the \di\ library, using its \AsyncExecutor\ to resolve dependencies within a request-scoped context. Both adapters implement the \Container\ protocol, allowing seamless switching between DI strategies while maintaining a consistent API for handler dependency resolution.
src/cqrs/container · high confidence
Initial CQRS adapter implementations for AMQP and Kafka with circuit breaker support
This change introduces the initial implementation of the CQRS adapter layer, providing concrete integrations for message brokers and resilience patterns. It adds AMQP support via \aio\_pika\ (including publisher and consumer factories with connection pooling) and Kafka support via \aiokafka\ (featuring configurable security protocols, SASL mechanisms, SSL context support, and automatic retry logic). Additionally, it implements a circuit breaker adapter using \aiobreaker\ to handle failures in saga steps and request/event handling, along with the underlying protocol definitions that decouple these interfaces from specific implementation details.
src/cqrs/adapters · high confidence
Initial project scaffolding and developer tooling setup
Establishes the foundational development environment for the python-cqrs library by adding pre-commit hooks (Ruff, Pyright, Vermin), configuration files for linting and type checking, and documentation for local setup and contribution. Includes Docker Compose files for local Kafka, MySQL, PostgreSQL, and Redis services, a .gitignore update, and a py.typed marker to enable static type checking for consumers.
(repo-wide) · high confidence
Initial release of the CQRS framework with optional Pydantic and SQLAlchemy integrations
The \src/cqrs\ package is introduced, providing a complete CQRS implementation including mediators (Request, Event, Saga, Streaming), a configurable outbox pattern with SQLAlchemy support, and adapters for Kafka and AMQP. The framework supports circuit breakers for saga steps and handlers, lazy-loading for optional dependencies (Pydantic models and SQLAlchemy repositories are loaded only when used), and bootstrap helpers for rapid setup with dependency-injector containers. Also in this area: 2 commits (1 fix) modifying src/cqrs; 2 commits (2 fixes) fixing src/cqrs; Unified request type and handler type inference; Add optional SQLModel support for outbox and saga storage.
(repo-wide) · medium confidence
Introduce CQRS dispatchers with fallback, streaming, and saga support
The dispatcher module now provides dedicated dispatchers for requests, events, and sagas, enabling more robust command and query handling. Request and event dispatchers support fallback mechanisms with circuit breaker integration, allowing the system to switch to alternative handlers when primary ones fail. A new streaming request dispatcher supports async generator handlers for real-time response streaming, while the saga dispatcher manages multi-step transactions with configurable compensation retries and event propagation. All dispatchers integrate with the middleware chain and dependency injection container.
src/cqrs/dispatcher · high confidence
Introduction of CQRS middleware infrastructure and logging
The CQRS module now includes a middleware system that allows intercepting and processing requests before they reach their handlers. This change introduces base classes for middleware chains (\Middleware\, \MiddlewareChain\) and a specific \LoggingMiddleware\ that records debug-level logs for incoming requests and outgoing responses, including masked JSON representations of the data.
src/cqrs/middlewares · high confidence
New Chain of Responsibility and Dependency Injection examples
Added new example directories for Chain of Responsibility (CoR) and Dependency Injection (DI) patterns. The CoR examples demonstrate multi-handler pipelines, fallback mechanisms when chains fail, and Mermaid diagram generation for visualization. The DI examples cover basic injection, scoped dependencies with various containers (di, dishka, dependency-injector, FastAPI), and a practical FastAPI integration with outbox support. Also in this area: 3 commits adding/updating tests in examples; Added typed example scripts for CQRS patterns.
examples/cor, examples/events, examples/streaming, examples/di, examples/outbox · medium confidence · unverified
Saga storage interface and implementations with configurable table names
The saga storage subsystem now exposes a formalized interface (ISagaStorage) and concrete implementations for both in-memory (MemorySagaStorage) and persistent (SqlAlchemySagaStorage) backends. The persistent implementation introduces configurable table names for saga executions and logs via the CQRS\_SAGA\_EXECUTION\_TABLE\_NAME and CQRS\_SAGA\_LOG\_TABLE\_NAME environment variables, allowing users to customize database schema naming. The storage layer also supports optimistic locking through version tracking and provides detailed step logging for saga execution history.
src/cqrs/saga/storage · high confidence
Behavioural changes
1 commit (0 fixes) modifying examples, scripts
A change to existing behaviour in examples, scripts — 1 commit, 2 files: “Add producing into specified topic (\#6)” (refs \#6).
examples, scripts · low confidence · unverified
2 commits (1 fix) modifying examples/inbox, src/cqrs/inbox
A change to existing behaviour in examples/inbox, src/cqrs/inbox — 2 commits (1 fix), 12 files: “feat: add a transactional inbox in 5.3.0”; “fix: redeliver failed inbox batches and keep SQLite rows”.
examples/inbox, src/cqrs/inbox · medium confidence · unverified
2 commits (1 fix) modifying src/cqrs
A change to existing behaviour in src/cqrs — 2 commits (1 fix), 8 files: “feat: add a testing harness for handlers and delivery”; “fix: address testing-harness review feedback”.
_src/cqrs/testing, tests/unit/test\_testing\harness · medium confidence · unverified
6 commits (2 fixes) modifying examples/proto
A change to existing behaviour in examples/proto — 6 commits (2 fixs), 4 files: “Fix protobuf example”; “Protobuf supporting (\#7)”; “Feature: Add configurable Outbox event serializers (\#90)”; and 2 more (refs \#7, \#90).
examples/proto · medium confidence · unverified
Introduce protocol-based JSON serialization and deserialization
The CQRS module now uses a new, protocol-based approach for message serialization and deserialization, decoupling the implementation from specific frameworks like Pydantic. The \JsonDeserializer\ converts JSON data into objects that implement the \Deserializable\ protocol (requiring a \from\_dict\ classmethod), while the \default\_serializer\ handles outgoing messages by calling \to\_dict()\ or \model\_dump()\ if available. This change introduces \orjson\ as the underlying JSON engine and provides a \DeserializeJsonError\ dataclass for structured error reporting during deserialization failures.
src/cqrs/deserializers · high confidence
Unified request type and handler type inference
Commands and queries are now both represented by the single \\cqrs.Request\\ type, removing the previous distinction between commands and queries. The library now automatically infers the response type from the request's type parameter (e.g., \\Request\[Result\]\\), allowing handlers to be registered with a single type argument. This simplifies the API by eliminating the need for separate command/query bases and explicit response type declarations on handlers. Also in this area: Initial release of the CQRS framework with optional Pydantic and SQLAlchemy integrations.
(repo-wide), src/cqrs/compressors · high confidence
Test coverage
5 commits adding/updating tests in skills; Add dataclass-based benchmarks for CQRS components; Added default benchmark suite for CQRS components; Added unit tests for CQRS framework components; Added unit tests for saga orchestration, fallback, recovery, and storage; Initial test infrastructure setup; Integration test suite for CQRS, Saga, and Outbox components.
Dependencies
Initial release of python-cqrs version 5.0.0
This entry introduces the python-cqrs package (version 5.0.0), an event-driven architecture framework for distributed systems. The package requires Python 3.10+ and includes core dependencies such as dataclass-wizard, dependency-injector, orjson, and typing-extensions. It provides optional extras for specific integrations, including pydantic, SQLAlchemy, Kafka (aiokafka), RabbitMQ (aio-pika), and circuit breaker support (aiobreaker).
(dependencies) · high confidence
Written by cca.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 → 44 (-12.9)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.
Lenses
- Code Health 73 → 66 (-6.9)
- Architecture 89 → 88 (-0.4)
- Maturity 63 → 62 (-0.9)
- Readiness 43 → 43 (+0.0)
- Security 61 → 26 (-34.8)
- Domain Modelling 100 → 100 (+0.0)
- Performance 94 → 94 (+0.0)
Resolved (3)
- Disclosure policy has no reporting contact
- Medium: security finding (details withheld)
- Off-boarding risk: anonymized user #1
New (12)
- Disclosure policy has no reporting contact (SECURITY.md)
- Duplicated block (11 lines × 2) (src/cqrs/inbox/map.py)
- Duplicated block (13 lines × 2) (src/cqrs/inbox/sqlalchemy.py)
- Duplicated block (9 lines × 2) (examples/di/scoped_dependencies_sqlalchemy.py)
- Duplicated block (9 lines × 2) (examples/inbox/fastapi_accept.py)
- EventEmitter._ (cognitive 17) (src/cqrs/events/event_emitter.py)
- FileTooLong: testing/recording.py (src/cqrs/testing/recording.py)
- HarnessReport._hints (cognitive 51) (src/cqrs/testing/report.py)
- HarnessReport._hints (cyclomatic 37) (src/cqrs/testing/report.py)
- HarnessReport._render_rich (cognitive 16) (src/cqrs/testing/report.py)
- harness._attach (cognitive 18) (src/cqrs/testing/harness.py)
- harness._connect_brokers (cognitive 27) (src/cqrs/testing/harness.py)
Changes since last survey
- 37 commits — 31 feature/other, 6 fixes
By area
- (root) — 11 commits
- (repo) — 10 commits
- examples/testing — 5 commits
- src/cqrs — 4 commits
- .github/workflows — 2 commits
- skills/cqrs-eda — 2 commits
- examples/inbox — 1 commit
- skills/cqrs-chain-of-responsibility — 1 commit
- skills/cqrs-event-driven — 1 commit
Notable commits
- fix: fix: address testing-harness review feedback
- fix: fix: do not send SKIP LOCKED to MySQL and MariaDB versions that reject it
- fix: fix: lock outbox batches so two publishers do not send the same row
- fix: fix: lock outbox batches with FOR UPDATE SKIP LOCKED (#109)
- fix: fix: redeliver failed inbox batches and keep SQLite rows
- fix: release the outbox row-lock fix as 5.3.1
- change: Publish to PyPI only when a tag is pushed (#110)
- change: Stop a GitHub release from racing the tag upload to PyPI.
- change: Unify cqrs.testing journal asserts and harness failure reports (#119)
- change: docs: drop AAA phase labels from testing examples
- change: docs: explain how an application installs the agent skills
- change: docs: explain how an application installs the agent skills (#114)
- change: docs: keep application skill install commands in the README
- change: docs: keep application skill install commands in the README (#116)
- change: docs: keep only skill install commands in the README (#111)
- change: docs: list each skill install command on its own line
- change: docs: point example links at /latest and keep the pytest harness samples
- change: docs: qualify inbox and saga guarantees in the agent skills (#111)
- change: docs: rebuild the README around one runnable order example
- change: docs: scope the pattern guidance to the saga, outbox, and inbox
- …and 17 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
pypatterns/python-cqrs 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 9 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 94084b19299c4afc2c95d004e19765f342a72e5f — the exact code this score is about.
- Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-bb0cb800cd0f.