Defaults & Overrides
The configuration system uses three layers that merge in order of precedence:
- Defaults: values that apply across most usages of an application
- Configs: values that change or extend the defaults to define a runtime scenario
- Overrides: values that define exceptions for a specific run, e.g., via command-line arguments
Higher layers override lower layers, allowing flexible configuration composition.
Each layer can load values from one of these sources:
Files
Values loaded from YAML files viaload_<defaults|config|override>methods.Mappings
Values added from adictorDictConfigviaadd_<defaults|config|override>methods.Class Field Defaults
Values parsed from the field defaults of dataclasses or Pydantic models into aDictConfig, then added as a Mapping. See Class Field Defaults for details.CLI Arguments
Values parsed from command-line arguments and options into aDictConfig, then added as a Mapping. See CLI Argument Parsing for details.
While they can be used at any layer, the class field defaults work best when added to the defaults layer, while the CLI arguments work best when added to the overrides layer.