Python client for reading YAML based config files. It provides a `Config` class for retrieving configuration variables from YAML files. It allows configuration of root and directory paths via environment variables. The library is currently at version 0.1.5 and has a low-cadence release cycle, with the last PyPI release in June 2020.
pip install yaml-configVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a `Config` subclass to load a YAML file and access its properties. It shows how to define a `default_file` and access nested configurations.
Upgrade to `yaml-config` version 0.1.3 or higher, which internally defaults to `yaml.SafeLoader` to mitigate this issue. If direct `PyYAML` interaction in your application is necessary and upgrade is not possible, explicitly pass `Loader=yaml.SafeLoader` to `yaml.load()` to prevent errors and enhance security.
If you require environment variable interpolation for values inside your YAML content, consider pre-processing your YAML files (e.g., using Python's `os.path.expandvars` on the file content before passing it to `yaml-config`) or explore alternative YAML libraries that explicitly support this feature.
Always use `yaml.safe_load()` or explicitly pass `Loader=yaml.SafeLoader` when loading YAML from untrusted sources, even if `yaml-config` handles its internal loading safely.