Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deep merge user config with defaults #107

Merged
merged 1 commit into from
Jan 16, 2025
Merged

Conversation

gmertes
Copy link
Member

@gmertes gmertes commented Jan 15, 2025

When merging default config with the user config, use a deep key-by-key merge instead of just updating the top level keys. If a key exists in both configs, the user config will take priority.

Example:

anemoi-inference run config.yaml --defaults defaults.yaml

# config.yaml
input: mars
output:
  grib:
    path: file.grib
    check_encoding: true
# defaults.yaml
checkpoint: checkpoint.ckpt
output:
  grib:
    encoding:
      some_key: 123
    check_encoding: false

Result:

checkpoint: checkpoint.ckpt
input: mars
output:
  grib:
    path: file.grib
    check_encoding: true
    encoding:
      some_key: 123

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.03%. Comparing base (ff2bd59) to head (762c345).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #107   +/-   ##
========================================
  Coverage    98.03%   98.03%           
========================================
  Files            3        3           
  Lines           51       51           
========================================
  Hits            50       50           
  Misses           1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gmertes gmertes merged commit 700a274 into develop Jan 16, 2025
76 of 77 checks passed
@gmertes gmertes deleted the feat/merge-defaults branch January 16, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants