Skip to content
heliaAOT
HELIA HUB

context

Explicit registry context binding every extension point of one conversion.

A conversion resolves parsers, operator classes, transforms and option classes through a RegistryContext rather than module-level globals, so callers can extend or replace built-ins per conversion without cross-test leakage.

Machine-readable model

class

The five registries a conversion dispatches through.

helia_aot/registry/context.py:26

RegistryBundle(
litert_model_hooks: Registry[str, LiteRtModelHook],
litert_parsers: Registry[AirOpType | str, OpParserFn],
aot_operator_classes: Registry[AirOpType | str, type[AotOperator]],
transforms: Registry[str, type[AirTransform]],
air_options: Registry[AirOpType | str, type[AirOperatorOptions]],
) -> None

dataclass

The five registries a conversion dispatches through.

class

Mutable view over a RegistryBundle with a freeze latch.

helia_aot/registry/context.py:45

RegistryContext(bundle: RegistryBundle)

Mutable view over a RegistryBundle with a freeze latch.

Exposes each registry as an attribute and freezes or unfreezes them together, so a context handed to a conversion cannot be mutated once the built-ins and any customizers have been registered.

function

Build an isolated set of built-ins, apply customizers, then optionally freeze.

helia_aot/registry/context.py:112

build_default_registry_context(
*,
customizers: list[Callable[[RegistryContext], None]] | None = None,
allow_override: bool = False,
freeze: bool = True,
) -> RegistryContext

Build an isolated set of built-ins, apply customizers, then optionally freeze.

Parameters of build_default_registry_context
NameTypeDefaultDescription
customizerslist[Callable[[RegistryContext], None]] | NoneNoneFunctions receiving the mutable context after built-ins are registered. Use the same canonical key for a custom parser, AIR operation and AOT operator class.
allow_overrideboolFalsePermit customizers to replace or remove built-in entries. The default rejects either change while allowing new keys.
freezeboolTrueFreeze all registries after customization so conversion cannot accidentally mutate registration. Defaults to true.
Returns of build_default_registry_context
TypeDescription
RegistryContextA fresh context; registrations are not shared with other conversions.
Errors raised by build_default_registry_context
TypeDescription
RuntimeErrorA customizer replaces or removes a built-in while ``allow_override`` is false. Exceptions from customizers propagate.