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.

fix: pin pyodide (#1437)

Myles Scolnick289d9c98dc9d
diff --git a/frontend/src/core/pyodide/worker/getPyodideVersion.ts b/frontend/src/core/pyodide/worker/getPyodideVersion.ts
index c6729ea943..996b745bcb 100644
--- a/frontend/src/core/pyodide/worker/getPyodideVersion.ts
+++ b/frontend/src/core/pyodide/worker/getPyodideVersion.ts
@@ -1,11 +1,15 @@
/* Copyright 2024 Marimo. All rights reserved. */
+const ALLOW_DEV_VERSIONS = false;
+
export function getPyodideVersion(marimoVersion: string) {
- return marimoVersion.includes("dev") ? "dev" : "v0.25.0";
+ return marimoVersion.includes("dev") && ALLOW_DEV_VERSIONS
+ ? "dev"
+ : "v0.25.0";
}
export async function importPyodide(marimoVersion: string) {
// Vite does not like imports with dynamic urls
- return marimoVersion.includes("dev")
+ return marimoVersion.includes("dev") && ALLOW_DEV_VERSIONS
? // @ts-expect-error typescript does not like
await import(`https://cdn.jsdelivr.net/pyodide/dev/full/pyodide.js`)
: // @ts-expect-error typescript does not like
diff --git a/marimo/_cli/convert/markdown.py b/marimo/_cli/convert/markdown.py
index c36fa727de..52b1bbd125 100644
--- a/marimo/_cli/convert/markdown.py
+++ b/marimo/_cli/convert/markdown.py
@@ -8,8 +8,6 @@ from typing import Any, Callable, Literal, Optional, Union
# Native to python
from xml.etree.ElementTree import Element, SubElement
-import yaml
-
# Markdown is a dependency of marimo, as such we utilize it as much as possible
# to parse markdown.
from markdown import Markdown
@@ -30,13 +28,6 @@ from marimo._ast.cell import Cell, CellConfig
from marimo._ast.compiler import compile_cell
from marimo._cli.convert.utils import markdown_to_marimo
-# CSafeLoader is faster than SafeLoader.
-try:
- from yaml import CSafeLoader as SafeLoader
-except ImportError:
- from yaml import SafeLoader # type: ignore[assignment]
-
-
MARIMO_MD = "marimo-md"
MARIMO_CODE = "marimo-code"
@@ -288,6 +279,14 @@ class FrontMatterPreprocessor(Preprocessor):
)
def run(self, lines: list[str]) -> list[str]:
+ import yaml
+
+ # CSafeLoader is faster than SafeLoader.
+ try:
+ from yaml import CSafeLoader as SafeLoader
+ except ImportError:
+ from yaml import SafeLoader # type: ignore[assignment]
+
if not lines:
return lines