Skip to main content
uniac.load is the single runtime entrypoint. It takes a Service or System class, constructs an instance, validates that every annotated Node is set, and hydrates each Node’s .url from the deploy-time wiring.
from uniac import load

service = load(MySystem)

Signature

def load(spec_cls: type[T]) -> T: ...
  • Input — a Service or System class (not an instance). Passing an instance raises TypeError.
  • Output — a typed instance, with every Node hydrated.

What it does, in order

  1. Read UNIAC_INIT_* env vars. For each __init__ parameter, look for UNIAC_INIT_<UPPERCASE_NAME>. Coerce the string value to the parameter’s annotated type. Missing param + has default → use the default; missing param + no default → raise LoadError.
  2. Constructcls(**init_kwargs).
  3. Validate — calls _uniac_validate() on the result (see NodeSpec).
  4. Hydrate Nodes — reads UNIAC_DEPS_JSON and writes each Node’s _uniac_url.

Supported init-parameter types

str, int, float, bool. Any other annotation, or a parameter with no annotation, raises LoadError. Bool coercion is case-insensitive: "true" | "1" | "yes" | "on" are truthy; anything else is false.

Raises

ExceptionWhen
LoadErrorRequired env var missing; unsupported init type; bad value.
UniacValidationErrorAnnotated Node slot unset or wrong type.
TypeErrorspec_cls is not a class, or not a NodeSpec subclass.