Search code examples
fb-hydra

Specializing a Hydra configuration with Explicit Nesting


I would like to have:

conf/
├── config.yaml
├── data
│   └── data.yaml
├── render
│   └── renderer.yaml
├── storage
│   └── local.yaml
└── text
    ├── font.yaml
    └── regions.yaml

Where, in the config.yaml, the text/font.yaml assigned to font and text/regions.yaml to regions, something like:


defaults:
  - font: text.font
  - regions: text.regions
  - render: renderer
  - data: data
  - storage: local

or


defaults:
  - font:
    - text/font
  - regions:
    - text/regions
  - render: renderer
  - data: data
  - storage: local

The above do not work!

Would it be possible to achieve the desired result at the yaml level somehow?


Solution

  • What you're looking for is called changing the package of your constructed config, see:

    In your case your font and regions are located under the group text, but you want to move it to the respective packages font and regions. You can move any config option to any package namespace you want by specifying <group>@<package>, i.e.:

    defaults:
      - text@font: font
      - text@regions: regions
      - render: renderer
      - data: data
      - storage: local