-
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 values support (completed) #68
Conversation
Thus saving passing it around everywhere.
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #68 +/- ##
==========================================
- Coverage 97.84% 97.63% -0.22%
==========================================
Files 9 9
Lines 372 381 +9
==========================================
+ Hits 364 372 +8
- Misses 8 9 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This is now working using post_init in Entity class to add a context. Next I need to do the first stage Jinja render in the context at post_init time. At present things that use counters will continue to increment for each reference e,g,
|
I'm struggling with implementing 'values' calculated fields.
The example I want to render is https://github.com/epics-containers/ibek-defs/blob/psc/ipac/ipac.ibek.support.yaml.
I first tried adding the values in as defaulted Args in make_entity_class. But this interfered with the schema - so you could see the entry and override it just like it was an Arg (I suppose we could call that a feature but its not clear that you are not supposed to supply a value for it).
Next I decided to just copy the values into all instances in ioc_deserialize. The current PR shows this. It does not work because converting the instance to Dict for Jinja does not pick up the new attributes because they are not in dataclass_fields. I could fix that I suppose but it is feeling really nasty.
@coretl I wondered if you had ideas on how to do this nicely.
(Values should really be a class variable that gets passed to all entity instances but is not needed in ioc yaml. If there is a nice way to do this it might need to change with the Pydantic update.)