Skip to content

Examples

All examples are in the usage guides:

Getting Started

Common Tasks

Advanced

Local Demo Script

To validate nested metadata source tracking before publishing, run:

/workspaces/UtilityHub/.venv/bin/python examples/demo_utilityhub_config/main.py

Quick Reference

from pydantic import BaseModel
from utilityhub_config import load_settings

class Config(BaseModel):
    database_url: str = "sqlite:///default.db"
    debug: bool = False

# Basic usage
settings, metadata = load_settings(Config)

# With config file
settings, _ = load_settings(Config, config_file=Path("./prod.yaml"))

# With prefix
settings, _ = load_settings(Config, env_prefix="MYAPP")

# With overrides
settings, _ = load_settings(Config, overrides={"debug": True})

# Check source
source = metadata.get_source("database_url")
print(f"{source.source}: {source.source_path}")

← Back to Documentation