Repository navigation
Conversation
${cc.ref:KEY} returns the registry path /KEY, or null when the config
holds no value at KEY, so a config can refer to a registered model by
name and still switch an optional one off by setting it to null.
${cc.refs:KEY} maps each non-null entry of the mapping at KEY to its
registry path, for a field holding the models a config group selected.
${cc.read_text:PATH} and ${cc.read_text:PACKAGE,RESOURCE} return the
text of a file or of a resource inside an installed package, so long
text such as a prompt can live in its own file and still be part of
the configuration.
Signed-off-by: Pascal Tomecek <40371786+ptomecek@users.noreply.github.com>
Contributor
Test Results 1 files ±0 1 suites ±0 2m 32s ⏱️ +7s Results for commit 3454977. ± Comparison against base commit 424a17f. This pull request skips 1 and un-skips 4 tests. |
Contributor
Test Results 1 files ± 0 1 suites ±0 2m 12s ⏱️ -13s Results for commit 0198354. ± Comparison against base commit 424a17f. This pull request skips 1 and un-skips 4 tests.♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #303 +/- ##
==========================================
+ Coverage 93.63% 93.71% +0.08%
==========================================
Files 205 205
Lines 23158 23538 +380
Branches 1519 1547 +28
==========================================
+ Hits 21683 22058 +375
- Misses 1181 1187 +6
+ Partials 294 293 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ref and refs returned null or an empty mapping for a mistyped key, a mandatory (???) value, or a key written relative to a config_key, which switched a model off with no error. They now raise when the parent of the key is absent, when a value on the way is mandatory, or when the key is relative, and still return null for an absent or null leaf so optional models can be left out. refs also raises when the key holds something other than a mapping, and turns entry names into strings. ref, refs and read_text are registered only under the cc. prefix, so they don't replace another library's resolver of the same bare name. The docs now cover these errors, that list indexes are not supported, and how read_text treats relative paths and paths with commas. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com>
Hydra parses string values again when it instantiates a config, so an
interpolation inside text read by read_text would be resolved then, and
a resolver such as cmd would run. read_text now raises for text
containing "${", leaving the text exactly as it would be if written
into the config as a literal string.
Signed-off-by: Pascal Tomecek <40371786+ptomecek@users.noreply.github.com>
ptomecek
marked this pull request as ready for review
December 2, 2026 01:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds three OmegaConf resolvers, registered only under the
cc.prefix so they don't replace another library's resolver of the same bare name.${cc.ref:KEY}returns the registry path/KEY(dots become slashes), or null when the config holds no value atKEY. A config can then refer to a registered model by name, sharing the instance as/KEYdoes, and still switch an optional model off by setting it to null. Today that takes${cc.if_else:${cc.is_none_or_empty:${oc.select:KEY,null}},null,/KEY}, and${KEY}copies the model's configuration instead of sharing the instance.${cc.refs:KEY}maps each non-null entry of the mapping atKEYto its registry path, for a field that holds the models a config group selected.${cc.read_text:PATH}and${cc.read_text:PACKAGE,RESOURCE}return the text of a file or of a resource inside an installed package, so long text such as a prompt can live in its own file and still be part of the configuration, and so of the cache key.${cc.cmd:cat ...}shells out and can't locate package resources. Hydra parses string values again when it instantiates a config, soread_textrejects text containing${; otherwise an interpolation in the file, such as${cc.cmd:...}, would be resolved and could run a command.Type of Change
Checklist
make lint)make test)