Atomic-like S3 Framework with Saga Pattern, the Pydantic way
Project description
Atomic-like S3 Framework, the Pydantic way
Documentation: docs/README.md
FennFlow is a Python s3 framework designed to help you quickly, confidently, and painlessly manipulate files in your object storage implementing Saga-like compensation flow.
Why use FennFlow?
Working with aiobotocore often feels like handling raw bytes and dicts. FennFlow wraps S3 operations into a high-level
Unit of Work pattern, providing:
- Atomic-like multistep operations — if something fails, previous actions are automatically compensated (Saga Pattern).
- Clean Architecture — treat S3 as proper repositories using mixins (
PutRepository,GetRepository, etc.). - Pydantic-powered models — work with
TextContent,JsonContent,ImageContentand others instead of raw bytes.
Supported Connectors
| Connector | Description | Documentation |
|---|---|---|
| AWS S3 | s3 compatible object storage via aiobotocore | Quick start |
| In-Memory (default) | great for and tests and development | Quick start |
Supported Backends
FennFlow uses backend as a source of truth for your file storage. No matter what your file storage contains, backend ensures your data is consistent.
| Backend | Description | Documenration |
|---|---|---|
| In-Memory (default) | great for and tests, development and small projects | Quick start |
Backend Comparison
| Raw aiobotocore | In-Memory | |
|---|---|---|
| Consistency | 🔴 None No link between files and metadata |
🟡 Medium Consistent within process lifetime, lost on crash |
| Compensation | 🔴 None Orphaned files on failure |
🟡 Medium Automatic within process, orphaned files possible on crash |
| Reliability | 🔴 Low Failures leave storage in unknown state |
🟡 Medium Syncs with storage on restart, files uploaded during crash cannot be compensated |
| Latency | ✅ Lowest Pure S3 network overhead only |
✅ Lowest Minimal in-process overhead |
| Infrastructure | ✅ None | ✅ None |
| Memory usage | ✅ None | 🟡 Stores file metadata in-process |
Quick Start
Here's a minimal example of FennFlow:
import asyncio
from fennflow import ConfigDict, UnitOfWork
from fennflow.backends import InMemoryBackendConfig
from fennflow.connectors import S3ConnectorConfig
from fennflow.files import BinaryContent, JsonContent, TextContent
from fennflow.repositories import (
DeleteRepository,
GetRepository,
ListRepository,
PutRepository,
S3RepoField,
)
# 1. Define your repository with mixins
class CrudRepository(
PutRepository,
DeleteRepository,
GetRepository,
ListRepository,
):
pass
# 2. Set up your Unit of Work
class UOW(UnitOfWork):
my_files = S3RepoField(CrudRepository, bucket_name="my_files")
config = ConfigDict(
backend=InMemoryBackendConfig(),
connector=S3ConnectorConfig(),
)
async def main():
text_file = TextContent.from_content("Hello, world!")
json_file = JsonContent.from_content([1, 2, 3])
binary_file = BinaryContent(data=b"some bytes", media_type="text/plain")
async with UOW() as uow:
await uow.my_files.at("folder1").put(
text_file,
json_file,
binary_file,
)
paths = await uow.my_files.at("folder1").list()
print(paths) # ListResponse[Filepath, ...]
files = await uow.my_files.get(*paths)
print(files) # MediaResponse[TextContent, JsonContent, BinaryContent]
if __name__ == "__main__":
asyncio.run(main())
Next Steps
Read the docs to learn more about working with FennFlow.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fennflow-0.1.0.tar.gz.
File metadata
- Download URL: fennflow-0.1.0.tar.gz
- Upload date:
- Size: 182.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cadc5ac7485e017c2625d8e6a24b6a4200e46ed0f882d4ed355b0e42547dc27
|
|
| MD5 |
217a122a266e0673acbba4d625f5c0f7
|
|
| BLAKE2b-256 |
b44160e969da0b2673bb2d77fcd7ecc6aa8eecf0dd5eeaa1c26b9382e4542ee1
|
Provenance
The following attestation bundles were made for fennflow-0.1.0.tar.gz:
Publisher:
publish.yml on Alex-FIR-IT/FennFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fennflow-0.1.0.tar.gz -
Subject digest:
7cadc5ac7485e017c2625d8e6a24b6a4200e46ed0f882d4ed355b0e42547dc27 - Sigstore transparency entry: 1524705895
- Sigstore integration time:
-
Permalink:
Alex-FIR-IT/FennFlow@16e37505c6766d4509d92fe0015e96bc246ff214 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Alex-FIR-IT
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@16e37505c6766d4509d92fe0015e96bc246ff214 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fennflow-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fennflow-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4f72f43194ab2049c875f30b84deb5aa78ce60961d4331e38ed4465d09d51e2
|
|
| MD5 |
3cba41d445a9697277f1cb2c4136c823
|
|
| BLAKE2b-256 |
dce734d28188e3b21436ac8004add476cec2a31c9bb5f172a08fe0f7a4c0ce52
|
Provenance
The following attestation bundles were made for fennflow-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Alex-FIR-IT/FennFlow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fennflow-0.1.0-py3-none-any.whl -
Subject digest:
b4f72f43194ab2049c875f30b84deb5aa78ce60961d4331e38ed4465d09d51e2 - Sigstore transparency entry: 1524706084
- Sigstore integration time:
-
Permalink:
Alex-FIR-IT/FennFlow@16e37505c6766d4509d92fe0015e96bc246ff214 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Alex-FIR-IT
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@16e37505c6766d4509d92fe0015e96bc246ff214 -
Trigger Event:
push
-
Statement type: