smileyface/smileyface/context.py
Mathew Sir Guest the best 709e6f25fa refactor: replace configobj spec with pydantic-settings and Click CLI
Drop the config.spec/configobj configuration in favour of an
AppSettings pydantic-settings model (settings.py) loaded from
SMILEYFACE_-prefixed env vars or a .env file. Introduce AppContext
(context.py) to carry settings plus logging, dispatch commands through
a Click CLI (cli.py), and centralise log setup (logging_setup.py).
Update hub_machine, datalayer, and scraping modules to consume the new
context. Add .env.example and ignore .env.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 19:43:38 -06:00

17 lines
388 B
Python

import logging
from smileyface.settings import AppSettings
class AppContext:
def __init__(self, settings: AppSettings):
self.settings = settings
self.log = _LoggerDict()
class _LoggerDict:
"""Dict-like logger access: ctx.log["ut4"] -> logging.getLogger("ut4")"""
def __getitem__(self, name: str) -> logging.Logger:
return logging.getLogger(name)