Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

Rename ctx.notify to broadcast_raw_notification (#9581)

Trevor Manz448900a8660e
diff --git a/marimo/_code_mode/_context.py b/marimo/_code_mode/_context.py
index e5191a85dd..e4f352ef50 100644
--- a/marimo/_code_mode/_context.py
+++ b/marimo/_code_mode/_context.py
@@ -1723,7 +1723,7 @@ class AsyncCodeModeContext:
tx = Transaction(changes=tuple(doc_ops), source="code-mode")
# Apply to local snapshot so _cell_label can read names.
self._document.apply(tx)
- self.notify(
+ self.broadcast_raw_notification(
NotebookDocumentTransactionNotification(transaction=tx)
)
@@ -1838,8 +1838,17 @@ class AsyncCodeModeContext:
type(command).__name__,
)
- def notify(self, notification: Notification) -> None:
- """Send a notification to the frontend."""
+ def broadcast_raw_notification(self, notification: Notification) -> None:
+ """Low-level: broadcast a fully-constructed ``Notification`` to the frontend.
+
+ Escape hatch for emitting notification payloads directly; the
+ payload is delivered as-is, with no validation, batching, or
+ debouncing. Prefer a higher-level helper on ``ctx`` when one exists.
+
+ See ``marimo._messaging.notification`` for the full discriminated
+ union. Agent-facing subtypes include ``BannerNotification`` (persistent
+ banner) and ``AlertNotification`` (modal dialog).
+ """
broadcast_notification(notification, stream=self._kernel.stream) # type: ignore[arg-type]