API reference¶
specbuild ¶
| CLASS | DESCRIPTION |
|---|---|
Registry |
Lightweight registry for named constructors. |
| FUNCTION | DESCRIPTION |
|---|---|
build |
Build an object from a configuration mapping. |
register |
Decorator that registers a class or function in the given registry (default: global). |
Registry ¶
build ¶
build(cfg: Union[Dict, list, tuple, Any], registry: Registry | None = REGISTRY, recursive: bool = True) -> Any
Build an object from a configuration mapping.
Looks up cfg["type"] in the provided registry (or treats it as a dotted
import path), forwards keyword arguments, and recursively instantiates nested
dicts/lists when recursive is True. Use the special "*" key for positional
arguments and prefix "partial:" on the type value to return a factory
instead of calling the constructor immediately.
register ¶
Decorator that registers a class or function in the given registry (default: global).