CodeGenerator.generate()

Generate standalone Python code for target cells.

Usage

Source

CodeGenerator.generate(
    targets=None,
    *,
    constant_types=None,
    constant_ranges=None,
    constant_blanks=False,
    input_ranges=None,
    blank_ranges=None,
    series_bindings=None,
    bindings_workbook=None,
    series_docstring_callback=None,
    docstring_renderer="google"
)

Parameters

targets: Sequence[str] | None = None

List of target cell addresses to compute.

constant_types: set[str] | None = None

Cell value kinds emitted as typed constants in generated code.

constant_ranges: Sequence[str] | None = None

Sheet-qualified ranges whose cells are emitted as constants.

constant_blanks: bool = False

When True, blank cells in constant ranges become None.

input_ranges: Sequence[str] | None = None

Sheet-qualified ranges whose leaf cells are treated as inputs. When a cell would otherwise be a constant, input_ranges take precedence.

blank_ranges: Sequence[str] | None = None

Sheet-qualified rectangles whose cells are omitted from the graph but resolve as empty (None) at runtime; must match builder/evaluator.

series_bindings: WorkbookSeriesBindings | None = None

Optional workbook binding manifest; when set with bindings_workbook, emits set_* functions that accept Records.

bindings_workbook: Path | str | None = None

Path to the .xlsx file used to resolve binds.

series_docstring_callback: SeriesBindingDocstringCallbackSpec | None = None

Optional registered callback name for structured docstrings on generated set_* and series output compute_* functions.

docstring_renderer: SeriesDocstringRendererSpec = "google"
Built-in renderer name or custom renderer object/callable for structured series-binding docstrings (plain, rst, google, numpy).

Returns

str
Standalone Python source code as a string.