-
Notifications
You must be signed in to change notification settings - Fork 37
Lazy config evaluation #64
base: main
Are you sure you want to change the base?
Conversation
This is more generic, and allows us to support lazily evaluated configurations if needed.
df8b901
to
1165b9c
Compare
Need to add tests/figure out what to test. Hopefully this demonstrates the issue. IMO chainmap is actually better here -- supporting a lazyconfig is reasonable. That said, I'd prefer the simplicity with a dictionary. |
Pros of this:
Cons of this:
|
computed: Mapping[str, Any] = None, | ||
overrides: Mapping[str, Any] = None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do these need to change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, but I figured it would be nice to stay consistent.
@@ -379,7 +380,7 @@ def combine_config_and_inputs(config: Dict[str, Any], inputs: Dict[str, Any]) -> | |||
duplicated_inputs = [key for key in inputs if key in config] | |||
if len(duplicated_inputs) > 0: | |||
raise ValueError(f'The following inputs are present in both config and inputs. They must be mutually disjoint. {duplicated_inputs}') | |||
return {**config, **inputs} | |||
return collections.ChainMap(config, inputs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the unit test need to change to enforce chain map's way of not evaluating things?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if the contract is that we don't evaluate the driver then we want to test that its not evaluated. That said, I don't really like that as a contract, and it feels limiting later on, so let's think through.
[Short description explaining the high-level reason for the pull request]
Additions
Removals
Changes
Testing
Screenshots
If applicable
Notes
Todos
Checklist
Testing checklist
Python