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.1.0.tar.gz (47.0 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.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: evsrc-4.1.0.tar.gz
  • Upload date:
  • Size: 47.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for evsrc-4.1.0.tar.gz
Algorithm Hash digest
SHA256 e77f5625ea70fa30061bb0ae4c26ae855e900bb517ba9619409e2e69d767b269
MD5 bc401f9b28ebbbbeff605277cbf611d6
BLAKE2b-256 80b41cc89d51b0e27415c99476a5ab9a4ee63d8f1792b8991bdb284901377c7f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: evsrc-4.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for evsrc-4.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ad7cfbd4bd6afbd5212626a44ee707fb0b8091a87942abbfd591c95d752e56a
MD5 9d97e77d3ac57b68eec5db8b78981c45
BLAKE2b-256 4e1ec3010eb095b0208cc22ebff2f70f3fe32f1537b5ecce59d6c61b3c0627c5

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