Documentation Index
Fetch the complete documentation index at: https://mintlify.com/alex-ber/AlexBerUtils/llms.txt
Use this file to discover all available pages before exploring further.
This module requires optional dependencies. Install them with:Required packages:
jinja2, hiyapyco >= 0.4.16.ymlparsers module is the low-level API used by init_app_conf, deploys, and optionally emails. It wraps HiYaPyCo to provide hierarchical YAML merging with Jinja2 templating, while avoiding global package-level state in HiYaPyCo itself.
HiYaPyCo
Extended subclass ofhiyapyco.HiYaPyCo. Holds the Jinja2 context and lock used by all load/dump operations in this module.
Class attributes
| Attribute | Type | Description |
|---|---|---|
jinja2ctx | jinja2.Environment | None | Jinja2 environment used for variable interpolation. Set by initConfig(). |
jinja2Lock | threading.RLock | None | Reentrant lock protecting jinja2ctx access across threads. Set by initConfig(). |
safe_dump
Serialises a Python data structure to YAML and writes it to a stream.Python data structure to serialise. Supports primitives, lists,
dict, and collections.OrderedDict.Stream to write the YAML representation to. If
None, the result is returned as a string.Additional keyword arguments forwarded to
yaml.dump_all(). Override the defaults set in initConfig().str representation of the data.
load
Loads and merges one or more hierarchical YAML files (and/or in-memory YAML strings).One or more YAML file paths or in-memory YAML strings to load and merge.
Merge strategy. One of
hiyapyco.METHOD_SIMPLE, hiyapyco.METHOD_MERGE, or hiyapyco.METHOD_SUBSTITUTE. Default: METHOD_SUBSTITUTE.Whether to merge lists across files. Default:
False (lists are replaced).Whether to apply Jinja2 variable substitution. Default:
True.Whether to cast interpolated string values to their Python types. Default:
True.File encoding. Default:
'utf-8'.Raise an error if a specified file does not exist. Default:
True.OrderedDict — merged configuration.
as_str
Returns the YAML string representation of a data structure.Python data structure to serialise. Supports primitives, lists,
dict, and collections.OrderedDict.Additional keyword arguments forwarded to
safe_dump().str — YAML representation prefixed with a newline.
DisableVarSubst
Context manager that temporarily disables Jinja2 variable substitution duringload() calls. Use this when loading the base configuration file to read raw (un-interpolated) values such as profile names.
Jinja2 environment to use. If not provided,
HiYaPyCo.jinja2ctx is used. Must be provided together with jinja2Lock if supplied.Lock for synchronisation. Must be provided together with
jinja2ctx if supplied.initConfig
Initialises the module. Must be called beforeload(), safe_dump(), as_str(), or DisableVarSubst(). Call once in the main thread at application startup.
Lock used for synchronisation inside
DisableVarSubst and load(). If not supplied, a new threading.RLock is created.Keyword arguments forwarded to
jinja2.Environment(undefined=DebugUndefined, ...). A special 'globals' key is extracted and passed to Environment.globals.update(). Default global: {'uname': platform.uname}.Overrides for
load() defaults. Merged on top of:
{'method': METHOD_SUBSTITUTE, 'mergelists': False, 'interpolate': True, 'castinterpolated': True}.Overrides for
safe_dump() defaults. Merged on top of:
{'default_flow_style': False, 'sort_keys': False}.None. Idempotent when called from the main thread.