Fractal Repositories is an implementation of the repository pattern of Domain Driven Design (DDD) for building SOLID logic for your Python applications.
Project description
Fractal Repositories
Fractal Repositories is an implementation of the repository pattern of Domain Driven Design (DDD) for building SOLID logic for your Python applications.
Installation
pip install fractal-repositories
Development
Setup the development environment by running:
make deps
pre-commit install
Happy coding.
Occasionally you can run:
make lint
This is not explicitly necessary because the git hook does the same thing.
Do not disable the git hooks upon commit!
Usage
To get started, define an Entity you would like to store:
from dataclasses import dataclass
from fractal_repositories.core.entity import Entity
@dataclass
class DemoModel(Entity):
id: str
name: str
Next, define the generic Repository:
from abc import ABC
from fractal_repositories.core.repositories import Repository
class DemoRepository(Repository[DemoModel], ABC):
entity = DemoModel
Now choose your target storage system, e.g., Google Firestore and define the adapter:
from fractal_repositories.contrib.gcp.firestore.mixins import FirestoreRepositoryMixin
class FirestoreDemoRepository(DemoRepository, FirestoreRepositoryMixin[DemoModel]):
...
Contrib
Fractal Repositories comes with ready to use adapter mixins for:
- Django
- SQLAlchemy
- Mongo
- Google Firestore
- Elastic
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 fractal_repositories-0.0.19.tar.gz
.
File metadata
- Download URL: fractal_repositories-0.0.19.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bd4ea61dc9d8d9ae9cbd7dfab4275851be19e5f7b70e042eccedc6b17a15c41 |
|
MD5 | 7d210372c809106b9fb0318e3fbadb13 |
|
BLAKE2b-256 | e87bcac405a6676c3b6d2d80857c1d6e7a09ccb5fa0496057eb4301583295902 |
File details
Details for the file fractal_repositories-0.0.19-py3-none-any.whl
.
File metadata
- Download URL: fractal_repositories-0.0.19-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a34f9aee96e2b1256a61432846c4ba8082b057988df90d9d6533fb6b5ba83123 |
|
MD5 | c7a2bc2628a6bb23035cd4b849d395d0 |
|
BLAKE2b-256 | 833f40f9cf4cad757d69a57fc017a945ad966d909396cc813604fad2e7ca01da |