Æt (Aett) is an Event Store for Python
Aett Domain provide base classes for aggregate and saga as encapsulations of business rules and processes, respectively.
Usage
The Aggregate class is abstract and a subtype aggregate would implement the external interfaces and internal behavior
and define which events are raised as a response input.
from aett.domain.Domain import Aggregate
from dataclasses import dataclass
from aett.eventstore.EventStream import EventStream, Memento, DomainEvent
import datetime
@dataclass(frozen=True, kw_only=True)
class SampleEvent(DomainEvent):
value: int
class ExampleAggregate(Aggregate[Memento]):
def __init__(self, event_stream: EventStream, memento: Memento = None):
self.value = 0
super().__init__(event_stream, memento)
def apply_memento(self, memento: Memento) -> None:
if self.id != memento.id:
raise ValueError("Memento id does not match aggregate id")
self.value = memento.payload
def get_memento(self) -> Memento:
"""
The memento is a snapshot of the aggregate state. It is used to rehydrate the aggregate.
It is backed by the Python __getstate__ and __setstate__ methods.
"""
return Memento(id=self.id, version=self.version, payload={'key': self.value})
def set_value(self, value: int) -> None:
self.raise_event(
SampleEvent(value=value, id=self.id, version=self.version,
timestamp=datetime.datetime.now(datetime.timezone.utc)))
def _apply(self, event: SampleEvent) -> None:
"""
The apply method is a convention named method to apply the event to the aggregate. It is called from the raise_event method using multiple dispatch
"""
self.value = event.value
The saga class is likewise abstract and a subtype saga would implement the external interfaces and internal behavior,
similar to the aggregate class.
from aett.domain.Domain import Saga
from aett.eventstore.EventStream import DomainEvent
from dataclasses import dataclass
@dataclass(frozen=True, kw_only=True)
class SampleEvent(DomainEvent):
value: int
class SampleSaga(Saga):
def _apply(self, event: SampleEvent) -> None:
pass
Metadata
Release files for aett-domain 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aett_domain-2.1.0.tar.gz | 10.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aett_domain-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 27.5 kB
Release files / aett_domain-2.1.0.tar.gz
| Download URL | aett_domain-2.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0659089cd7b85f597b6cb8170ac44606e93bebdfb457d75cd7eb0f9815b12af6
|
|
BLAKE2b-256 checksum How to use checksums |
bcdceade2ea57ad91ef14e363948b674cff45e02507f920511e7110f69729c9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.7
|
Release files / aett_domain-2.1.0-py3-none-any.whl
| Download URL | aett_domain-2.1.0-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1d7a9bd3d673fc999f76ce52c9ad9bea485a095f068d42424bedb3f25b60814
|
|
BLAKE2b-256 checksum How to use checksums |
00349a1e1b683bc721645a968b687d8fa11886508e5f10ae75f7f81cd2e58429
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.7
|
Security for aett-domain 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.