dizzy.generators.context_extras¶
dizzy.generators.context_extras
¶
Shared rendering for the optional environment + telemetry context fields.
Procedures, policies, projections, and queriers all build a context dataclass.
When a function declares environment and/or telemetry lists, those become
two extra dataclasses plus matching context fields:
env— injected constants, one field per entry typed by itsgen_def.pydantic.environmentshape.telemetry— host-injected observation sinks, oneCallablefield per entry (the emitters pattern) typed by its payload shape.
Both are emitted only when the corresponding list is non-empty, so functions that declare neither render byte-for-byte as before.
ContextExtras
dataclass
¶
Rendered fragments to splice into a context module.
Source code in dizzy/src/dizzy/generators/context_extras.py
21 22 23 24 25 26 27 28 29 30 31 32 | |
imports
instance-attribute
¶
Import lines for the env/telemetry shapes (empty if none).
classes
instance-attribute
¶
Dataclass definition lines (env + telemetry), empty if none.
fields
instance-attribute
¶
Context dataclass field lines (e.g. env: foo_env).
needs_callable
instance-attribute
¶
True when a telemetry sink requires typing.Callable.
render_context_extras(name, environment, telemetry)
¶
Build the env/telemetry fragments for a function named name.
Source code in dizzy/src/dizzy/generators/context_extras.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |