Component registry
Unified component registration and introspection machinery.
User guide: Plugin introspection API · Habitat domain API · Table ML domain API.
ComponentRegistry is the base for every capability registry. Built-in
domains subclass it; plugins register via entry points habit.<domain>.
Classes
Registry for ONE component family, keyed by implementation name. |
from habit.registry import ComponentRegistry
class MyOp:
def __init__(self, alpha: float = 1.0) -> None:
self.alpha = alpha
def __call__(self, subject: object) -> object:
return subject
class MyRegistry(ComponentRegistry[MyOp]):
domain = "my_op"
MyRegistry.register("demo", MyOp)
op = MyRegistry.create("demo", alpha=2.0)
print(MyRegistry.available())
print(MyRegistry.constructor_signature("demo"))
Standard methods on every registry:
register(name, cls)create(name, **params)available()constructor_signature(name)
See Habitat domain API and Table ML domain API for the built-in registries.