krew-solutions/ascetic-ddd-python
58.2
Adequate · 22 October 2026
22.7k
lines of production code
Python
primary language
6
measurements over time
What this system is
Ascetic DDD is a Python framework for Domain-Driven Design that provides infrastructure for event sourcing, command handling, and distributed saga coordination. It includes a code generation CLI to scaffold domain models and a comprehensive test data faker system with support for complex statistical distributions and PostgreSQL-backed persistence. The library also implements patterns for idempotent message processing, secure key management, and reliable transactional outboxes.
Features
Add Json value object for immutable data handling
A new \Json\ value object has been introduced in the domain values module to wrap arbitrary objects and provide a consistent hash representation. This allows JSON-like data structures to be used reliably in sets or as dictionary keys by ensuring their hash is based on the frozen content of the underlying object.
_ascetic\ddd/faker/domain/values · high confidence
Add PostgreSQL specification visitor and relation resolver
Introduces the \PgSpecificationVisitor\ and \ProviderRelationResolver\ components within the \ascetic\_ddd/faker/infrastructure/specification\ module. The visitor translates domain query specifications into PostgreSQL SQL, leveraging the new \ProviderRelationResolver\ to map aggregate provider structures to SQL table information, thereby enabling the faker infrastructure to generate queries for nested relations.
_ascetic\ddd/faker/infrastructure/specification · high confidence
Add PostgreSQL-based sequencer implementation
The faker infrastructure now includes a new PgSequencer class and its factory, enabling the generation of unique sequential identifiers backed by PostgreSQL tables and sequences. This implementation handles table creation, sequence initialization via triggers, and cleanup, allowing the system to distribute sequence scopes across different providers using a dedicated database schema.
_ascetic\ddd/faker/infrastructure/sequencers · high confidence
Add REST stats observers for session metrics
New observer classes have been added to the session infrastructure to capture and report REST API performance metrics. The \RestStatsObserver\ records request response times and status codes using a generic stats collector, while the \RestStatsdObserver\ sends timing and increment metrics to a StatsD-compatible backend (via \aiodogstatsd\) upon request and session completion.
_ascetic\ddd/faker/infrastructure/session/observers · high confidence
Add sync and async signal observables with composite support
The \ascetic\_ddd/signals\ module now provides \SyncSignal\ and \AsyncSignal\ classes for event notification, supporting observer attachment/detachment with optional IDs and disposable cleanup. It also introduces \SyncCompositeSignal\ and \AsyncCompositeSignal\, which allow multiple signal instances to be combined so that notifications propagate to all delegates. The implementation includes interfaces (\ISyncSignal\, \IAsyncSignal\) and comprehensive unit tests for both signal types and their composite variants.
_ascetic\ddd/signals · high confidence
Add validation library with built-in validators and error handling
Introduces a new validation module providing core validators including Required, Regex, Email, Length, and Number, along with composite validators (ChainValidator, MultivalueValidator, MappingValidator) for complex validation scenarios. The module includes a comprehensive exception hierarchy (ValidationError, ChainValidationError, MappingValidationError) that supports error chaining and mapping, enabling users to validate data structures and collect multiple validation errors efficiently.
_ascetic\ddd/validators · high confidence
Added PostgreSQL logging observer for query events
A new PgLoggingObserver component has been introduced to the session module, enabling detailed logging of database query events. When a query ends, this observer logs the process ID, response time, SQL statement, and parameters at the debug level, providing visibility into database interactions for debugging and monitoring purposes.
_ascetic\ddd/session/observers · high confidence
Added statistical analysis utilities for benchmarking
The \ascetic\_ddd/faker\ module now includes a \Stats\ class and \Collector\ utility in \domain/utils/stats.py\. This component provides detailed statistical analysis capabilities for performance data, including calculations for mean, standard deviation, median, quartiles (Q1, Q3), interquartile range (IQR), and outlier detection based on Tukey's fences and standard deviation thresholds. It also exposes operations per second (ops) and total duration metrics, enabling users to analyze and report on benchmark results with greater precision.
(repo-wide) · high confidence
CLI entry point for DDD scaffold command
The CLI module now exposes a \scaffold\ subcommand that generates DDD bounded context code from a YAML domain-model definition. Users can specify the input YAML file, output directory, base package name, and optional custom templates directory via command-line arguments.
_ascetic\ddd/cli · high confidence
Event store now encrypts event payloads using per-stream data encryption keys
The event repository in the seedwork infrastructure now transparently encrypts event payloads before persistence. This is achieved by introducing a \DekStore\ that manages per-stream Data Encryption Keys (DEKs) with versioning and rewrapping capabilities, integrated with the Key Management Service (KMS). The \EventStore\ and \EventGetQuery\ now use a codec pipeline (JSON, Zlib compression, and Encryption) to handle these encrypted payloads, ensuring that event data is stored securely in the \event\_log\ table while maintaining backward compatibility through versioned cipher support.
_ascetic\ddd/seedwork/infrastructure/repository · high confidence
Initial commit of application seedwork and command module structure
This change introduces the foundational structure for the application layer within the seedwork package. It adds the \\_\init\\.py\ file for the \application\ module, which includes a reference to its source, and creates the \commands\ sub-package with its own \\\init\\_.py\. This establishes the directory layout and module boundaries for command handling infrastructure.
_ascetic\ddd/seedwork/application · high confidence
Initial project scaffolding and configuration
The repository is initialized with core configuration files including a Makefile for linting and type-checking, a pyright configuration targeting Python 3.14, and a docker-compose setup for a local Vault service. Utility scripts for waiting on file or network availability are added, and the README clarifies the project's status as an active, pre-1.0.0 framework.
(repo-wide) · high confidence
Initial release of ascetic\_ddd package with factory utilities
The ascetic\_ddd package is introduced, providing core infrastructure for Domain-Driven Design in Python. The package exposes a factory module containing a BuildingBlocksFactory class, which allows users to asynchronously create in-memory message buses (IBus) for session management. This initial release establishes the foundational components for event handling within the library.
_ascetic\ddd · high confidence
Initial release of domain seedwork aggregates and value objects
This change introduces the foundational building blocks for the domain layer, including abstract base classes for event-sourced aggregates (EventSourcedAggregate, VersionedAggregate) and entities (EventiveEntity, HashableEntity). It also adds concrete implementations for exporting causal dependencies, event metadata, and persistent domain events, alongside value objects for geolocation coordinates, points, and time ranges, all equipped with corresponding exporters to facilitate serialization.
_ascetic\ddd/seedwork/domain/aggregate · high confidence
Initialization of the FP domain module
The \ascetic\ddd/faker/domain/fp\ package has been initialized with a new \\\init\\_.py\ file. This establishes the module structure for the functional programming (FP) providers within the faker domain, serving as the entry point for this specific area of the codebase.
_ascetic\ddd/faker/domain/fp · medium confidence
Introduce Deferred pattern for asynchronous operations
Adds a new \ascetic\_ddd.deferred\ module providing a \Deferred\ class and \IDeferred\ interface that implement the Deferred/Promise pattern for handling asynchronous operations with success and error callbacks. The implementation follows the Promises/A+ specification, supporting callback registration via \then()\, resolution and rejection, handler chaining, and error collection via \occurred\_err()\. It also includes a \Deferred.all()\ static method to wait for multiple deferreds to resolve, similar to \Promise.all\. Unit tests are included to verify basic resolution, rejection, chaining, and error propagation behaviors.
_ascetic\ddd/deferred · high confidence
Introduce Inbox pattern for idempotent, causally consistent message processing
Added the Inbox component to handle incoming integration messages with guaranteed idempotency and causal consistency. The implementation uses a PostgreSQL-backed table (with bytea payloads and JSONB metadata) and supports partitioned, concurrent processing via worker IDs and configurable concurrency levels. Users can process messages using a dispatch callback, an async iterator for continuous polling, or a high-level run method that manages multiple processes and workers. Partitioning strategies allow distributing load by stream identity (preserving causal order) or by URI.
_ascetic\ddd/inbox · high confidence
Introduce Key Management Service with PostgreSQL and Vault backends
The \ascetic\_ddd/kms\ module now provides a unified key management interface (\IKeyManagementService\) for encrypting, decrypting, and rotating Data Encryption Keys (DEKs) using Key Encryption Keys (KEKs). This change introduces two concrete implementations: \PgKeyManagementService\, which stores encrypted keys in a new \kms\_keys\ PostgreSQL table (defined in \init.sql\), and \VaultTransitService\, which delegates key operations to a HashiCorp Vault Transit Engine via REST API. The module also defines the \KekNotFound\ exception to handle missing key scenarios.
_ascetic\ddd/kms · high confidence
Introduce Mediator pattern with request/response and event/pub-sub capabilities
The \ascetic\_ddd/mediator\ module now provides a concrete Mediator implementation alongside its interface definitions. This adds support for sending typed requests to registered handlers via \send\ and \register\, as well as publishing events to subscribed handlers via \publish\ and \subscribe\. The implementation also supports request pipelines through \add\_pipeline\, allowing for cross-cutting concerns to be applied to request handling.
_ascetic\ddd/mediator · high confidence
Introduce Money pattern with multi-currency support and expression-based arithmetic
Added a new Money domain value object in the seedwork layer, implementing the Money pattern from Kent Beck's 'Test Driven Development By Example'. This introduces a Currency enum (USD, EUR, RUB, GBP) with symbol support, a Money class for representing amounts, and an Expression interface that enables composite arithmetic operations (Sum) and scalar multiplication. A Bank class provides currency conversion via exchange rates, allowing expressions involving multiple currencies to be reduced to a single target currency. The module also includes an export mechanism (IMoneyExporter/MoneyExporter) for serializing money data.
_ascetic\ddd/seedwork/domain/values/money · high confidence
Introduce MongoDB-like query DSL for faker providers
The faker domain now supports a structured query language for specifying filtering criteria, modeled after MongoDB's query syntax. Users can define complex conditions using operators such as $eq, $ne, $gt, $in, $is\_null, $not, $any, $all, $len, and $rel, as well as logical combinations like $or and implicit AND. The system includes a parser to convert dictionary-based queries into an internal operator tree, visitors to transform queries into different formats (e.g., plain values or dict representations), and an evaluator to check if objects match the specified criteria, including support for resolving related aggregates via the $rel operator.
_ascetic\ddd/faker/domain/query · high confidence
Introduce PostgreSQL query compiler for faker infrastructure
Added a new query compilation layer in the faker infrastructure that translates MongoDB-style query operators into PostgreSQL SQL using JSONB containment (@\>) and EXISTS subqueries. This includes the PgQueryCompiler and ScalarPgQueryCompiler classes, support for nested value object fields, and operators such as IsNull, comparison ($gt, $gte, $lt, $lte), and relation resolution via IRelationResolver.
_ascetic\ddd/faker/infrastructure/query · high confidence
Introduce Transactional Outbox for reliable message publishing
Added a new Transactional Outbox implementation in the \ascetic\_ddd/outbox\ module to ensure atomic persistence of integration messages alongside business state changes. The feature includes a PostgreSQL schema (\init.sql\) with an \outbox\ table for storing messages and an \outbox\_offsets\ table for tracking consumer group positions, supporting URI-based routing and partitioning across multiple workers. The Python implementation provides an \Outbox\ class that exposes \publish\ for storing messages within a database transaction and \dispatch\/\run\ for asynchronously delivering messages to subscribers, guaranteeing at-least-once delivery and correct ordering via PostgreSQL transaction IDs.
_ascetic\ddd/outbox · high confidence
Introduce batch query collection for bulk INSERT operations
The \ascetic\_ddd/batch\ module now provides a mechanism to defer and batch database queries, specifically targeting INSERT statements to resolve N+1 query problems. It introduces \QueryCollector\, \ConnectionCollector\, and \CursorCollector\ which mimic standard session interfaces but store queries instead of executing them immediately. Users can pass these collectors to queries to accumulate them, then call \evaluate\ on a real session to execute the collected queries in bulk. The module includes \MultiQuery\ and \AutoincrementMultiInsertQuery\ implementations that combine individual INSERTs into single bulk operations, handling both standard inserts and those with RETURNING clauses to resolve deferred results with the appropriate rows.
_ascetic\ddd/batch · high confidence
Introduce disposable pattern and utility modules
This change introduces a new \disposable\ module providing \Disposable\ and \CompositeDisposable\ classes to manage asynchronous resource cleanup via an \IDisposable\ interface, alongside a set of new utility modules in \ascetic\_ddd/utils\. These utilities include \amemo\ for async function memoization, \JSONEncoder\ for serializing complex types like dates and dataclasses, \pg\ for SQL identifier escaping, \profiler\ for async function performance profiling, \property\ for class-level property decorators, and \serializer\ for base64-encoded pickle serialization.
_ascetic\ddd/utils · high confidence
Introduce disposable resource management and lambda-based specification filtering
This change introduces two new capabilities to the library. First, it adds a disposable pattern under \ascetic\_ddd.disposable\, providing an \IDisposable\ interface and concrete \Disposable\ and \CompositeDisposable\ classes that allow users to manage async cleanup callbacks and combine multiple disposables using the \+\ operator. Second, it adds a lambda filter package under \ascetic\_ddd.specification.domain.lambda\_filter\, exposing a \LambdaParser\ and a \parse\ function to support the Specification pattern with lambda-based filtering logic.
_ascetic\_ddd/disposable, ascetic\_ddd/specification/domain/lambda\filter · high confidence
Introduce in-memory Sequencer and factory for ID generation
The \ascetic\_ddd/faker/domain/sequencers\ module now provides a new \Sequencer\ implementation and its corresponding factory. This component generates sequential integer IDs in memory, keyed by an optional scope, and supports setup/cleanup hooks via the \ISession\ interface. The \ISequencerFactory\ protocol is defined as non-generic, and the factory function allows specifying a provider name for potential database table naming conventions.
_ascetic\ddd/faker/domain/sequencers · high confidence
Introduce infrastructure for PostgreSQL database dumps with local, S3, and composite storage options
This change adds a new \dump\ infrastructure module that provides capabilities to back up and restore PostgreSQL databases. It defines protocol interfaces (\IFileDump\, \IDump\) and implements concrete strategies: \PgDump\ and \SinglePgDump\ for executing \pg\_dump\/\psql\ and \pg\_restore\ commands, \GzipDump\ for compression, \FileDump\ for local file storage with TTL-based existence checks, and \S3Dump\ for uploading/downloading archives to AWS S3. A \CompositeDump\ allows chaining multiple storage delegates. Factory functions \make\_dumper\ and \make\_single\_dumper\ in \utils.py\ wire these components together, supporting optional AWS credentials for remote storage.
_ascetic\ddd/faker/infrastructure/dump · high confidence
Introduce public Specification pattern API with logical, comparison, and mathematical operators
This change adds the public API for the Specification pattern in \ascetic\ddd/specification/domain/public\, exposing protocols and adapter classes that enable fluent, operator-based query construction. Users can now build specifications using standard Python operators: logical operations (\&\, \\|\, \\~\, \is\\) via the \Logical\ class, comparisons (\==\, \!=\, \\<\, \\>\, \\<=\, \\>=\) via \Comparison\, and mathematical/bitwise operations (\+\, \-\, \\*\, \/\, \%\, \\<\<\, \\>\>\) via \Mathematical\. The API also supports nullability checks (\is\_null\, \is\_not\null\) through the \Nullable\ adapter and provides concrete type wrappers (\Boolean\, \Number\, \Datetime\, \Text\ and their \Null\\ variants) in \datatypes.py\ to simplify common specification scenarios. Helper functions \object\_\ and \field\ allow referencing domain objects and fields by name.
_ascetic\ddd/specification/domain/public · high confidence
Introduce query-based specification with nested relation support
The specification module now includes QueryLookupSpecification, which allows filtering aggregates by evaluating nested relations (e.g., checking a related object's status) at check time using an EvaluateWalker. This is supported by new interfaces (ISpecification, ISpecificationVisitor) and an EmptySpecification that always returns true, enabling more flexible and dynamic query-based filtering without pre-computing nested states.
_ascetic\ddd/faker/domain/specification · high confidence
Introduce stateless functional programming factory components
The \ascetic\_ddd/faker/domain/fp/factories\ module now provides a suite of stateless factory decorators and composable building blocks for generating test data. This includes \ValueFactory\ for leaf values, \StructureFactory\ for dict composition, \ModeledFactory\ for transforming dicts to domain models, \PersistedFactory\ for repository persistence with ID lookup, \DistributedFactory\ for distributor-based value selection, \ReplicatedFactory\ for creating lists of items, \SequenceFactory\ for generating sequential integers, and \Pipe\ for orchestrating top-down aggregate generation. These components replace the previous mutable factory cycle with a functional, composable approach.
_ascetic\ddd/faker/domain/fp/factories · high confidence
Introduce typed DAG-based change notification system
Added the \ascetic\_ddd.dag\_change\_typed\ module, which implements a hybrid dependency graph for change notifications. This system supports both instance-based and type-based subscriptions, allowing observers to automatically wire themselves to new subjects of a specific type (auto-wiring). It includes a \DAGChangeManager\ that performs topological sorting during notifications to ensure correct propagation order in complex dependency graphs, along with interfaces and concrete classes for subjects and observers.
_ascetic\_ddd/dag\_change\typed · high confidence
Introduces DAG-aware change propagation with topological ordering
Adds a new \ascetic\_ddd.dag\_change\ module that implements the Observer pattern for dependency graphs. It includes \DAGChangeManager\, which propagates changes through a Directed Acyclic Graph (DAG) in topological order, ensuring each observer is notified exactly once even in diamond dependencies. The module also provides \SimpleChangeManager\ for basic registration without ordering, \ChangeSubject\ and \ChangeObserver\ classes for node implementation, and a comprehensive test suite verifying correct propagation, deduplication, and topological sequencing.
_ascetic\_ddd/dag\change · high confidence
Introduces Option type with Some/Nothing semantics and comprehensive tests
Adds a new \Option\ generic type to the \ascetic\_ddd.option\ module, providing \Some\ and \Nothing\ constructors to handle optional values safely. The implementation includes methods for unwrapping values (\unwrap\, \unwrap\_or\, \unwrap\_or\_else\), mapping (\map\, \map\_or\), chaining (\and\_then\), and fallback logic (\or\, \or\_else\), along with equality and hashing support. A full test suite in \test\_option.py\ validates these behaviors, ensuring that \Nothing\ correctly short-circuits operations and raises errors on unsafe unwraps.
_ascetic\ddd/option · high confidence
Introduces new provider architecture for test data generation
The \ascetic\_ddd/faker/domain/providers\ module has been rewritten to introduce a structured provider hierarchy for generating test data. This includes base mixins for lifecycle management and cloning, and specific provider types: \ValueProvider\ for simple immutable value objects, \CompositeValueProvider\ for composing multiple values, \AggregateProvider\ for managing entity aggregates with repositories, \ReferenceProvider\ for handling many-to-one relationships, and \DependentProvider\ for one-to-many relationships. A \ProviderChangeManager\ is added to orchestrate population order using topological sorting to resolve diamond dependencies. The system uses a query-based criteria system (\require\) and signals (\on\_required\, \on\_populated\) to manage state and events, supporting features like transient providers, distributed value selection, and nested relation lookups.
_ascetic\ddd/faker/domain/providers · high confidence
Introduction of generic Identity base class with typed implementations
The \ascetic\_ddd.seedwork.domain.identity\ module now provides a generic \Identity\ base class that implements \Hashable\ and \IAccessible\, enabling domain entities to use hashable, comparable identity values. This change introduces specific typed implementations (\IntIdentity\, \StrIdentity\, and \UuidIdentity\) that enforce type safety at initialization, allowing users to define domain identities that are safe to use in sets and dictionaries while maintaining strict type constraints for integer, string, and UUID values.
_ascetic\ddd/seedwork/domain/identity · high confidence
Introduction of in-memory event bus with subscription management
The \ascetic\_ddd/bus\ module now provides an in-memory implementation of an event bus, defined by \IBus\ and \IHandler\ interfaces and realized by \InMemoryBus\. This component allows users to subscribe to message URIs via handlers, publish messages to those URIs, and manage subscriptions using disposable tokens for automatic unsubscription. The change includes the core interfaces, the in-memory implementation, and a test suite verifying publish, unsubscribe, and disposable behavior.
_ascetic\ddd/bus · high confidence
Native JSONPath parser example added
An example script demonstrating the usage of the native JSONPath specification parser has been added to the examples directory. The script illustrates how to parse JSONPath expressions with positional and named placeholders, apply filters using various comparison operators, and evaluate these specifications against dictionary and collection contexts without external dependencies.
_ascetic\ddd/specification/domain/jsonpath · high confidence
New AOP provider architecture with pipeline and decorator-based composition
The faker domain now uses a new AOP (Aspect-Oriented Programming) provider system located in \ascetic\_ddd/faker/domain/aop/providers\. This introduces a core \IProvider\ interface and a \Pipe\ mechanism that executes steps sequentially, passing context from upstream to downstream to eliminate diamond conflicts in aggregate generation. The system includes several new provider types: \ValueProvider\ for leaf values, \StructureProvider\ for composing named child providers into dicts, \ReferenceProvider\ for foreign key resolution with lazy loading support, \ModeledProvider\ for transforming raw data into domain models, \PersistedProvider\ for repository-based persistence, \DistributedProvider\ for distributor-based value selection, \ReplicatedProvider\ for creating lists of items, and \SequenceProvider\ for generating sequential integers with scope support.
_ascetic\ddd/faker/domain/aop · high confidence
New CLI scaffold module for generating DDD bounded context code
The \ascetic\_ddd/cli/scaffold\ package has been introduced to automate the generation of Domain-Driven Design code from YAML model definitions. It provides two main entry points: \scaffold()\ for standard template-based rendering and \ast\_scaffold()\ for AST-based generation that supports additive merging of generated code into existing modules without overwriting user modifications. The module includes a YAML parser that supports aggregates, entities, value objects (including imported and composite types), domain events, and commands, along with utilities for naming conventions and AST manipulation.
_ascetic\ddd/cli/scaffold · high confidence
New Railway-Oriented Programming toolkit for error handling
The \ascetic\_ddd.rop\ module introduces a Railway-Oriented Programming (ROP) toolkit, providing a \Result\ type that supports two-track outcomes: success values or accumulated lists of errors. This allows developers to chain operations using methods like \map\, \and\_then\ (bind), and \both\, which automatically short-circuit on failure while accumulating error details. The module also includes utility functions such as \apply\, \map2\-\map4\, \switch\, \tee\, \try\catch\, \plus\, \and\\, \compose\, and \pipe\ to facilitate functional composition and error management within the domain-driven design context.
_ascetic\ddd/rop · high confidence
New data utility functions for hashing, freezing, and merging
The \ascetic\_ddd/seedwork/domain/utils/data\ module now provides four new helper functions: \hashable\ and \freeze\ convert mutable structures like dicts and lists into immutable, hashable forms suitable for use as dictionary keys or in sets; \is\_subset\ performs recursive checks to determine if one nested structure is contained within another; and \deepmerge\ recursively merges source dictionaries and lists into a destination object, preserving existing keys while adding new ones.
_ascetic\ddd/seedwork/domain/utils · high confidence
New generator infrastructure for the Faker domain
The \ascetic\_ddd/faker/domain/generators\ package has been introduced to centralize value generation logic. This change adds a new \IInputGenerator\ protocol and a suite of concrete implementations—including \IterableGenerator\, \ListGenerator\, \HypothesisStrategyGenerator\, \CallableGenerator\, \CountableGenerator\, \SequenceGenerator\, \RangeGenerator\, and \TemplateGenerator\—along with a \prepare\_input\_generator\ factory. These components allow the Faker system to produce test data from various sources such as Hypothesis strategies, callables, and sequences, while supporting session and query context injection.
_ascetic\ddd/faker/domain/generators · high confidence
New graph utilities for stable topological sorting and circular dependency detection
Added the \ascetic\_ddd.graph\ package containing \stable\_toposort\ for deterministic topological ordering of nodes (breaking ties via a key function and handling cycles by appending remaining nodes) and \strongly\_connected\_components\/\find\_circular\_sccs\ for detecting circular module dependencies using an iterative Tarjan's algorithm. These utilities are designed to support parser logic by providing generic graph operations without schema-specific dependencies.
_ascetic\ddd/graph · high confidence
New one-to-many (O2M) distributors for controlled data generation
The faker domain now includes a dedicated set of one-to-many (O2M) distributors, allowing users to define how many child entities are created for each parent. This location introduces the \IO2MDistributor\ interface and several concrete implementations: \SkewDistributor\ for power-law distributions, \WeightedDistributor\ for partition-based weighting, \WeightedRangeDistributor\ for bounded integer ranges with optional weights, and \DistributionDistributor\ for arbitrary statistical distributions (e.g., exponential, Pareto, log-normal). Additionally, \RangeDistributorAdapter\ bridges these O2M distributors to the existing M2O provider interface, enabling seamless integration with the current data generation pipeline.
_ascetic\ddd/faker/domain/distributors/o2m · high confidence
New repository implementations for PostgreSQL, REST, In-Memory, and Composite storage
The faker infrastructure now provides a suite of new repository implementations to support various data storage backends. This includes PgRepository and InternalPgRepository for persistent storage in PostgreSQL (with the internal variant handling JSONB-based object storage and auto-setup), RestRepository for persisting aggregates via HTTP POST requests to external APIs, InMemoryRepository for fast, in-memory testing with specification-based querying, and CompositeRepository to coordinate writes between internal and external repositories. These components are exported from the repositories package and implement the standard aggregate lifecycle (insert, update, get, find) along with async signals for insertion and update events.
_ascetic\ddd/faker/infrastructure/repositories · high confidence
New scaffolding, faker pipelines, and integration patterns
This change introduces several new capabilities to the \ascetic-ddd\ library. The CLI scaffold now generates domain models (entities, value objects, commands, events) and renders them via Jinja2 templates, including support for composite value objects and identity maps. A new \Pipe\ and \DependentProvider\ system enables top-down, stateless aggregate generation for faker data, allowing steps to depend on previous outputs via criteria. Integration patterns are added with \Inbox\ and \Outbox\ message structures, \CausalDependency\ tracking for event sourcing, and \SerializableRoutingSlip\ for distributed saga coordination. Additionally, a Key Management Service (KMS) with AES-256-GCM encryption and a JSONPath parser for specifications are included.
ascetic-ddd · high confidence
New utility modules for dataclasses, dictionaries, and JSON encoding
The \ascetic\_ddd/faker/infrastructure/utils\ package now includes new modules providing foundational utilities. \dataclasses.py\ introduces \IDataclass\ and \DataclassProtocol\ protocols for type-checking dataclass instances. \dict.py\ adds \flatten\_dict\ and \flatten\_dict\_gen\ functions to recursively flatten nested dictionaries into a single-level structure. \json.py\ defines a \JSONEncoder\ that extends the base encoder to specifically handle \Json\ domain values, ensuring they are serialized correctly.
_ascetic\ddd/faker/infrastructure/utils · high confidence
PostgreSQL-backed distributors with weighted and skew distributions
The faker infrastructure now includes a new set of PostgreSQL-based distributors in the \m2o\ module, allowing fake data generation to leverage database-level storage and selection strategies. This introduces \PgWriteDistributor\ as a shared storage layer, alongside \PgWeightedDistributor\ for custom weight-based selection and \PgSkewDistributor\ for power-law (skewed) distribution. A factory function \pg\_distributor\_factory\ simplifies instantiation by automatically composing these components, handling null weights, and managing provider naming. Users can now generate fake data with more realistic distribution patterns (e.g., skewed popularity) directly from PostgreSQL tables, with support for specification-based filtering and probabilistic new-value creation.
_ascetic\ddd/faker/infrastructure/distributors/m2o · high confidence
Saga pattern implementation with routing slip, parallel/fallback activities, and serialization
The \ascetic\_ddd/saga\ module introduces a new Saga pattern implementation using a routing slip approach for managing distributed transactions. It provides core components like \Activity\ (with \do\_work\ and \compensate\ methods), \RoutingSlip\, and \ActivityHost\ to orchestrate forward and backward (compensation) paths. New capabilities include \ParallelActivity\ for executing multiple routing slips concurrently and \FallbackActivity\ for trying alternative routing slips until one succeeds. The module also supports serialization of routing slips to JSON via \SerializableRoutingSlip\ and \ActivityTypeResolver\, enabling transmission across distributed services. Example activities for a travel booking scenario (car, hotel, flight) are included to demonstrate usage.
_ascetic\ddd/saga · high confidence
Scaffold templates for domain aggregates, exporters, and reconstitutors
The CLI scaffold now generates the core domain layer files for a new aggregate: \aggregate.py.j2\ defines the aggregate root class with versioning and event handling; \aggregate\_exporter.py.j2\ provides the exporter implementation for serializing aggregate state; and \aggregate\_reconstitutor.py.j2\ provides the reconstitutor implementation for rebuilding the aggregate from data. These templates allow users to scaffold complete domain entities with built-in support for exporting and importing state.
_ascetic\ddd/cli/scaffold/templates/domain · high confidence
Scaffold templates for domain event classes and exporters
The CLI scaffold now generates specific Python files for domain events, including the event class itself (inheriting from PersistentDomainEvent), an abstract exporter interface, and a concrete exporter implementation. These templates handle field definitions, versioning, and the export logic required to persist domain events.
_ascetic\ddd/cli/scaffold/templates/domain/events · high confidence
Scaffold templates for domain value objects
The CLI scaffold now generates Python files for domain value objects, including simple primitives, enums, identities, and composite structures. Generated simple value objects enforce constraints such as required status, blank checks, and maximum length for strings, while composite value objects include an abstract exporter interface and a concrete exporter implementation to handle serialization of nested fields. Enum value objects inherit from str Enum and provide an export method, and identity value objects extend a configurable base class with optional null-checking.
_ascetic\ddd/cli/scaffold/templates/domain/values · high confidence
Support for composite keys and schema-aware SQL generation
The specification infrastructure now supports composite keys and validates queries against a declared schema. Composite expressions (e.g., multi-column keys) are handled via a new \CompositeExpression\ type that ensures length matching and proper equality/inequality logic, while the \MappingVisitor\ transforms domain fields into these composites when needed. The \PostgresqlVisitor\ now accepts an optional \SchemaRegistry\ to validate foreign key relationships and handle composite types, ensuring that queries only access columns and relations explicitly defined in the schema. Additionally, all identifiers are now safely quoted to prevent conflicts with PostgreSQL reserved words.
_ascetic\ddd/specification/infrastructure · high confidence
Behavioural changes
Empty distributors module initialization
The distributors package has been initialized with an empty \_\init\\_.py file, establishing the module structure for the faker domain layer without introducing any immediate functionality or exports.
_ascetic\ddd/faker/domain/distributors · medium confidence
Empty distributors package initialization
The distributors package has been initialized with an empty \_\init\\_.py file, establishing the directory structure for the faker infrastructure's distribution logic.
_ascetic\ddd/faker/infrastructure/distributors · medium confidence
New Jinja2 macros for field serialization and import generation
The scaffold templates now include dedicated macro files (\_field\_macros.j2 and \_macros.j2) to handle the generation of exporter/reconstitutor methods and value object imports. This introduces structured logic for dispatching field exports (handling primitives, entities, and collections) and automates the generation of import statements for value objects, including their associated exporters when needed.
_ascetic\ddd/cli/scaffold/templates · high confidence
Refactored M2O distributors to support CQRS and weighted/skewed distributions
The M2O (many-to-one) distributor module has been restructured to support a Command-Query Responsibility Segregation (CQRS) pattern, introducing a shared WriteDistributor that allows multiple distributors to pool values. New distribution strategies have been added, including WeightedDistributor for custom weight-based selection and SkewDistributor for power-law distributions, both configurable via a unified factory. The system now supports nullable values through NullableDistributor and uses a Cursor mechanism to signal when new values need to be generated based on a mean usage count.
_ascetic\ddd/faker/domain/distributors/m2o · high confidence
Separate internal and external PostgreSQL session connections
The session infrastructure now distinguishes between internal and external database connections via new \IInternalPgSession\ and \IExternalPgSession\ protocols. This allows the application to explicitly route read-only queries (external) and write operations (internal) to different connection pools, improving isolation and potentially performance by using \READ\_UNCOMMITTED\ isolation levels for external read models.
_ascetic\ddd/faker/infrastructure/session · high confidence
Session layer refactored with IdentityMap and composite support
The session package has been restructured to introduce an IdentityMap for caching objects and preventing redundant database queries, supporting isolation levels from Read Uncommitted to Serializable. A new CompositeSession allows combining multiple session pools into a single logical unit, while session implementations (PostgreSQL, REST, Tortoise ORM) now expose atomic scope signals (on\_atomic\_started/ended) and integrate the IdentityMap for object tracking. Exception handling was updated with a new ObjectNotFound exception, and internal decorators were renamed for clarity.
_ascetic\ddd/session · high confidence
Specification evaluator now mirrors PostgreSQL arithmetic and comparison semantics
The specification domain now implements arithmetic (addition, subtraction, multiplication, division, modulo, shifts, negation) and comparison (equality, ordering) operators that strictly follow PostgreSQL's behavior rather than Python's native operators. This ensures that the in-memory evaluator and the database reading the compiled query tree produce identical results for edge cases such as integer overflow/underflow, float division by zero, NaN handling, and signed remainder. The evaluator also enforces SQL-style three-valued logic for NULLs in comparisons and logical connectives (AND/OR/NOT), ensuring that a specification is only satisfied when the result is explicitly true, not null.
_ascetic\ddd/specification/domain · high confidence
Split entity scaffolding templates into separate exporter and reconstitutor files
The CLI scaffold templates for domain entities have been reorganized to improve modularity. The single previous template has been split into three distinct files: the main entity class, a dedicated exporter implementation, and a dedicated reconstitutor implementation. This change allows users to generate cleaner, more focused code structures where export and import logic are handled by specialized classes rather than being embedded within the main entity definition.
_ascetic\ddd/cli/scaffold/templates/domain/entity · high confidence
Updated application command scaffolding templates
The CLI scaffold templates for the application layer have been updated to generate command classes that inherit from the IRequest interface and include a command\_version field, while command handlers now accept an ISession instance and raise NotImplementedError by default.
_ascetic\ddd/cli/scaffold/templates/application · high confidence
Test coverage
Added comprehensive test suite for specification infrastructure; Added integration and unit tests for the KMS module; Added integration tests for PostgreSQL specification evaluation; Added integration tests for faker infrastructure; Added integration tests for repository codecs and DEK store; Added integration tests for the Inbox pattern; Added test coverage for faker domain providers; Added test coverage for the native JSONPath parser; Added test infrastructure for database session pooling; Added test package initialization for seedwork domain; Added test package structure for faker domain distributors; Added test suite for PostgreSQL sequencer; Added test suite for the DDD scaffold CLI; Added test utilities for database connections, mock servers, and payload handling; Added tests for IdentityMap behavior and isolation levels; Added tests for PostgreSQL distributor implementations; Added tests for PostgreSQL specification visitor and nested relations; Added tests for QueryLookupSpecification; Added tests for the Faker query compiler and operators; Added tests for the Sequencer component; Added unit and integration tests for batch query processing; Added unit and integration tests for the Outbox component; Added unit tests for Inbox and InboxMessage components; Added unit tests for O2M distributors; Added unit tests for lambda filter parsing and evaluation; Added unit tests for the Faker Query system; Added unit tests for the Mediator component; Added unit tests for the Specification domain logic and public API.
Dependencies
Initial release of ascetic-ddd Python package
This change introduces the initial version (0.1.7) of the 'ascetic-ddd' toolkit, establishing the project's dependency structure via pyproject.toml and docs/requirements.txt. The package requires Python 3.14 and includes core dependencies such as aiohttp, cryptography, faker, mimesis, and psycopg for database interactions. It also defines optional CLI dependencies (jinja2, pyyaml, inflection) and development tooling (mypy, hypothesis), alongside documentation requirements (sphinx, myst-parser, sphinxcontrib-mermaid).
(dependencies) · high confidence
Housekeeping
Added empty package init files for seedwork and specification modules
This change adds empty or minimal \_\init\\_.py files to the ascetic\_ddd/seedwork, ascetic\_ddd/seedwork/domain, ascetic\_ddd/seedwork/infrastructure, and ascetic\_ddd/specification directories. These files serve to mark the directories as Python packages, enabling their import, but do not introduce any new functionality, behavior, or API changes for the user.
(repo-wide) · 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
Score
- CAI 59 → 58 (-0.4)
- Rubric changed (rubric-2026.10.1 → rubric-2026.10.5) — scores are not directly comparable.
Lenses
- Code Health 96 → 74 (-22.1)
- Architecture 93 → 93 (+0.0)
- Maturity 56 → 58 (+1.8)
- Readiness 48 → 48 (+0.0)
- Security 81 → 81 (+0.0)
- Domain Modelling 66 → 68 (+1.7)
- Performance 100 → 100 (+0.0)
Resolved (3)
- Duplication of registration logic between generic and typed change managers. The dag_change and dag_change_typed modules have nearly identical interfaces (IChangeManager) and implementations (DAGChangeManager, SimpleChangeManager), with the only difference being the presence of register_by_type/unregister_by_type in the typed version. This creates two parallel hierarchies for the same pattern.
- Inconsistent naming for execution/evaluation operations. Some types use 'evaluate' (IQueryEvaluator, MultiQuery, etc.) while others use 'execute' (IMultiQuerier, IDeferredCursor, IDeferredConnection, MultiQueryBase). 'Evaluate' implies a void/void-returning action or a check, while 'Execute' implies running a query and potentially returning results. The signature evaluate(...): None is semantically confusing for a query execution method.
- Inconsistent return types for 'execute' methods. Some return Deferred[Row | None] (IMultiQuerier, MultiQueryBase), while others return a cursor-like object (IDeferredCursor[Row], CursorCollector[Row]). This forces callers to handle different return types for what is essentially the same operation (executing a query).
New (4)
- Ambiguous 'add_subject' vs 'register'. DAGChangeManager in the typed module has both 'register' (which takes subject and observer) and 'add_subject' (which takes only subject). It is unclear if 'add_subject' is a prerequisite for 'register' or if it serves a different purpose (e.g., just tracking subjects without observers). This creates confusion about the lifecycle of a subject.
- Ambiguous 'evaluate' method on Session-like objects. IDeferredPgSession (a session) has an evaluate method that takes a session, which is circular and confusing. Meanwhile, Query objects (MultiQuery, etc.) also have evaluate methods. It is unclear if 'evaluate' on a session executes the query or if the query is executed by passing it to the session. The naming 'evaluate' is non-standard for database operations (usually 'execute' or 'run').
- Duplicate registration logic with different signatures. The base IChangeManager has register/unregister by object, while IChangeManager (in dag_change_typed) adds register_by_type/unregister_by_type. This creates two ways to achieve similar goals (registering an observer for a subject) depending on whether you have the instance or just the type string. It fragments the API surface.
- Inconsistent return types for 'execute'. IMultiQuerier and MultiQueryBase return Deferred[Row | None] (a single row or none), while IDeferredCursor, IDeferredConnection, CursorCollector, and ConnectionCollector return a Cursor/Collector object (IDeferredCursor[Row] or CursorCollector[Row]). This suggests two different execution models: one-shot execution vs. cursor-based execution, but they share the same method name and signature structure, leading to confusion about whether to fetch rows immediately or iterate.
Architecture
- Unchanged — 0 containers · 1 contexts · 0 edges
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
krew-solutions/ascetic-ddd-python 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 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit d6ad0129409cc8218652f12b97683f6a394bb833 — the exact code this score is about.
- Scored under rubric-2026.10.5 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer measure-2026.10.3+preprod-fddbc92cb8df.