Terminology
Overviewβ
This page describes some of the common concepts in Hydra. Most of the concepts are described in much more details throughout the documentation.
Input Configsβ
Input configs are used to construct the config object used by the application.
Supported input configs are:
- Config Files (YAML files)
- Command line arguments
- Structured Configs (Python @dataclasses)
Primary Configβ
The input config named in @hydra.main()
or in
the Compose API
.
The Primary Config is the only config that is allowed to have a Defaults List
Structured Configβ
A @dataclass or an instance of a @dataclass that is used to construct a config. These enable both runtime and static type checking.
There are two primary patterns for using Structured configs:
- As an Input Config.
- As a schema validating Config Files and command line arguments.
@dataclass
class User:
name: str = MISSING
age: int = MISSING
Defaults Listβ
A list in the Primary Config that determines how to build the final Config Object. The list is typically composed of Config Group Options.
defaults:
- db: mysql
- schema: school
Config Groupβ
A Config Group is a mutually exclusive set of Config Group Options. Config Groups can be hierarchical and in that case the path elements are separated by a forward slash ('/') regardless of the operating system.
Config Group Optionβ
One of the configs in a Config Group.
Config Nodeβ
A Config Node is either a Value Node
(a primitive type), or a Container Node
. A Container Node
is a list or dictionary of Value Nodes
.
Packageβ
A Package is the path of the Config Node in the Config Object.
Package directiveβ
The Package Directive specifies the root Package of an Config File
Exampleβ
# @package _group_
codename: '007'
mi6:
agent:
codename: '007'
- Config Group: mi6/agent
- Config Group Option: james_bond
- Container Nodes:
{codename: '007'}
, Β . . . Β ,{mi6: {agent: {codename: '007'}}}
- Value Node: '007'
- Packages
<empty>
,mi6
,mi6.agent
,mi6.agent.codename
- Package directive :
@package _group_
, which expands tomi6.agent
Output Config Objectβ
The config for the application. It is a dictionary of Config Nodes generated from the Input Configs.
Miscβ
Config Search Pathβ
The Config Search Path is a list of paths that are searched in order to find configs. It is similar to the Python PYTHONPATH.
Pluginsβ
Plugins extend Hydra's capabilities. Some examples are Launcher and Sweeper.