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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for fractal_repositories-0.0.18.tar.gz
Algorithm Hash digest
SHA256 667355512be2b472ea3b1dca1cf2fa202186e255fd5b049d85a590f70764c1b3
MD5 e7ee9da4e70af4191c819799b81f0401
BLAKE2b-256 d0635967c955adf162a23f66e2f7684ddc62219518ccfc3ea7b8b7860a0c14c1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fractal_repositories-0.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 b1081379830f599f20323a000cdf2e41cce82b4a5d3deab001aa64d8edfbfcfe
MD5 47e88f84d1ad963b4e6a051b777101db
BLAKE2b-256 179f1eebf22f3f2f6666fc1c23038ad78515e1a4c18822cf29b13fa663af22e2

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