Skip to main content
Version: 2.3

Resolver calls

Node interpolation reads another value in the config. A resolver call computes a value. Its syntax has a colon: ${name:arguments}. OmegaConf evaluates the call when you read the value.

For example, the built-in oc.env resolver reads an environment variable:

>>> import os
>>> from omegaconf import OmegaConf
>>> os.environ["OC_DOCS_COLOR"] = "blue"
>>> cfg = OmegaConf.create({"color": "${oc.env:OC_DOCS_COLOR}"})
>>> cfg.color
'blue'
>>> del os.environ["OC_DOCS_COLOR"]

Resolver arguments can themselves contain interpolations. Read the built-in resolver reference for available names and argument rules. To register your own Python function, see Write a custom resolver. Both node references and resolver calls can be materialized with OmegaConf.resolve().

Next, learn how structured configs validate values.