# helia_aot.registry.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.

## helia_aot.registry.context.RegistryBundle

`class` · `python`

```python
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.

Source: `helia_aot/registry/context.py:26`

### helia_aot.registry.context.RegistryBundle.litert_model_hooks

`attribute` · `python`

```python
litert_model_hooks: Registry[str, LiteRtModelHook]
```

Model-level hooks run while loading a LiteRT model.

Source: `helia_aot/registry/context.py:38`

### helia_aot.registry.context.RegistryBundle.litert_parsers

`attribute` · `python`

```python
litert_parsers: Registry[AirOpType | str, OpParserFn]
```

LiteRT operator parsers, keyed by canonical op key.

Source: `helia_aot/registry/context.py:39`

### helia_aot.registry.context.RegistryBundle.aot_operator_classes

`attribute` · `python`

```python
aot_operator_classes: Registry[AirOpType | str, type[AotOperator]]
```

AOT operator classes, keyed by canonical op key.

Source: `helia_aot/registry/context.py:40`

### helia_aot.registry.context.RegistryBundle.transforms

`attribute` · `python`

```python
transforms: Registry[str, type[AirTransform]]
```

AIR transform classes, keyed by transform name.

Source: `helia_aot/registry/context.py:41`

### helia_aot.registry.context.RegistryBundle.air_options

`attribute` · `python`

```python
air_options: Registry[AirOpType | str, type[AirOperatorOptions]]
```

AIR operator option classes, keyed by canonical op key.

Source: `helia_aot/registry/context.py:42`

## helia_aot.registry.context.RegistryContext

`class` · `python`

```python
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.

Source: `helia_aot/registry/context.py:45`

### helia_aot.registry.context.RegistryContext.bundle

`attribute` · `python`

```python
bundle = bundle
```

Source: `helia_aot/registry/context.py:54`

### helia_aot.registry.context.RegistryContext.litert_model_hooks

`attribute` · `python`

```python
litert_model_hooks = bundle.litert_model_hooks
```

Source: `helia_aot/registry/context.py:55`

### helia_aot.registry.context.RegistryContext.litert_parsers

`attribute` · `python`

```python
litert_parsers = bundle.litert_parsers
```

Source: `helia_aot/registry/context.py:56`

### helia_aot.registry.context.RegistryContext.aot_operator_classes

`attribute` · `python`

```python
aot_operator_classes = bundle.aot_operator_classes
```

Source: `helia_aot/registry/context.py:57`

### helia_aot.registry.context.RegistryContext.transforms

`attribute` · `python`

```python
transforms = bundle.transforms
```

Source: `helia_aot/registry/context.py:58`

### helia_aot.registry.context.RegistryContext.air_options

`attribute` · `python`

```python
air_options = bundle.air_options
```

Source: `helia_aot/registry/context.py:59`

### helia_aot.registry.context.RegistryContext.freeze

`method` · `python`

```python
freeze() -> None
```

Source: `helia_aot/registry/context.py:61`

### helia_aot.registry.context.RegistryContext.unfreeze

`method` · `python`

```python
unfreeze() -> None
```

Source: `helia_aot/registry/context.py:68`

## helia_aot.registry.context.build_default_registry_context

`function` · `python`

```python
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**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| customizers | list[Callable[[RegistryContext], None]] \| None | None | Functions 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_override | bool | False | Permit customizers to replace or remove built-in entries. The default rejects either change while allowing new keys. |
| freeze | bool | True | Freeze all registries after customization so conversion cannot accidentally mutate registration. Defaults to true. |

**Returns**

| Name | Type | Description |
| --- | --- | --- |
|  | RegistryContext | A fresh context; registrations are not shared with other conversions. |

**Raises**

| Name | Description |
| --- | --- |
| RuntimeError | A customizer replaces or removes a built-in while ``allow_override`` is false. Exceptions from customizers propagate. |

Source: `helia_aot/registry/context.py:112`
