Skip to main content

Modular Django-based data management framework with ORM, GraphQL, fine-grained permissions, rule validation, calculations and caching.

Project description

GeneralManager

PyPI Python Build Coverage License: MIT

GeneralManager is a typed, declarative framework for building data-rich Django applications. Define domain objects once, then use the same model through the Django ORM, generated GraphQL, permission policies, validation, calculations, search, and workflows.

GeneralManager is pre-1.0. The main branch and latest PyPI release can differ; use the release history to distinguish published behavior from current development.

What GeneralManager provides

Domain models and interfaces

Start with the architecture overview and interface concepts.

APIs, permissions, and validation

Data and operations

Development and optional integrations

Compatibility

  • Python 3.12 or newer
  • Django 5.2.15 or newer
  • CI exercises Python 3.12, 3.13, and 3.14 on SQLite

GeneralManager builds on Django's database layer, but this project only claims backend support covered by its tests or maintained examples. SQLite, PostgreSQL, and MariaDB are exercised by CI and are fully supported. Other Django-supported backends may work, but are not currently claimed as supported by GeneralManager.

Five-minute setup

Start in an empty directory. On macOS or Linux:

mkdir general-manager-demo
cd general-manager-demo
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install GeneralManager
django-admin startproject gm_demo .
python manage.py startapp projects

Append the following to gm_demo/settings.py:

INSTALLED_APPS += [
    "general_manager",
    "projects.apps.ProjectsConfig",
]

AUTOCREATE_GRAPHQL = True
GRAPHQL_URL = "graphql/"
ALLOWED_HOSTS = ["127.0.0.1", "localhost", "testserver"]

Create projects/managers.py:

from typing import ClassVar

from django.db.models import CharField

from general_manager import GeneralManager
from general_manager.interface import DatabaseInterface
from general_manager.permission import AdditiveManagerPermission


class Project(GeneralManager):
    name: str

    class Interface(DatabaseInterface):
        name = CharField(max_length=100)

    class Permission(AdditiveManagerPermission):
        __read__: ClassVar[list[str]] = ["public"]
        __create__: ClassVar[list[str]] = ["isAuthenticated"]
        __update__: ClassVar[list[str]] = ["isAuthenticated"]
        __delete__: ClassVar[list[str]] = ["isAuthenticated"]

GeneralManager discovers managers.py modules in installed Django applications during startup, so no manual import in AppConfig.ready() is needed. Create the generated model's migration, initialize the database, and seed one demo record:

python manage.py makemigrations projects
python manage.py migrate
python manage.py shell -c 'from projects.managers import Project; Project.Factory.create(name="Apollo")'
python manage.py runserver

Project.Factory.create(...) is intended here for demo seeding. Application writes should run through an authenticated permission context.

In another terminal, retrieve the record through generated GraphQL. This GET request is copyable without a CSRF token:

curl --get 'http://127.0.0.1:8000/graphql/' \
  --data-urlencode 'query=query { projectList { items { name } } }'

Expected response:

{"data":{"projectList":{"items":[{"name":"Apollo"}]}}}

You now have a typed manager, generated Django model, migration, persisted record, permission policy, and generated GraphQL query. Continue with the annotated quickstart for Windows activation, framework behavior, and troubleshooting.

Documentation

Project links

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generalmanager-0.64.4.tar.gz (694.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generalmanager-0.64.4-py3-none-any.whl (830.9 kB view details)

Uploaded Python 3

File details

Details for the file generalmanager-0.64.4.tar.gz.

File metadata

  • Download URL: generalmanager-0.64.4.tar.gz
  • Upload date:
  • Size: 694.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.13

File hashes

Hashes for generalmanager-0.64.4.tar.gz
Algorithm Hash digest
SHA256 8c5912045065fcd3aecfacb8e13ed70216620e7ebe0cb05ca24d701e224c7ed1
MD5 21475ae99eeed561b0478fd61fbbe3e2
BLAKE2b-256 dc3f633a59e94a89b68206a253dde27c229487cd0f505be7d7f14dd5aa43942e

See more details on using hashes here.

File details

Details for the file generalmanager-0.64.4-py3-none-any.whl.

File metadata

  • Download URL: generalmanager-0.64.4-py3-none-any.whl
  • Upload date:
  • Size: 830.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.13

File hashes

Hashes for generalmanager-0.64.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e501c440ada8d2fa3a39de0bf8887bb7b102e6df82a6131c35be62b4bc46b371
MD5 db9557ef4f44326cd2e0dd30c2517db3
BLAKE2b-256 54ff9d296243914b999fcf9861849a3beb475b0965868b20e02747421f67f69b

See more details on using hashes here.

Supported by

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