Skip to main content

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.

PyPI Version Build Status Code Coverage Code Quality

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


Download files

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

Source Distribution

fractal_repositories-0.0.13.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

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

fractal_repositories-0.0.13-py3-none-any.whl (21.5 kB view details)

Uploaded Python 3

File details

Details for the file fractal_repositories-0.0.13.tar.gz.

File metadata

  • Download URL: fractal_repositories-0.0.13.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for fractal_repositories-0.0.13.tar.gz
Algorithm Hash digest
SHA256 39eac00b6d27c5e07636e5badfd2eff5ff70300d895fa9af17addfea7d07f9de
MD5 e3896be3c713fb1c65a882ac0dfd2be9
BLAKE2b-256 d5a44f77b3df0b0f5f8e605bb2b555bcaccdbb6ddb927d607cfb824a9b591c27

See more details on using hashes here.

File details

Details for the file fractal_repositories-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for fractal_repositories-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 c55713c8416537584fcfcb194019ad0797ccc137726e1629c4cddc00337f24b0
MD5 e64b49c95fae42a801d0550b8462f7ab
BLAKE2b-256 d201f810ac4ba90d1e884cf81327bf1b97aae1aa5b1739d15aed3dce26e75904

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