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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: add warning when service worker is disabled (#7232)
Myles Scolnick409d2f3ce502
diff --git a/examples/ai/chat/anthropic_example.py b/examples/ai/chat/anthropic_example.pyindex d738feb24d..0d6b66da21 100644--- a/examples/ai/chat/anthropic_example.py+++ b/examples/ai/chat/anthropic_example.py@@ -8,7 +8,7 @@import marimo-__generated_with = "0.17.4"+__generated_with = "0.17.8"app = marimo.App(width="medium")@@ -18,7 +18,7 @@ def _():return (mo,)[email protected](hide_code=True)def _(mo):mo.md(r"""# Using Anthropic@@ -72,7 +72,7 @@ def _(key, mo):return (chatbot,)[email protected](hide_code=True)def _(mo):mo.md("""Access the chatbot's historical messages with [`chatbot.value`](https://docs.marimo.io/api/inputs/chat.html#accessing-chat-history).diff --git a/examples/ai/chat/streaming_openai.py b/examples/ai/chat/streaming_openai.pyindex ea2c202f23..58b600e8a6 100644--- a/examples/ai/chat/streaming_openai.py+++ b/examples/ai/chat/streaming_openai.py@@ -2,7 +2,7 @@# requires-python = ">=3.11"# dependencies = [# "marimo",-# "openai>=1.55.3",+# "openai==2.8.1",# ]# ///@@ -26,7 +26,7 @@ def _(mo):This example shows how to use OpenAI's API with streaming responses.The built-in `mo.ai.llm.openai()` model automatically streams tokensas they arrive from the API!-+Enter your API key below to try it out.""")return@@ -70,14 +70,14 @@ def _(chatbot):return[email protected](hide_code=True)def _(mo):mo.md("""## How it worksThe built-in OpenAI model returns an async generator that yields tokensas they stream from the API:-+```pythonmo.ui.chat(mo.ai.llm.openai(@@ -86,7 +86,7 @@ def _(mo):))```-+Other built-in models (`anthropic`, `google`, `groq`) work the same way.""")return@@ -95,7 +95,7 @@ def _(mo):@app.celldef _(chatbot, mo):# Show chat history- if hasattr(chatbot, 'value'):+ if hasattr(chatbot, "value"):mo.md(f"**Chat history:** {len(chatbot.value)} messages")return@@ -103,11 +103,10 @@ def _(chatbot, mo):@app.celldef _(chatbot):# Display full history- if hasattr(chatbot, 'value'):+ if hasattr(chatbot, "value"):chatbot.valuereturnif __name__ == "__main__":app.run()-diff --git a/frontend/src/core/cells/__tests__/session.test.ts b/frontend/src/core/cells/__tests__/session.test.tsindex c154ad37f0..dce473bc49 100644--- a/frontend/src/core/cells/__tests__/session.test.ts+++ b/frontend/src/core/cells/__tests__/session.test.ts@@ -446,9 +446,6 @@ describe("notebookStateFromSession", () => {const session = createSession([]);const result = notebookStateFromSession(session, null);- expect(Logger.warn).toHaveBeenCalledWith(- "Session and notebook must have at least one cell",- );expect(result).toBeNull();});@@ -456,9 +453,6 @@ describe("notebookStateFromSession", () => {const notebook = createNotebook([]);const result = notebookStateFromSession(null, notebook);- expect(Logger.warn).toHaveBeenCalledWith(- "Session and notebook must have at least one cell",- );expect(result).toBeNull();});@@ -467,9 +461,6 @@ describe("notebookStateFromSession", () => {const notebook = createNotebook([]);const result = notebookStateFromSession(session, notebook);- expect(Logger.warn).toHaveBeenCalledWith(- "Session and notebook must have at least one cell",- );expect(result).toBeNull();});});diff --git a/frontend/src/core/cells/session.ts b/frontend/src/core/cells/session.tsindex ae13e02d1d..a32168f6e7 100644--- a/frontend/src/core/cells/session.ts+++ b/frontend/src/core/cells/session.ts@@ -246,7 +246,6 @@ export function notebookStateFromSession(mergeSessionAndNotebookCells(session, notebook);if (cellIds.length === 0) {- Logger.warn("Session and notebook must have at least one cell");return null;}diff --git a/frontend/src/utils/vitals.ts b/frontend/src/utils/vitals.tsindex 0b5eff8877..1321bb7b37 100644--- a/frontend/src/utils/vitals.ts+++ b/frontend/src/utils/vitals.ts@@ -7,7 +7,7 @@ export async function reportVitals() {}const { onLCP, onINP, onCLS } = await import("web-vitals");- Logger.log("Reporting vitals");+ Logger.debug("Reporting vitals");const logMetric = (metric: {name: string;value: number;diff --git a/marimo/_server/api/endpoints/assets.py b/marimo/_server/api/endpoints/assets.pyindex f78e3c1631..06075972ab 100644--- a/marimo/_server/api/endpoints/assets.py+++ b/marimo/_server/api/endpoints/assets.py@@ -144,6 +144,11 @@ def _inject_service_worker(html: str, file_key: str) -> str:.catch(error => {{console.error('Error updating service worker:', error);}});+ }} else {{+ console.warn(+ '[marimo] Service workers are not supported at this URL. Displaying files from the /public/ directory may be disabled. ' ++ 'To fix this, enable service workers by using a secure connection (https) or localhost.'+ );}}""",)