Skip to content

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

Lightweight registry for named constructors.

METHOD DESCRIPTION
register

Decorator that registers a class or function under name.

get

Return a registered object by name, or None if missing.

register

register(name: str = None) -> Callable

Decorator that registers a class or function under name.

get

get(name: str) -> Type

Return a registered object by name, or None if missing.

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

register(name: str = None, *, registry=REGISTRY) -> Callable

Decorator that registers a class or function in the given registry (default: global).