Shared infrastructure (typed exceptions, central config, structured logging + tracing) for MGF projects
Project description
mgf-common
Shared infrastructure for MGF projects: typed exceptions, central
configuration (pydantic-settings), and a structured-logging +
OpenTelemetry-tracing stack. One implementation, lifted out of
VManager so other
projects can consume it directly instead of copy-pasting.
Status
Phase 2 complete (bootstrapped 2026-04-22). The three core
subpackages — exceptions, observability, config — are lifted
and tested in place; VManager cutover (Phase 3) is next. See
COMMON.md (lands in Phase 5) or
../VManager/docs/COMMON.md for the
extraction plan.
Install
Once published:
pip install mgf-common
# Optional Tier C observability (OpenTelemetry SDK + Sentry):
pip install 'mgf-common[observability]'
For local development (the Phase 5 default until PyPI publish):
# In a consumer project's pyproject.toml:
dependencies = ["mgf-common"]
[tool.uv.sources]
mgf-common = { path = "../mgf_common", editable = true }
Use
import mgf.common
# Once at startup — establishes app identity for logging, crash
# reports, OTel resource attributes.
mgf.common.configure(app_name="myapp", app_version="1.0.0")
from mgf.common.observability import setup_logging, setup_otel
setup_logging(level="INFO") # console + rotating file + opt-in journald/OTLP
setup_otel() # no-op unless OTEL_EXPORTER_OTLP_ENDPOINT is set
from mgf.common.exceptions import AppError
class MyAppError(AppError):
pass
from mgf.common.config import BaseAppSettings, load_settings, make_settings_config
class Settings(BaseAppSettings):
model_config = make_settings_config(env_prefix="MYAPP_")
backend_uri: str = "..."
# ... your fields
Standards
The cross-project engineering standards are at docs/standards/
(land in Phase 4). They cover error handling, logging, configuration,
and design principles — what every MGF-family project commits to.
Development
uv venv
uv sync --extra dev --extra observability
# Tests + lint + types + layering
pytest --tb=short -q
ruff check src tests
mypy src
lint-imports
Layout
mgf_common/
├── pyproject.toml
├── COMMON.md extraction plan + path to PyPI
├── docs/
│ └── standards/ cross-project engineering standards
├── src/
│ └── mgf/ PEP 420 namespace package (no __init__.py)
│ └── common/
│ ├── exceptions/
│ ├── config/
│ └── observability/
└── tests/
License
MIT — see LICENSE.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mgf_common-0.1.0.tar.gz.
File metadata
- Download URL: mgf_common-0.1.0.tar.gz
- Upload date:
- Size: 211.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78f2a3d81a4848484e2c67399c2500c114d0d9bb06bac9f89c210cd8abeaf08d
|
|
| MD5 |
52e6825f57ba470c432bc045bc3e9828
|
|
| BLAKE2b-256 |
11f663510e616f80a33bcba3ceef57e50e20c122010fe4dd829fd58fc76e53d7
|
File details
Details for the file mgf_common-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mgf_common-0.1.0-py3-none-any.whl
- Upload date:
- Size: 39.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
995c6d99caa8baf5b1a359584d7bb313b24325789db8217e1228807d3a99a2be
|
|
| MD5 |
d064e047070a119f54755a5857b09b66
|
|
| BLAKE2b-256 |
78da0847c79b5776781f33bff9ddce4096d221c66eb2e879326b4dc882132e78
|