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.17.tar.gz
.
File metadata
- Download URL: fractal_repositories-0.0.17.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfd82610ad9981b5ae4b6b8e76a512928924fd0145530512c67092c869bff1a5 |
|
MD5 | 0306763c2e2721642c1f377952c646ac |
|
BLAKE2b-256 | 16a9dd9ec3d750840235586311f38722bf66d9ac51287755f9cdd659c09af443 |
File details
Details for the file fractal_repositories-0.0.17-py3-none-any.whl
.
File metadata
- Download URL: fractal_repositories-0.0.17-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 | 84bbcf60e51fd33e5710b4679979b983533498ac958bff66e08d2abac60de602 |
|
MD5 | 3342a1c600379d8bd8ace7c78e69f2c9 |
|
BLAKE2b-256 | e7d2b5732551ac0f7d501cf4d324962fe1989ae68b35d9bc913f945f48d7c7fc |