FormulaEvaluator
Evaluate Excel formulas over a DependencyGraph.
Usage
FormulaEvaluator()Holds a shared reference to graph (no deep copy). Cell-value and parsed-AST caches are per-evaluator.
Formula-shape helpers (_shape_fns) are compiled in __post_init__ from graph.formula_shapes at construction. That compile is a snapshot: reassigning or rewarming graph.formula_shapes later does not refresh _shape_fns. Construct a new FormulaEvaluator after rewarming if you want compiled shape helpers. Missing shapes fall back to Node.formula_ast; correctness does not require the overlay to be warm.
With auto_detect_changes and eager_invalidation (the defaults), evaluate polls leaf values only after DependencyGraph.set_node_value since the previous scan (or construction). Repeated evaluate(cell) calls against an unchanged leaf set do not walk unused leaves.
Parameter Attributes
graph: DependencyGraphauto_detect_changes: bool = Trueeager_invalidation: bool = Trueon_cell_evaluated: Callable[[str, FormulaValue], None] | None = Noneiterate_enabled: bool = Falseiterate_count: int = 100iterate_delta: float = 0.001blank_ranges: tuple[str, …] | None = Noneast_cache_maxsize: int = DEFAULT_AST_CACHE_MAXSIZE