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
chore: pass marimo version to worker (#941)
Myles Scolnickaa6b0ed84c69
diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.ymlindex c1883cc885..2a3c246e2e 100644--- a/.github/workflows/dev-release.yml+++ b/.github/workflows/dev-release.yml@@ -90,6 +90,7 @@ jobs:- name: 📝 Comment PRuses: actions/github-script@v7+ continue-on-error: truewith:script: |try {@@ -101,7 +102,7 @@ jobs:owner: context.repo.owner,repo: context.repo.repo,issue_number: pullRequest.data.items[0].number,- body: '🚀 Development release published. You may be able to view the changes at https://marimo.app?v${{ env.MARIMO_VERSION }}+ body: '🚀 Development release published. You may be able to view the changes at https://marimo.app?v${{ env.MARIMO_VERSION }}'});} catch (err) {// ignorediff --git a/frontend/src/core/pyodide/bridge.ts b/frontend/src/core/pyodide/bridge.tsindex 4af9e30563..418af6c4ea 100644--- a/frontend/src/core/pyodide/bridge.ts+++ b/frontend/src/core/pyodide/bridge.ts@@ -39,6 +39,7 @@ import { UserConfigLocalStorage } from "../config/config-schema";import { createShareableLink } from "./share";import { PyodideRouter } from "./router";import { Paths } from "@/utils/paths";+import { getMarimoVersion } from "../dom/marimo-tag";export type BridgeFunctionAndPayload = {[P in keyof RawBridge]: {@@ -69,7 +70,9 @@ export class PyodideBridge implements RunRequests, EditRequests {constructor() {if (isPyodide()) {- this.worker = new InlineWorker();+ this.worker = new InlineWorker({+ name: getMarimoVersion(),+ });this.worker.onmessage = this.handleWorkerMessage;if (crossOriginIsolated) {// Pyodide handles interrupts through SharedArrayBuffers, whichdiff --git a/frontend/src/core/pyodide/worker/bootstrap.ts b/frontend/src/core/pyodide/worker/bootstrap.tsindex 6b0d901c64..40ebf61525 100644--- a/frontend/src/core/pyodide/worker/bootstrap.ts+++ b/frontend/src/core/pyodide/worker/bootstrap.ts@@ -27,23 +27,34 @@ export async function bootstrap() {indexURL: "https://cdn.jsdelivr.net/pyodide/v0.25.0/full/",});+ // If is a dev release, we need to install from test.pypi.org+ if (getMarimoVersion().includes("dev")) {+ await pyodide.runPythonAsync(`+ import micropip++ await micropip.install(+ [+ "${getMarimoWheel()}",+ ],+ deps=False,+ index_urls="https://test.pypi.org/pypi/{package_name}/json"+ );+ `);+ }+// Install marimo and its dependencies- const marimoWheel =- process.env.NODE_ENV === "production"- ? "marimo >= 0.2.5"- : "http://localhost:8000/dist/marimo-0.3.2-py3-none-any.whl";await pyodide.runPythonAsync(`import micropipawait micropip.install([# Subset of marimo requirements- "${marimoWheel}",+ "${getMarimoWheel()}","markdown","pymdown-extensions","pyodide_http",],- deps=False+ deps=False,);`);@@ -102,3 +113,18 @@ export async function startSession(return bridge;}++function getMarimoVersion() {+ return self.name; // We store the version in the worker name+}++function getMarimoWheel() {+ const version = getMarimoVersion();+ if (!version) {+ return "marimo >= 0.3.0";+ }+ if (version === "local") {+ return "http://localhost:8000/dist/marimo-0.3.2-py3-none-any.whl";+ }+ return `marimo==${version}`;+}diff --git a/frontend/vite.config.mts b/frontend/vite.config.mtsindex f06645cca5..9655cecc1b 100644--- a/frontend/vite.config.mts+++ b/frontend/vite.config.mts@@ -26,7 +26,7 @@ const htmlDevPlugin = (): Plugin => {html = html.replace("{{ user_config }}", JSON.stringify({}));html = html.replace("{{ app_config }}", JSON.stringify({}));html = html.replace("{{ server_token }}", "");- html = html.replace("{{ version }}", "0.2.0");+ html = html.replace("{{ version }}", "local");html = html.replace("{{ filename }}", "notebook.py");html = html.replace("{{ mode }}", "edit");html = html.replace(/<\/head>/, `<marimo-wasm></marimo-wasm></head>`);