Structured Configs use Python dataclasses to describe your configuration structure and types. They enable:
- Runtime type checking as you compose or mutate your config
- Static type checking when using static type checkers (mypy, PyCharm, etc.)
Structured Configs supports:
- Primitive types (
- Nesting of Structured Configs
- Containers (List and Dict) containing primitives or Structured Configs
- Optional fields
Structured Configs Limitations:
Uniontypes are not supported (except
- User methods are not supported
There are two primary patterns for using Structured configs
- As a config, in place of configuration files (often a starting place)
- As a config schema validating configuration files (better for complex use cases)
With both patterns, you still get everything Hydra has to offer (config composition, Command line overrides etc). This tutorial covers both. *Read it in order*.
Hydra supports OmegaConf's Structured Configs via the
This tutorial does not assume any knowledge of them.
It is recommended that you visit the OmegaConf Structured Configs page to learn more later.