Aggregates composition for domain driven design in Python
Project description
Pycider
Documentation is here. This code is a Python implementation of deciders based on the F# code from Jérémie Chassaing located here dddeu-2023-deciders. There was additionally a talk on this, to be found here.
Installation
You can use pip install pycider
or poetry add pycider
to install this project from PyPI.
Usage
You can create Process
or a Decider
. A simple example of this can be found under the test composition page.
Decider
Decider
is a simple state machine that seperates state changes and actions. Command
s are actions which when executed return Event
s representing the results from the actions. You can use Event
's to deterministically update the State
allowing replayability and easy serialization by only saving Event
's.
Command
s are turned intoEvent
's throughdecide()
calls.Event
's deterministically update theState
throughevolve()
calls.
Process
Process
is a simple state machine for managing a system. A system has several needs. The system given a State
should be able to resume to the next Command
, The system should be able to react to Event
changes and return Command
's for dealing with those changes. Finally the system should be able to update the State
deterministically given a Event
.
Event
's are turned intoCommand
s thrughreact()
calls.- Given a
State
, the system should be able toresume()
to the appropriateCommand
. Event
's deterministically update theState
throughevolve()
calls.
Example: How do Process and Decider work together
A Process
all about reacting to events and coordinating between Decider
's.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pycider-0.6.6.tar.gz
.
File metadata
- Download URL: pycider-0.6.6.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-47-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 949457883c000da480f26c0dd132eb2ce077b78c7e593d6d36e3d2af8d9eb8dc |
|
MD5 | 9ccbad0e6247850ca917b371f483da8d |
|
BLAKE2b-256 | e02b4fee9fcb11a13e2fbd46a0b4cc195c35c0494c29ab593ba6534c00429925 |
Provenance
File details
Details for the file pycider-0.6.6-py3-none-any.whl
.
File metadata
- Download URL: pycider-0.6.6-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.3 Linux/6.8.0-47-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 702a88e9fa2e31266624b3fae21953cbd499634c1e82fe548879496c71d3644d |
|
MD5 | 4267a697b1bc10e968fd93955f59a053 |
|
BLAKE2b-256 | b294b221ca87301f6688e45fdee83c5a03c0655582711365c00af91b04fa4c8a |