fractal-repositories


Namefractal-repositories JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/douwevandermeij/fractal-repositories
SummaryFractal Repositories is an implementation of the repository pattern of Domain Driven Design (DDD) for building SOLID logic for your Python applications.
upload_time2025-02-27 12:06:07
maintainerNone
docs_urlNone
authorDouwe van der Meij
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # 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][pypi-image]][pypi-url]
[![Build Status][build-image]][build-url]
[![Code Coverage][coverage-image]][coverage-url]
[![Code Quality][quality-image]][quality-url]

<!-- Badges -->

[pypi-image]: https://img.shields.io/pypi/v/fractal-repositories
[pypi-url]: https://pypi.org/project/fractal-repositories/
[build-image]: https://github.com/douwevandermeij/fractal-repositories/actions/workflows/build.yml/badge.svg
[build-url]: https://github.com/douwevandermeij/fractal-repositories/actions/workflows/build.yml
[coverage-image]: https://codecov.io/gh/douwevandermeij/fractal-repositories/branch/main/graph/badge.svg
[coverage-url]: https://codecov.io/gh/douwevandermeij/fractal-repositories
[quality-image]: https://api.codeclimate.com/v1/badges/2286ddcfaf5e815d61a5/maintainability
[quality-url]: https://codeclimate.com/github/douwevandermeij/fractal-repositories

## Installation

```sh
pip install fractal-repositories
```

## Development

Setup the development environment by running:

```sh
make deps
pre-commit install
```

Happy coding.

Occasionally you can run:

```sh
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:

```python
from dataclasses import dataclass

from fractal_repositories.core.entity import Entity


@dataclass
class DemoModel(Entity):
    id: str
    name: str
```

Next, define the generic Repository:

```python
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:

```python
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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/douwevandermeij/fractal-repositories",
    "name": "fractal-repositories",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Douwe van der Meij",
    "author_email": "douwe@karibu-online.nl",
    "download_url": "https://files.pythonhosted.org/packages/1e/71/57f409c21639eb38b323a5dc6f0d3cf0a269ca792e1ceee818cd1337e663/fractal_repositories-1.0.0.tar.gz",
    "platform": null,
    "description": "# Fractal Repositories\n\n> Fractal Repositories is an implementation of the repository pattern of Domain Driven Design (DDD) for building SOLID logic for your Python applications.\n\n[![PyPI Version][pypi-image]][pypi-url]\n[![Build Status][build-image]][build-url]\n[![Code Coverage][coverage-image]][coverage-url]\n[![Code Quality][quality-image]][quality-url]\n\n<!-- Badges -->\n\n[pypi-image]: https://img.shields.io/pypi/v/fractal-repositories\n[pypi-url]: https://pypi.org/project/fractal-repositories/\n[build-image]: https://github.com/douwevandermeij/fractal-repositories/actions/workflows/build.yml/badge.svg\n[build-url]: https://github.com/douwevandermeij/fractal-repositories/actions/workflows/build.yml\n[coverage-image]: https://codecov.io/gh/douwevandermeij/fractal-repositories/branch/main/graph/badge.svg\n[coverage-url]: https://codecov.io/gh/douwevandermeij/fractal-repositories\n[quality-image]: https://api.codeclimate.com/v1/badges/2286ddcfaf5e815d61a5/maintainability\n[quality-url]: https://codeclimate.com/github/douwevandermeij/fractal-repositories\n\n## Installation\n\n```sh\npip install fractal-repositories\n```\n\n## Development\n\nSetup the development environment by running:\n\n```sh\nmake deps\npre-commit install\n```\n\nHappy coding.\n\nOccasionally you can run:\n\n```sh\nmake lint\n```\n\nThis is not explicitly necessary because the git hook does the same thing.\n\n**Do not disable the git hooks upon commit!**\n\n## Usage\n\nTo get started, define an Entity you would like to store:\n\n```python\nfrom dataclasses import dataclass\n\nfrom fractal_repositories.core.entity import Entity\n\n\n@dataclass\nclass DemoModel(Entity):\n    id: str\n    name: str\n```\n\nNext, define the generic Repository:\n\n```python\nfrom abc import ABC\n\nfrom fractal_repositories.core.repositories import Repository\n\n\nclass DemoRepository(Repository[DemoModel], ABC):\n    entity = DemoModel\n```\n\nNow choose your target storage system, e.g., Google Firestore and define the adapter:\n\n```python\nfrom fractal_repositories.contrib.gcp.firestore.mixins import FirestoreRepositoryMixin\n\n\nclass FirestoreDemoRepository(DemoRepository, FirestoreRepositoryMixin[DemoModel]):\n    ...\n```\n\n## Contrib\n\nFractal Repositories comes with ready to use adapter mixins for:\n* Django\n* SQLAlchemy\n* Mongo\n* Google Firestore\n* Elastic\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Fractal Repositories is an implementation of the repository pattern of Domain Driven Design (DDD) for building SOLID logic for your Python applications.",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/douwevandermeij/fractal-repositories"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "01cd76cd89869dd89be1a4feefa797ca9347feb72b27763f41f93521b63b827a",
                "md5": "3e66c60d905b951d9e4d0ef79830053d",
                "sha256": "8bc61dc36085e8615cada2647a72448a61d931eefc798808a4c88d93073ac212"
            },
            "downloads": -1,
            "filename": "fractal_repositories-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3e66c60d905b951d9e4d0ef79830053d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 21904,
            "upload_time": "2025-02-27T12:06:05",
            "upload_time_iso_8601": "2025-02-27T12:06:05.188072Z",
            "url": "https://files.pythonhosted.org/packages/01/cd/76cd89869dd89be1a4feefa797ca9347feb72b27763f41f93521b63b827a/fractal_repositories-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1e7157f409c21639eb38b323a5dc6f0d3cf0a269ca792e1ceee818cd1337e663",
                "md5": "089b652e18692c32f3b88cef3a2b4cf0",
                "sha256": "c784141c8fbde7f3c7b6a814459dea22fad0e2901ae4091b90a2539b3b3c9620"
            },
            "downloads": -1,
            "filename": "fractal_repositories-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "089b652e18692c32f3b88cef3a2b4cf0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 27027,
            "upload_time": "2025-02-27T12:06:07",
            "upload_time_iso_8601": "2025-02-27T12:06:07.127400Z",
            "url": "https://files.pythonhosted.org/packages/1e/71/57f409c21639eb38b323a5dc6f0d3cf0a269ca792e1ceee818cd1337e663/fractal_repositories-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-27 12:06:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "douwevandermeij",
    "github_project": "fractal-repositories",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "fractal-repositories"
}
        
Elapsed time: 0.40679s