Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Facebookresearch Habitat lab Structured Config Definition

From Leeroopedia
Knowledge Sources
Domains Configuration_Management, Software_Architecture
Last Updated 2026-02-15 02:00 GMT

Overview

A typed configuration pattern using Python dataclasses to define type-safe, IDE-friendly configuration schemas for custom Habitat components.

Description

Structured Config Definition uses Python @dataclass classes that inherit from Habitat's base config classes (LabSensorConfig, MeasurementConfig, ActionConfig) to define typed configuration schemas. These dataclasses serve as the Hydra structured config for the custom component, providing default values, type validation, and IDE autocompletion.

The type field must match the registration name in the registry, linking the config to the component implementation.

Usage

Define after creating a custom component class and before wiring it into Hydra configuration. The dataclass defines what parameters are available in YAML config.

Theoretical Basis

Structured configs bridge Python types and YAML:

  1. Dataclass: Defines typed fields with defaults
  2. MISSING sentinel: Marks required fields (no default)
  3. Inheritance: Base config classes provide shared fields (type)
  4. Composition: Hydra merges structured defaults with YAML overrides
# Abstract config pattern
@dataclass
class MyConfig(BaseConfig):
    type: str = "MyComponent"  # Must match registry name
    param1: int = 10           # Optional with default
    param2: str = MISSING      # Required (no default)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment