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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for fractal_repositories-0.0.19.tar.gz
Algorithm Hash digest
SHA256 0bd4ea61dc9d8d9ae9cbd7dfab4275851be19e5f7b70e042eccedc6b17a15c41
MD5 7d210372c809106b9fb0318e3fbadb13
BLAKE2b-256 e87bcac405a6676c3b6d2d80857c1d6e7a09ccb5fa0496057eb4301583295902

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fractal_repositories-0.0.19-py3-none-any.whl
Algorithm Hash digest
SHA256 a34f9aee96e2b1256a61432846c4ba8082b057988df90d9d6533fb6b5ba83123
MD5 c7a2bc2628a6bb23035cd4b849d395d0
BLAKE2b-256 833f40f9cf4cad757d69a57fc017a945ad966d909396cc813604fad2e7ca01da

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