Skip to main content

Shared infrastructure (typed exceptions, central config, structured logging + tracing) for MGF projects

Project description

mgf-common

PyPI version Python versions License: MIT Typed: PEP 561

The cornerstone library for the Magogi ecosystem. Typed exceptions + layered configuration + structured logging + OTel + crash reporting + vault + process management + FastAPI/Django/ alembic adapters — bundled into one PEP 561 typed package so every Magogi project (and any compatible consumer) inherits the same shape.

Status: pre-1.0 (current 0.24.0). API stable enough that three real consumers (VManager Qt desktop, inthewords Django, PlasmaMapper FastAPI) ship with it. Public names are experimental per AP-11; promoted to stable after one full MINOR cycle without a 🔴 Blocker filed against them.


Pick your starting point

The docs are organised by audience. Pick one:

If you are… Read
Evaluating mgf-common (right library for me?) docs/audience/shoppers.md
Building with it (already adopted) docs/audience/users.md
Contributing or designing alongside docs/audience/developers.md
A test/QA engineer docs/audience/qa.md
Cutting releases / running CI docs/audience/release.md
Doing a security review docs/audience/security.md
An AI agent (Claude or other) docs/audience/ai-agents.md

If you don't fit any of these neatly: docs/audience/README.md is the meta-routing index.

If you just want to try it: see docs/tutorial.md (zero → working app in ~30 minutes).


At a glance

import mgf.common as mc

with mc.bootstrap(app_name="myapp", app_version="1.0") as ctx:
    # identity + logging + OTel + excepthooks all wired transactionally
    do_work()
# Clean shutdown on context-exit; LIFO rollback on any startup failure.
from mgf.common.process import Service, AllOf, PortReady, LogLineReady

with Service(
    ["postgres", "-D", str(db_dir), "-p", str(port)],
    ready=AllOf([
        PortReady("127.0.0.1", port),
        LogLineReady(r"database system is ready"),
    ]),
    timeout_s=20.0,
) as svc:
    run_my_integration_tests(port=port)
# Service stopped + process group cascaded on context-exit.

More: docs/recipes/ (17 cookbook patterns) and PUBLIC_API.md (full surface).


Top-level files

File Purpose
STARTHERE.md Two-flow navigation hub (new project vs catching up an existing one)
FEEDBACK.md Living queue of consumer-filed feedback (the relay process driver)
CHANGELOG.md Per-release short-form (Keep-a-Changelog format)
PUBLIC_API.md Full public surface, table-form
PUBLIC_API.json Auto-generated machine-readable surface
SECURITY.md Vulnerability reporting policy (per SC-12)
CONTRIBUTING.md Dev setup + the four green gates + PR process

Consumers using it today

  • VManager — Qt desktop, libvirt VM toolkit (reference consumer; co-designed)
  • inthewords — Django web app (canonical web consumer)
  • PlasmaMapper — FastAPI scientific platform ("small consumer" scope discipline)

License

MIT. See LICENSE.

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

mgf_common-0.25.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

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

mgf_common-0.25.0-py3-none-any.whl (474.7 kB view details)

Uploaded Python 3

File details

Details for the file mgf_common-0.25.0.tar.gz.

File metadata

  • Download URL: mgf_common-0.25.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mgf_common-0.25.0.tar.gz
Algorithm Hash digest
SHA256 e4dec7989078190ee730544120546ff746d89ee7399d48513864774f4bf92c6e
MD5 9b93ab246311590fafefbac55f44b0ec
BLAKE2b-256 6f32c6d0e778fd565e30aa47d47322dfbb77d038817a3c11c4a790860ebb7c8b

See more details on using hashes here.

File details

Details for the file mgf_common-0.25.0-py3-none-any.whl.

File metadata

  • Download URL: mgf_common-0.25.0-py3-none-any.whl
  • Upload date:
  • Size: 474.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for mgf_common-0.25.0-py3-none-any.whl
Algorithm Hash digest
SHA256 750fa8498b04fd052db2331c4e6df98a5f9a27762000039595166ff34c9facbd
MD5 7fdd87a49bbfde949539a4bb62ba9c89
BLAKE2b-256 91e6dd4d66cefa35d23c007c5b73b52c6011499f917cd65683adf91bed47b858

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