Meator
Python CQRS pattern implementation.
Installation
pip install meator
Available
- Dispatchers:
- Command
- Query
- Observers:
- Event
- Entities:
- Command
- Event
- Query
- Middlewares
Usecases
Command/Event/Query
from dataclasses import dataclass
from meator.dispatchers import CommandDispatcherImpl
from meator.entities import Command
from meator.interfaces import CommandHandler
@dataclass
class IntCommand(Command[int]):
answer: int
class IntCommandHandler(CommandHandler[IntCommand, int]):
async def __call__(self, request: IntCommand) -> int:
return request.answer
async def main():
c = CommandDispatcherImpl()
c.register(IntCommand, IntCommandHandler())
await c.handle(IntCommand(1))
Middleware
from dataclasses import dataclass
from meator.dispatchers import CommandDispatcherImpl
from meator.entities import Command, Request
from meator.interfaces import CommandHandler, Handler, Middleware
class SimpleMiddleware(Middleware):
async def __call__(self, call_next: Handler, request: Request):
return await call_next(request)
@dataclass
class IntCommand(Command[int]):
answer: int
class IntCommandHandler(CommandHandler[IntCommand, int]):
async def __call__(self, request: IntCommand) -> int:
return request.answer
async def main():
c = CommandDispatcherImpl(middlewares=[SimpleMiddleware()])
c.register(IntCommand, IntCommandHandler())
await c.handle(IntCommand(1))
Tests
pytest tests
Additional
Inspired by didator
Metadata
Release files for meator 2.0.1
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 | Actions |
|---|---|---|---|---|
| meator-2.0.1.tar.gz | 7.2 kB | Without provenance | Details for meator-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| meator-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for meator-2.0.1-py3-none-any.whl |
Total release size: 21.3 kB
Release files / meator-2.0.1.tar.gz
| Download URL | meator-2.0.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82f1b0aededcaa985191c4aa66788e95fb40fecbf765565001aeca5cb1a2557f
|
|
BLAKE2b-256 checksum How to use checksums |
1632c33cd5516f8bbb0ccd20308a242326230057a690acd9f3fa2904e67fe7df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Linux/6.9.9-arch1-1
|
Release files / meator-2.0.1-py3-none-any.whl
| Download URL | meator-2.0.1-py3-none-any.whl |
|---|---|
| Size | 14.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a86851c8248830fd96f199382a16ceda3088c0903be645a6675ebbfcf2cab796
|
|
BLAKE2b-256 checksum How to use checksums |
be5e2fee9a3432c2a72721927d4373d729655582a855274bf3f7cdead70295ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.4 Linux/6.9.9-arch1-1
|
Security for meator 2.0.1
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.