-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add pre_values and Jinja strict mode #223
Conversation
@coretl @GDYendell it's naming time! I said to Tom I did not want to change the name of 'values' but I've checked and this as yet undocumented feature is currently only used in the technosoft support yaml. Therefore we have an opportunity to change the names:
Any ideas? |
ALSO: I have this feeling that it would be real nice if ALL 'pre_values' were evaluated before ANY args. With that feature I could then have the controller know how many axes got greated and not have to manually declare the axis count in the controller YAML. |
Good job, it seems to me a clean way. |
@amichelotti I have released this to PyPI as 3.0.0b4 so you can try in your generic IOC if you like. |
And it has occured to me that Args are not really arguments they are parameters. But I really don't want to change that. |
How about |
|
This is true. I believe the convention is parameters are the definitions and arguments are the actual values. But, given we don't use the term parameters (yet?) I don't think this is particularly confusing. |
Makes for faster test and decouples from arbitrary other repo
add _ctx_ as a short alias for __utils__ add get and set functions as aliases of get_var set_var make get have a default for non pre-existing variables make set return the value it is setting for jinja render purposes make all variables created with get/set directly available in the context
This PR includes the final changes to make the technosoft motor example work well.
First we have added a new pre_values key to Definition. When fields of an Entity are being evaluated they are done in this order:
This allows us to generate values that can be used throughout the args and also values that can rely on all the args being already rendered. This is important when we are using Jinja rendering in these fields.
The example of the num value in
ibek/tests/samples/support/technosoft.ibek.support.yaml
Lines 202 to 206 in b414a3c
required pre_values because it is needed both in the CONFIG arg and also in the pre_init
This PR also introduces strict Jinja rendering that will fail if you use non-existent variables. With additional test to validate the feature.