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.17.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

fractal_repositories-0.0.17-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for fractal_repositories-0.0.17.tar.gz
Algorithm Hash digest
SHA256 cfd82610ad9981b5ae4b6b8e76a512928924fd0145530512c67092c869bff1a5
MD5 0306763c2e2721642c1f377952c646ac
BLAKE2b-256 16a9dd9ec3d750840235586311f38722bf66d9ac51287755f9cdd659c09af443

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fractal_repositories-0.0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 84bbcf60e51fd33e5710b4679979b983533498ac958bff66e08d2abac60de602
MD5 3342a1c600379d8bd8ace7c78e69f2c9
BLAKE2b-256 e7d2b5732551ac0f7d501cf4d324962fe1989ae68b35d9bc913f945f48d7c7fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page