caxton.api¶
The extended generative API. caxton re-exports most of it; import
caxton.api directly for the backend-specific escape hatches.
Factories and operations¶
Identical to the caxton facade — caxton.api is where they are
defined.
Formatting and format helpers¶
from caxton.api import (
Style,
StyleSheet,
custom_format,
date_format,
decimal_format,
money_format,
percentage_format,
time_format,
)
See caxton.core.formatting for the full documentation.
XLSX escape hatches¶
Backend-specific, namespaced, and never part of the core model.
Classes:
-
OpenpyxlHookContext–Narrow XLSX-scoped access to native OpenPyXL objects.
-
OpenpyxlHookExtension–Run one explicit hook after semantic content is rendered.
-
PivotBinding–XLSX-only intent to rebind an existing pivot cache source.
Functions:
-
openpyxl_hook–Create an XLSX-namespaced post-render OpenPyXL hook.
-
pivot–Bind an existing XLSX pivot to generated data.
OpenpyxlHookContext
dataclass
¶
Narrow XLSX-scoped access to native OpenPyXL objects.
OpenpyxlHookExtension
dataclass
¶
OpenpyxlHookExtension(function: OpenpyxlHook, sheet: str | None = None)
Run one explicit hook after semantic content is rendered.
PivotBinding
dataclass
¶
XLSX-only intent to rebind an existing pivot cache source.
openpyxl_hook
¶
openpyxl_hook(function: OpenpyxlHook, *, sheet: str | None = None) -> OpenpyxlHookExtension
Create an XLSX-namespaced post-render OpenPyXL hook.
Returns:
-
OpenpyxlHookExtension–An immutable capability-aware extension.
pivot
¶
pivot(target: str, *, source: ColumnRef | TableReference, refresh_on_open: bool = True) -> PivotBinding