User Guide#
- Introduction: ConfigReader
- The first step is to create a configs folder containing a main config file: config.yml.
- The second step is to create a ConfigReader object.
- The main config file can be read with the .read method of the ConfigReader class.
- The main config can be updated with a user config dictionary.
- The main config can be updated with a user config file (.yml, .yaml, .json).
- Command Line Interface
- Merge & Replace
- Config values can be merged or replaced with @replace(true|false).
- Dictionaries will be merged by default (@replace(false)).
- Dictionaries can be replaced by @replace(true).
- List will be replaced by default (@replace(true)).
- List can be merged with @replace(false).
- Updating with type difference will always result in a replace.
- Interpolation: build_config
- Config files (.yml, ‘.yaml’, and ‘json’) can be interpolated in a config
- Config values can be interpolated in a config by referencing with $(key) and building the config with build_config
- Environment variables can be interpolated by using ${$env.VAR}
- Python objects can be interpolated by using ${$module.Object}
- String values can be interpolated in a config by referencing with $(key) and building the config with build_config
- Dependency Injection
- To use dependency injection in our config we first need to setup a project with object dependencies.
- Objects can be build with build_config when using the *object key.
- Dependency Injection can be done by object interpolation.
- Interpolation of objects is done by object reference.
- Object attribute interpolation is possible via accesing attributes of object references.