Commit ca6f732
fix: add package config path to Hydra search path in plugin (#656)
## Description
Fixes #570 by adding `pkg://anemoi.training/config` to the Hydra search
path via `AnemoiSearchPathPlugin`, enabling discovery of package configs
like `training/default` in the `config validate` command.
## What problem does this change solve?
**Bugfix** - The `anemoi-training config validate` command was failing
with `MissingConfigException` when configs referenced package defaults
like `training/default`.
## What issue or task does this change relate to?
Fixes #570
## Solution
Modified `AnemoiSearchPathPlugin` to append the package config path to
the Hydra search path automatically. Package configs are appended (not
prepended) to maintain user config priority.
### Changes Made
- `src/hydra_plugins/anemoi_searchpath/anemoi_searchpath_plugin.py`:
Added code to append package config path
- `tests/unit/commands/test_config.py`: Added unit tests for
validate_config functionality
### Why Plugin Approach?
This solution:
- Fixes the issue globally for all Hydra initialization
- Follows Hydra's plugin architecture pattern
- Maintains user config priority (cwd, home, env configs override
package defaults)
- Future-proofs against similar issues in new commands
### Testing
- Unit tests added and passing (3/3 tests pass)
- Manual testing confirms configs referencing package defaults now
validate
- No regressions in existing tests
### Search Path Priority
1. Current working directory configs (highest priority)
2. User home configs
3. Environment variable configs
4. Hydra built-in configs
5. Package configs (lowest priority) ← Added here
### Backwards Compatibility
No breaking changes - purely additive functionality
Co-authored-by: Harrison Cook <[email protected]>
Co-authored-by: Ana Prieto Nemesio <[email protected]>1 parent 7315e3a commit ca6f732
File tree
2 files changed
+48
-0
lines changed- training
- src/hydra_plugins/anemoi_searchpath
- tests/unit/commands
2 files changed
+48
-0
lines changedLines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
71 | 81 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
0 commit comments