Server status ...

magogi/prod/: mgf-django-0.4.10 metadata and description

Simple index

Django integration adapters for mgf-common — AppConfig + middleware (request-id, context) + JsonFormatter + DjangoSettingsBridge. Sibling of mgf-common under the mgf.* namespace.

author Bassam Alsanie, mgf-django contributors
classifiers
  • Development Status :: 3 - Alpha
  • Framework :: Django
  • Intended Audience :: Developers
  • License :: OSI Approved :: Apache Software License
  • Operating System :: MacOS
  • Operating System :: Microsoft :: Windows
  • Operating System :: POSIX :: Linux
  • Programming Language :: Python :: 3
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: 3.12
  • Programming Language :: Python :: 3.13
  • Topic :: Software Development :: Libraries
  • Typing :: Typed
description_content_type text/markdown
keywords appconfig, django, json-formatter, logging, middleware, request-id
license Apache-2.0
license_file
  • LICENSE
  • NOTICE
project_urls
  • Homepage, https://codeberg.org/magogi-admin/mgf-django
  • Issues, https://codeberg.org/magogi-admin/mgf-django/issues
  • Changelog, https://codeberg.org/magogi-admin/mgf-django/src/branch/main/CHANGELOG.md
requires_dist
  • django>=4.2
  • mgf-common<1.0,>=0.41
  • import-linter>=2.0; extra == 'dev'
  • mgf-test-supervisor<0.2,>=0.1.3; extra == 'dev'
  • mypy>=1.10; extra == 'dev'
  • pytest-cov>=5.0; extra == 'dev'
  • pytest-timeout<3,>=2.3; extra == 'dev'
  • pytest>=8.0; extra == 'dev'
  • ruff<0.16,>=0.4; extra == 'dev'
  • mgf-common[standards]<1.0,>=0.46; extra == 'standards'
requires_python >=3.11

Because this project isn't in the mirror_whitelist, no releases from root/pypi are included.

File Tox results History
mgf_django-0.4.10-py3-none-any.whl
Size
24 KB
Type
Python Wheel
Python
3
mgf_django-0.4.10.tar.gz
Size
180 KB
Type
Source

mgf-django — Django integration adapters for mgf-common consumers

Registry Python

Shape: Federation sibling of mgf-common. The current mgf-common pin window is shown in this package's Codeberg registry — sourced from pyproject.toml at release time, so this README can't go stale. (Per v2.6 DOC-01 / project-shape taxonomy. PAPER-38.)

Sibling of mgf-common under the mgf.* namespace. Houses the Django-specific adapters that previously lived under mgf.common.django.* — extracted at mgf-common v0.31 / mgf-django v0.1 per the federation split plan.

What this provides

Submodule What
mgf.django MgfCommonConfig — Django AppConfig that runs mgf.common.bootstrap() once at app-registry build. MgfRequestIdMiddleware + MgfContextMiddleware — sync-mode middleware sharing the same contextvar as mgf.fastapi.RequestIdMiddleware for cross-framework request-id correlation. JsonFormatter — no-arg wrapper for Django's LOGGING['formatters'] '()': '...' factory syntax. DjangoSettingsBridge — read-only BaseAppSettings view over django.conf.settings (so mgf-common explain works for Django apps).

Eight public names. The closed-box adapter shape: your manage.py, settings.py, and views remain unchanged; you add one entry to INSTALLED_APPS and two to MIDDLEWARE.

Install

pip install mgf-django

Pulls in mgf-common + django>=4.2 automatically.

Quick start — typical Django settings.py addition

# settings.py
INSTALLED_APPS = [
    # ... your apps ...
    "mgf.django",
]

MIDDLEWARE = [
    "mgf.django.MgfRequestIdMiddleware",  # earliest
    "mgf.django.MgfContextMiddleware",
    # ... your other middleware ...
]

LOGGING = {
    "version": 1,
    "formatters": {
        "json": {"()": "mgf.django.JsonFormatter"},
    },
    "handlers": {
        "console": {
            "class": "logging.StreamHandler",
            "formatter": "json",
        },
    },
    "root": {"handlers": ["console"], "level": "INFO"},
}

# Optional — both default to None (auto-derived from package metadata)
MGF_COMMON_APP_NAME = "myapp"
MGF_COMMON_APP_VERSION = "1.0.0"

That's the entire integration. The AppConfig calls mgf.common.bootstrap() once when Django boots; the middlewares carry the per-request state; the formatter routes through the standard mgf-common redaction + OTel correlation pipeline.

What you get for free

App label note

The Django app label is "mgf_django" (Django labels can't contain dots). Renamed at the v0.31 sibling extraction from "mgf_common" (its name when the module lived under mgf.common.django in mgf-common ≤ v0.30). Consumer config that hardcoded the old "mgf_common" label MUST update — typical references are in AppConfig.get_app_config("mgf_common") calls or migration table- prefix configs.

Documentation

For the federation-wide engineering standards (DESIGN_PRINCIPLES, ERROR_HANDLING, SECURITY, etc.) see mgf-standard/docs/standards/. This sibling inherits them by reference; the standards source-of-truth lives in mgf-common.

Conformance: L2 per mgf-standard/docs/standards/. Per-rule audit ledger: docs/inprogress/MGF_STANDARDS_CONFORMANCE.md. L2 means every federation MUST rule applies, evidenced by the tracker.

Status

🚧 Experimental — every public name is experimental per AP-09. Promotion to stable happens release-by-release as consumer feedback in mgf-common/FEEDBACK.md converges. The 0.x window applies. Pin tightly: mgf-django = ">=0.X.0,<0.Y".

Cross-references