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.

Update to Pyodide v314.0.0 (#9844)

Agriya Khetarpal5b8ded7f8851
diff --git a/frontend/package.json b/frontend/package.json
index 073c1b20a0..71ab468fbd 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -123,7 +123,7 @@
"partysocket": "1.1.13",
"path-to-regexp": "^8.4.0",
"plotly.js": "^3.3.1",
- "pyodide": "0.27.7",
+ "pyodide": "314.0.0",
"radix-ui": "1.4.3",
"react-arborist": "^3.4.3",
"react-aria": "3.47.0",
diff --git a/frontend/src/core/wasm/worker/bootstrap.ts b/frontend/src/core/wasm/worker/bootstrap.ts
index a40e4fbb93..8339b42225 100644
--- a/frontend/src/core/wasm/worker/bootstrap.ts
+++ b/frontend/src/core/wasm/worker/bootstrap.ts
@@ -55,6 +55,10 @@ export class DefaultWasmController implements WasmController {
// Load pyodide and packages
const span = t.startSpan("loadPyodide");
try {
+ // Without this, this fails in Firefox with
+ // `Could not extract indexURL path from pyodide module`
+ // This fixes for Firefox and does not break Chrome/others
+ const indexURL = `https://cdn.jsdelivr.net/pyodide/${opts.pyodideVersion}/full/`;
const pyodide = await loadPyodide({
// Perf: These get loaded while pyodide is being bootstrapped
packages: [
@@ -68,10 +72,14 @@ export class DefaultWasmController implements WasmController {
],
_makeSnapshot: MAKE_SNAPSHOT,
lockFileURL: `https://wasm.marimo.app/pyodide-lock.json?v=${opts.version}&pyodide=${opts.pyodideVersion}`,
- // Without this, this fails in Firefox with
- // `Could not extract indexURL path from pyodide module`
- // This fixes for Firefox and does not break Chrome/others
- indexURL: `https://cdn.jsdelivr.net/pyodide/${opts.pyodideVersion}/full/`,
+ indexURL,
+ // Since Pyodide 0.28.0, when lockFileURL is set, the package base URL
+ // defaults to the lockfile's URL (wasm.marimo.app) instead of indexURL.
+ // Unlike Node, browsers get no CDN fallback on a failed fetch, so we
+ // should pin packageBaseUrl back to the jsDelivr CDN to restore
+ // the resolution akin to pre-0.28.
+ packageBaseUrl: indexURL,
+ convertNullToNone: true,
});
this.pyodide = pyodide;
span.end("ok");
diff --git a/marimo/_lint/rules/wasm/incompatible_imports.py b/marimo/_lint/rules/wasm/incompatible_imports.py
index 6a5b0cf185..64fde0d74b 100644
--- a/marimo/_lint/rules/wasm/incompatible_imports.py
+++ b/marimo/_lint/rules/wasm/incompatible_imports.py
@@ -23,6 +23,9 @@ INCOMPATIBLE_MODULES = frozenset(
"readline",
"curses",
"tkinter",
+ # Removed entirely from the distribution as of Pyodide 314.0.0.
+ "pydecimal",
+ "test",
}
)
diff --git a/marimo/_pyodide/pyodide_constraints.py b/marimo/_pyodide/pyodide_constraints.py
index bb13a95612..f010772225 100644
--- a/marimo/_pyodide/pyodide_constraints.py
+++ b/marimo/_pyodide/pyodide_constraints.py
@@ -21,10 +21,10 @@ from marimo._version import __version__
LOGGER = _loggers.marimo_logger()
# Pyodide version matching frontend/package.json — update together.
-PYODIDE_VERSION = "0.27.7"
+PYODIDE_VERSION = "314.0.0"
-# Derived from the lockfile's info.python field (Pyodide 0.27.7 → 3.12.7).
-PYODIDE_PYTHON_VERSION = "3.12"
+# Derived from the lockfile's info.python field (Pyodide 314.0.0 → 3.14.2).
+PYODIDE_PYTHON_VERSION = "3.14"
# Env var pointing at a local pyodide-lock.json. Lets offline / air-gapped
# users supply the lockfile out-of-band instead of fetching from the host.
diff --git a/marimo/_runtime/patches.py b/marimo/_runtime/patches.py
index 3a10f0185f..1803ed0c1f 100644
--- a/marimo/_runtime/patches.py
+++ b/marimo/_runtime/patches.py
@@ -119,7 +119,7 @@ def _warn_uninstalled(prefix=""):
async def install(
requirements, keep_going=False, deps=True,
credentials=None, pre=False, index_urls=None, *,
- verbose=False
+ constraints=None, reinstall=False, verbose=False
):
_warn_uninstalled(prefix=f'{requirements} was not installed: ')
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 58d25617af..a08f05834b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -344,8 +344,8 @@ importers:
specifier: ^3.3.1
version: 3.3.1([email protected])
pyodide:
- specifier: 0.27.7
- version: 0.27.7
+ specifier: 314.0.0
+ version: 314.0.0
radix-ui:
specifier: 1.4.3
@@ -4304,6 +4304,9 @@ packages:
resolution: {integrity: sha512-Fgg31wv9QbLDA0SpTOXO3MaxySc4DKGLi8sna4/Utjo4r3ZRPdCt4UQee8BWr+Q5z21yifghREPJGYaEOEIACg==}
deprecated: This is a stub types definition. dompurify provides its own type definitions, so you do not need this installed.
+ '@types/[email protected]':
+ resolution: {integrity: sha512-cMQm7pxu6BxtHyqJ7mQZ2kXWV5SLmugybFdHCBbJ5eHzOo6VhBckEgAT3//rP5FwPHNPeEiq4SmQ5ucBwsOo4Q==}
+
resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==}
@@ -7975,8 +7978,8 @@ packages:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-RUSVJlhQdfWfgO9hVHCiXoG+nVZQRS5D9FzgpLJ/VcgGBLSAKoPL8kTiOikxbHQm1kRISeWUBdulEgO26qpSRA==}
+ resolution: {integrity: sha512-WIofRQehY78IC9n3+p9COjKUZGCCHfrvtR5dXKm0BHIWUun2B8DBf17rXytMF/KYkrsDQRa+BDGhi8UKwzaU3w==}
engines: {node: '>=18.0.0'}
@@ -14241,6 +14244,8 @@ snapshots:
dependencies:
dompurify: 3.4.0
+ '@types/[email protected]': {}
+
dependencies:
'@types/eslint': 9.6.1
@@ -18462,8 +18467,9 @@ snapshots:
dependencies:
+ '@types/emscripten': 1.41.5
ws: 8.19.0
transitivePeerDependencies:
- bufferutil
diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml
index 7c244d5bf1..c29f8d8147 100644
--- a/pnpm-workspace.yaml
+++ b/pnpm-workspace.yaml
@@ -22,6 +22,7 @@ minimumReleaseAgeExclude:
blockExoticSubdeps: true
trustPolicy: no-downgrade
trustPolicyExclude:
diff --git a/tests/_lint/test_files/wasm_incompatible.py b/tests/_lint/test_files/wasm_incompatible.py
index 1c9a7c4341..f95509d597 100644
--- a/tests/_lint/test_files/wasm_incompatible.py
+++ b/tests/_lint/test_files/wasm_incompatible.py
@@ -41,5 +41,12 @@ def _():
return
+def _():
+ import pydecimal
+
+ return
+
+
if __name__ == "__main__":
app.run()
diff --git a/tests/_lint/test_wasm_rules.py b/tests/_lint/test_wasm_rules.py
index 2071596ad7..5e657705cd 100644
--- a/tests/_lint/test_wasm_rules.py
+++ b/tests/_lint/test_wasm_rules.py
@@ -62,6 +62,14 @@ class TestMW001IncompatibleImports:
messages = [d.message for d in diagnostics]
assert any("pdb" in m for m in messages)
+ def test_pydecimal_flagged(self):
+ notebook, contents = _load_notebook()
+ diagnostics = lint_notebook(
+ notebook, contents, lint_config={"select": ["MW001"]}
+ )
+ messages = [d.message for d in diagnostics]
+ assert any("pydecimal" in m for m in messages)
+
def test_severity_is_wasm(self):
notebook, contents = _load_notebook()
diagnostics = lint_notebook(