Skip to main content
Settings machinery: the base class + the cache-reset registry. Leaf settings live next to the impl they configure (tai42_kit.llm, tai42_kit.clients, tai42_kit.logging).

TAI_DEFAULT_ENV_PREFIX

tai42_kit.settings.default_namespace.TAI_DEFAULT_ENV_PREFIX

DefaultNamespaceMixin

tai42_kit.settings.default_namespace.DefaultNamespaceMixin
Adds the TAI_DEFAULT_* per-field fallback to a settings class. Declare tai_default_fields ({field_name: default_key}) on the subclass to enable it. An empty map (the default) leaves the source pipeline untouched, so a class that mixes this in without a map behaves as one that does not. Attributes

Members

settings_customise_sources

tai42_kit.settings.default_namespace.DefaultNamespaceMixin.settings_customise_sources
Append the TAI_DEFAULT_* fallback sources beneath the specific settings sources. Parameters

KeyMaterial

tai42_kit.settings.base.KeyMaterial

ReloadClass

tai42_kit.settings.base.ReloadClass

SettingsClassInfo

tai42_kit.settings.registry.SettingsClassInfo
A registered settings class, identified by its qualified name. Attributes

SettingsFieldInfo

tai42_kit.settings.registry.SettingsFieldInfo
One env-configurable field on a settings class, as plain data. Attributes

StaleHolder

tai42_kit.settings.cache_registry.StaleHolder
A still-live cached settings instance stamped with a retired epoch. settings_type and holders are module.qualname strings (the settings class, and the type of each object still referencing the instance). Attributes

TaiBaseSettings

tai42_kit.settings.base.TaiBaseSettings
Base for env-configurable settings groups; concrete subclasses self-register. Attributes

Members

with_fallbacks

tai42_kit.settings.base.TaiBaseSettings.with_fallbacks
Return a dict with defaults added for missing keys (never override user config). Parameters

load_with_fallbacks

tai42_kit.settings.base.TaiBaseSettings.load_with_fallbacks
Parse user_config JSON (or empty) and merge it over the defaults. Parameters

not_configured_message

tai42_kit.settings.require.not_configured_message
The named-error message for an unset connection setting. default_var is the field’s TAI_DEFAULT_* alternative, named in the message when the field participates in the shared namespace; omit it for a field that only its own env var can set. Parameters

register_settings_reset

tai42_kit.settings.cache_registry.register_settings_reset
Register a hook that resets settings-derived state on global reset. Parameters

registered_settings

tai42_kit.settings.registry.registered_settings
Snapshot of every registered settings group, in registration order. Returns model copies so callers cannot mutate the registry’s internals.

require

tai42_kit.settings.require.require
The configured value, or raise the named error when it is None. Parameters

require_secret

tai42_kit.settings.require.require_secret
The secret’s plaintext, or raise on unset OR empty — fail CLOSED. A secret that gates a trust boundary must not be satisfiable by an empty value, so both the unset and the empty cases raise. Parameters

reset_all_settings

tai42_kit.settings.cache_registry.reset_all_settings
Drop every registered settings cache, then run the reset hooks.

settings_cache

tai42_kit.settings.cache_registry.settings_cache
Cache a zero-arg settings accessor, register it for reset, and epoch-stamp it. Stamping happens on the CONSTRUCTION path (cache miss), so the stamp records the epoch the instance was born under; a cached hit returns the same stamped instance, and a reset clears the cache so the next call rebuilds and re-stamps under the then-current epoch. Parameters

sweep_stale_settings

tai42_kit.settings.cache_registry.sweep_stale_settings
Report every live cached settings instance still stamped with retired_epoch. Walks the roster for instances whose stamp is the retired epoch and are still alive (a holder is keeping them past the cache clear), summarising each via gc.get_referrers. Logs ERROR naming the holders — a retired-epoch instance still reachable is a stale-config leak, never dropped silently — and returns the findings so a probe/e2e can assert zero. Parameters