Laco vs hydra-zen
Laco vs hydra-zen
Quick mapping of hydra-zen APIs to their Laco counterparts.
| hydra-zen | Laco | Notes |
|---|---|---|
builds(Cls, **kw) | L.call(Cls)(**kw) | Both produce DictConfig{_target_: …}. Laco validates kwargs against the signature by default (strict=True). |
partial(builds(fn, **kw)) | L.partial(fn)(**kw) | Emits _partial_: true. Laco returns functools.partial[R] statically. |
just(obj) | L.just(obj) | Wrap a non-instantiable value. Both emit an identity node. |
MISSING | L.required[T]() | L.required[float]() types as float; MISSING types as str. |
make_config(a=1, b=2) | @L.config class S: a: int = 1; b: int = 2 | @L.config is a dataclass; pyright gives accurate field types. |
ZenStore / store(Cls) | class G(L.Group[T]) | Entries are class attributes; typos caught at edit time. |
zen(fn) | @L.task | Instantiates only requested config fields; leaves defaults untouched. |
@hydra.main | @laco.main(config_name=…) | Thin wrapper; applies @L.task implicitly if the function is not yet wrapped. |
instantiate(cfg) | laco.instantiate(cfg) | Delegates to hydra.utils.instantiate; passes through _PASSTHROUGH_TYPES unchanged. |
to_yaml(cfg) | laco.dump(cfg) | Strips name/version meta keys; adds _laco_: 1 version marker. |
store.add_to_hydra_store() | implicit on class declaration | Group.__init_subclass__ registers to ConfigStore on class creation. |
@hydra.main + ZenStore.add_to_hydra_store() | @laco.main(config_name=…) | Full app loop: compose + override + instantiate + call. |
Key differences
- Lie-typing contract. Laco's
L.call(T)(**kw)statically types asT(notDictConfig) so nested composition stays type-safe. hydra-zen returnsDictConfigeverywhere and relies onbuilds'spopulate_full_signaturefor validation. - No magic strings. Group names, entry names, packages, and interpolation paths are Python identities validated by pyright. hydra-zen still uses string keys in several places.
- Tracing.
L.trace(lambda: Model(encoder=Encoder(depth=24)))records a config tree from ordinary Python. hydra-zen has no direct equivalent. - CLI.
laco compose / run / showare built-in. hydra-zen defers entirely to Hydra's CLI.
Examples referenced in this table
L.call/L.partial:examples/linear_regression.pyL.just/L.required:examples/text_classifier.pyL.Group/@L.config:examples/typed/mlp.py@L.task/@laco.main:examples/pipelines/mnist_train.pyL.trace: seetests/test_trace.pyand the language module docstring