Metadata-Version: 2.4
Name: GeneralManager
Version: 0.19.2
Summary: Modular Django-based data management framework with ORM, GraphQL, fine-grained permissions, rule validation, calculations and caching.
Author-email: Tim Kleindick <tkleindick@yahoo.de>
License: MIT License
        
        Copyright (c) 2025 Tim Kleindick
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/TimKleindick/general_manager
Project-URL: Documentation, https://timkleindick.github.io/general_manager/
Project-URL: Repository, https://github.com/TimKleindick/general_manager
Project-URL: Issues, https://github.com/TimKleindick/general_manager/issues
Project-URL: Changelog, https://github.com/TimKleindick/general_manager/releases
Keywords: django,orm,graphql,permissions,validation,caching,framework
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: asgiref>=3.8.1
Requires-Dist: channels>=4.1.0
Requires-Dist: Django>=5.2.7
Requires-Dist: django-simple-history>=3.8.0
Requires-Dist: exrex>=0.12.0
Requires-Dist: factory_boy>=3.3.3
Requires-Dist: Faker>=37.1.0
Requires-Dist: flexcache>=0.3
Requires-Dist: flexparser>=0.4
Requires-Dist: gitdb>=4.0.12
Requires-Dist: GitPython>=3.1.41
Requires-Dist: graphene>=3.4.3
Requires-Dist: graphene-django>=3.2.3
Requires-Dist: graphql-core>=3.2.6
Requires-Dist: graphql-relay>=3.2.0
Requires-Dist: numpy>=2.2.5
Requires-Dist: Pint>=0.24.4
Requires-Dist: platformdirs>=4.3.7
Requires-Dist: promise>=2.3
Requires-Dist: python-dateutil>=2.9.0.post0
Requires-Dist: six>=1.17.0
Requires-Dist: smmap>=5.0.2
Requires-Dist: sqlparse>=0.5.3
Requires-Dist: text-unidecode>=1.3
Requires-Dist: typing_extensions>=4.13.2
Requires-Dist: tzdata>=2025.2
Dynamic: license-file

# GeneralManager

[![PyPI](https://img.shields.io/pypi/v/GeneralManager.svg)](https://pypi.org/project/GeneralManager/)
[![Python](https://img.shields.io/pypi/pyversions/GeneralManager.svg)](https://pypi.org/project/GeneralManager/)
[![Build](https://github.com/TimKleindick/general_manager/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/TimKleindick/general_manager/actions/workflows/test.yml)
[![Coverage](https://img.shields.io/codecov/c/github/TimKleindick/general_manager)](https://app.codecov.io/gh/TimKleindick/general_manager)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

## Overview

GeneralManager helps teams ship complex, data-driven products on top of Django without rewriting the same plumbing for every project. It combines domain modelling, GraphQL APIs, calculations, and permission logic in one toolkit so that you can focus on business rules instead of infrastructure.

## Documentation

The full documentation is published on GitHub Pages: [GeneralManager Documentation](https://timkleindick.github.io/general_manager/). It covers tutorials, concept guides, API reference, and examples.

## Key Features

- **Domain-first modelling**: Describe rich business entities in plain Python and let GeneralManager project them onto the Django ORM.
- **GraphQL without boilerplate**: Generate a complete API, then extend it with custom queries and mutations when needed.
- **Attribute-based access control**: Enforce permissions with `ManagerBasedPermission` down to single fields and operations.
- **Deterministic calculations**: Ship reusable interfaces e.g. for volume distributions, KPI calculations, and derived data.
- **Factory-powered testing**: Create large, realistic datasets quickly for demos, QA, and load tests.
- **Composable interfaces**: Connect to databases, spreadsheets, or computed sources with the same consistent abstractions.

## Quick Start

### Installation

Install the package from PyPI:

```bash
pip install GeneralManager
```

### Minimal example

```python
from datetime import date
from typing import Optional

from django.db.models import CharField, DateField

from general_manager import GeneralManager
from general_manager.interface.database import DatabaseInterface
from general_manager.measurement import Measurement, MeasurementField
from general_manager.permission import ManagerBasedPermission


class Project(GeneralManager):
    name: str
    start_date: Optional[date]
    end_date: Optional[date]
    total_capex: Optional[Measurement]

    class Interface(DatabaseInterface):
        name = CharField(max_length=50)
        start_date = DateField(null=True, blank=True)
        end_date = DateField(null=True, blank=True)
        total_capex = MeasurementField(base_unit="EUR", null=True, blank=True)

    class Permission(ManagerBasedPermission):
        __read__ = ["public"]
        __create__ = ["isAdmin"]
        __update__ = ["isAdmin"]


Project.Factory.createBatch(10)
```

The example above defines a project model, exposes it through the auto-generated GraphQL schema, and produces ten sample records with a single call. The full documentation walks through extending this setup with custom rules, interfaces, and queries.

## Core Building Blocks

- **Entities & interfaces**: Compose domain entities with database-backed or computed interfaces to control persistence and data flows.
- **Rules & validation**: Protect your data with declarative constraints and business rules that run automatically.
- **Permissions**: Implement attribute-based access control with reusable policies that match your organisation’s roles.
- **GraphQL layer**: Serve a typed schema that mirrors your models and stays in sync as you iterate.
- **Caching & calculations**: Use the built-in caching decorator and calculation helpers to keep derived data fast and reliable.

## Production-Ready Extras

- Works with Postgres, SQLite, and any database supported by Django.
- Plays nicely with CI thanks to deterministic factories, typing, and code coverage.
- Ships with MkDocs documentation, auto-generated API reference, and a growing cookbook of recipes.
- Designed for teams: opinionated defaults without blocking custom extensions or overrides.

## Use Cases

- Internal tooling that mirrors real-world workflows, pricing models, or asset hierarchies.
- Customer-facing platforms that combine transactional data with live calculations.
- Analytics products that need controlled data sharing between teams or clients.
- Proof-of-concept projects that must scale into production without a rewrite.

## Requirements

- Python >= 3.12
- Django >= 5.2
- Additional dependencies (see `requirements/base.txt`):
  - `graphene`
  - `numpy`
  - `Pint`
  - `factory_boy`
  - and more.

## License

This project is distributed under the **MIT License**. For further details see the [LICENSE](./LICENSE) file.
