Working with physicalai.config
Runtime owns src/physicalai/config/. Physical AI Studio should import this
package from physicalai, not copy it under library/.
Workflow
- Pick the API
- Portable YAML recipes (robots, cameras, exported components):
Configand@export_config. - Known Python types (trainers, dataclass configs, CLI models): jsonargparse
(
ArgumentParser,add_class_arguments,parse_object,instantiate).
- Portable YAML recipes (robots, cameras, exported components):
- Author a recipe —
class_path+init_args; nest recipes only for trusted local config. Seedocs/how-to/config/instantiate-components.md.- Done when: dict/YAML passes validation without
ConfigError.
- Done when: dict/YAML passes validation without
- Export live objects —
@export_config, thenConfig.from_instance(obj)andConfig.save(). Only trusted local sources.- Done when: saved YAML reloads with
instantiate()in tests.
- Done when: saved YAML reloads with
- Typed construction — use jsonargparse in the owning package (runtime CLI,
inference, and so on). Avoid new generic loaders under
physicalai.config. - Document and test — update
docs/explanation/configuration.mdordocs/how-to/config/; extendtests/unit/config/.
Validation loop
uv run pytest tests/unit/config/ -q
prek run ruff-check --all-files
Required checks
- Deeply nested config hits
_MAX_CONFIG_DEPTHand raisesConfigError. class_pathcomes only from trusted local config (docs/development/security.md).- Studio imports
Configfrom runtime, not a duplicate tree in the library.
References
docs/explanation/configuration.mddocs/how-to/config/instantiate-components.mdtests/unit/config/