Skip to content

Commit

Permalink
fix: pin pyodide (marimo-team#1437)
Browse files Browse the repository at this point in the history
  • Loading branch information
mscolnick authored May 21, 2024
1 parent 1dcc3c1 commit 289d9c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
8 changes: 6 additions & 2 deletions frontend/src/core/pyodide/worker/getPyodideVersion.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
17 changes: 8 additions & 9 deletions marimo/_cli/convert/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
# 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
Expand All @@ -30,13 +28,6 @@
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"

Expand Down Expand Up @@ -288,6 +279,14 @@ def __init__(self, md: MarimoParser):
)

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

Expand Down

0 comments on commit 289d9c9

Please sign in to comment.