[0.2.dev6] Introducing settings objects #108
Merged
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.
This PR adds the first "settings objects," as proposed in issue #54 and sketched out for the column templates in issue #98 (comment). This lets common sets of parameters be defined in a single place, improving consistency and reducing the amount of repeated code.
New classes
shared.CoreTemplateSettings
, with parameters for all templatesshared.OutputColumnSettings
, for any template that generates or modifies a columndata.ExpressionSettings
, with custom parameters for theColumnFromExpression
templateNew shared functions
shared.register_column()
, to register a callable as an Orca columnutils.col_in_expression()
, to extract column names from adf.eval()
-style expressionUpdate to
ColumnFromExpression
This allows us to restructure the inputs of the first column template:
Old usage:
New usage:
User migration
This breaks the API for
ColumnFromExpression
, but the fixes are easy, as shown above.For saved YAML files, i've written a converter. When ModelManager opens a saved ColumnFromExpression that uses the older format, it will automatically be loaded correctly: column_from_expression.py#L73-L104.
(ColumnFromExpression was only added in the prior PR, so i wrote this mostly as a proof of concept for how we can roll out similar updates for other templates.)
Versioning
0.2.dev6
To do before merging