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.

improvement: show wasm option in static notebook dialog (#786)

Myles Scolnick80864a61828e
diff --git a/frontend/src/components/editor/actions/useNotebookActions.tsx b/frontend/src/components/editor/actions/useNotebookActions.tsx
index dad5dcbcbd..bcbe616edd 100644
--- a/frontend/src/components/editor/actions/useNotebookActions.tsx
+++ b/frontend/src/components/editor/actions/useNotebookActions.tsx
@@ -53,7 +53,7 @@ export function useNotebookActions() {
},
{
icon: <Share2Icon size={14} strokeWidth={1.5} />,
- label: "Share notebook via WASM",
+ label: "Share WebAssembly notebook",
handle: async () => {
const code = await readCode();
const url = createShareableLink(code.contents);
diff --git a/frontend/src/components/static-html/static-banner.tsx b/frontend/src/components/static-html/static-banner.tsx
index 72883abde5..dbc8bbe85b 100644
--- a/frontend/src/components/static-html/static-banner.tsx
+++ b/frontend/src/components/static-html/static-banner.tsx
@@ -18,6 +18,7 @@ import {
DialogTrigger,
} from "../ui/dialog";
import { CopyIcon, DownloadIcon } from "lucide-react";
+import { createShareableLink } from "@/core/pyodide/share";
export const StaticBanner: React.FC = () => {
if (!isStaticNotebook()) {
@@ -37,8 +38,7 @@ export const StaticBanner: React.FC = () => {
</a>
.
<br />
- Some interactive features may not work, however you can download the
- code and run it locally.
+ Some interactive features may not work, see ways to run or edit this.
</span>
<span className="flex-shrink-0">
<StaticBannerDialog />
@@ -56,6 +56,8 @@ const StaticBannerDialog = () => {
}
const href = window.location.href;
+ const code = getMarimoCode();
+ const wasmLink = createShareableLink(code);
return (
<Dialog>
@@ -85,20 +87,34 @@ const StaticBannerDialog = () => {
</div>
{!href.endsWith(".html") && (
<>
- <hr className="my-3" />
- You may also run:
+ or
<div className="font-mono text-sm bg-[var(--sky-2)] rounded-md my-3 p-2 border border-[var(--sky-7)] break-all">
marimo edit {window.location.href}
</div>
</>
)}
+ <hr className="my-3" />
+ You may also be able to run this notebook entirely in the browser
+ via WebAssembly at:{" "}
+ <a
+ href={wasmLink}
+ target="_blank"
+ className="text-link hover:underline"
+ >
+ {wasmLink.slice(0, 40)}...
+ </a>
+ <br />
+ <div className="text-sm text-muted-foreground pt-2">
+ <strong>Note:</strong> This feature is experimental and may not
+ work for all notebooks. Additionally, some dependencies may not be
+ available in the browser.
+ </div>
</DialogDescription>
</DialogHeader>
<div className="flex gap-4 flex-wrap">
<Button
variant="secondary"
onClick={() => {
- const code = getMarimoCode();
window.navigator.clipboard.writeText(code);
toast({ title: "Copied to clipboard" });
}}
@@ -109,7 +125,6 @@ const StaticBannerDialog = () => {
<Button
variant="secondary"
onClick={() => {
- const code = getMarimoCode();
downloadBlob(new Blob([code], { type: "text/plain" }), filename);
}}
>