Skip to main content

Event Sourcing library using python

Project description

Event Sourcing with Python

Libray for python developers to help use of Event Sourcing Architecture for the persistence layer

Installation

This library is published in pypi, so you can install with pip:

pip install evsrc

Usage

The library has two main interfaces to implement at its application layer:

  • Aggregate: Every change in the aggregate is done by one event (ChangeEvent) and can notify it to any external observer.
  • ChangeEvent: The events shall implement a method apply_on where the argument is the aggregate and changes the state of it. It is recommended to be inside the class (yes, python allows that).

The persistence has been modeled as files in file systems. The events and snapshots of aggregates are stored as files. For this purpose, the developer should implement these interfaces or ports:

  • FileSystem: The units of storage are files (or file-like). This interface not only can be implemented with a operating system filesystem, but azure storage, amazon s3, redis,...
  • AggregateParser: Encode to bytes lists of aggregates and the inverse function(decode). It is recommended one by aggregate type.
  • EventBatchParser: Encode to bytes lists of EventRecords and the inverse function(decode). It is recommended one by aggregate type.

There are some apapters for the ports already implemented and available to developer:

  • InMemFileSystem: implementation in memory, useless unless you'll want quick integration tests.
  • PickleAggregateParser, PickleEventBatchParser: The parsing use pickle library to encoding and decoding bytes. Very easy!!!
  • JsonAggregateParser, JsonEventBatchParser: The parsing use json library to encoding and decoding bytes. Very important the concept of JDict which is a dict with string as keys and only jsonable tokens(bool, str, int, float, lists, jdict). It needs to embed

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evsrc-4.0.5.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evsrc-4.0.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file evsrc-4.0.5.tar.gz.

File metadata

  • Download URL: evsrc-4.0.5.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.7 Linux/6.17.5-arch1-1

File hashes

Hashes for evsrc-4.0.5.tar.gz
Algorithm Hash digest
SHA256 e5ec31a06f1f0fbf719ecaa47ae878e17bdcd4835b539d039a60d9296a22ab02
MD5 386cec73b8067f8a289a11e71ca649b4
BLAKE2b-256 ac607e83f7ace24cf02460d978ea4601cd20d1c314906f2ad10570553bcfb586

See more details on using hashes here.

File details

Details for the file evsrc-4.0.5-py3-none-any.whl.

File metadata

  • Download URL: evsrc-4.0.5-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.13.7 Linux/6.17.5-arch1-1

File hashes

Hashes for evsrc-4.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 beb98f755497fd24910d585af625c0f32aedfca7b917e7fce186e0f1f08812b2
MD5 5c6cb42a8384466f805063dacd9a3325
BLAKE2b-256 f5cbbb0e058ee31376aacbd6d88cae1008e55301ee41e6016ca128d746e3ff0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page