sudoblockio / tackle

Tackle is a programmable configuration language for building modular utilities, code generators, and CLIs with schema validation baked in.
Apache License 2.0
52 stars 2 forks source link

Remove `context` from *Hook models #177

Closed robcxyz closed 12 months ago

robcxyz commented 1 year ago

Since pydantic now changed behaviour in v2 and now copies everything by default and hence we lose references, we should RM the context as a base attribute from BaseHook. This will then preven us from manipulating the context from within a hook but we can replace that with a function signiture inspect whereby if there is an argument that is of type 'Context', we automatically inject it as a kwarg which would supplant this behaviour while also giving us full access to the mutable context - not just a copy. Would fix some tests broken from the rewrite

robcxyz commented 12 months ago

Injecting context into the exec method now. This is solved.