ov.registry#
The plugin mechanism: decorated functions registered into a dict (§3.2).
Everything extensible in ov – probes (what we collect), analyzers (what we
conclude), and report sections (what we render) – is a callable registered with
declared requires/produces artifact dependencies. A run is then just:
resolve registry -> topologically order by declared deps -> execute. Adding a
new capability is registering a function; it never means editing a dispatcher
(open-closed).
This is the “functions as data” + dataflow-DAG shape the project favors. We keep
the meshed dependency optional by shipping a small, transparent topo-sort
here; a caller who wants meshed can build the same DAG from
Registry.items.
Classes
|
A registered callable plus its declared artifact-kind dependencies. |
|
A named registry of |
- class ov.registry.RegisteredFn(name, fn, requires=(), produces=(), meta=dict())[source]#
Bases:
objectA registered callable plus its declared artifact-kind dependencies.
- class ov.registry.Registry(label)[source]#
Bases:
objectA named registry of
RegisteredFn, with dependency-ordered resolution.>>> reg = Registry("demo") >>> @reg.register("a", produces=("x",)) ... def a(): ... return "a" >>> @reg.register("b", requires=("x",), produces=("y",)) ... def b(): ... return "b" >>> [r.name for r in reg.ordered()] # b depends on a's output kind "x" ['a', 'b'] >>> reg["a"].fn() 'a'
- property items: dict[str, RegisteredFn]#
The underlying
name -> RegisteredFnmapping (read-only by convention).
- ordered(names=None)[source]#
Return the selected items topologically ordered by
requires/produces.An item depends on any selected item that
producesa kind itrequires. Inputs produced by no selected item are treated as already available (captured upstream). Falls back to selection order on a cycle.- Return type: