kd.konfig.imports

kd.konfig.imports#

kauldron.konfig.imports(*, lazy: bool = False) Iterator[None][source]

Contextmanager which replace import statements by configdicts.

Usage:

with konfig.imports():
  import xyz.abc as a0

a0.MyClass(x=123) == configdict.ConfigDict(
    x=123,
    __qualname__='xyz.abc.MyClass',
)
Parameters:

lazy – If True, import won’t be directly executed, but only resolved when calling konfig.resolve. This allow to import the config even when some dependencies are missing.

Yields:

None