Skip to content

Commit a74da6a

Browse files
committed
Added a way to easily test raw micropython or pyodide
1 parent 2e669a9 commit a74da6a

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

index.html

+8
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
</head>
88
<body>
99
<ul>
10+
<li>
11+
<small><strong>raw interpreter</strong></small>
12+
<ul>
13+
<li><a href="/test/raw/micropython/">micropython</a></li>
14+
<li><a href="/test/raw/pyodide/">pyodide</a></li>
15+
</ul>
16+
<hr>
17+
</li>
1018
<li>
1119
<a href="/test/integration.html">
1220
<strong>integration tests</strong> <small>(list)</small>

test/raw/micropython/index.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
6+
<script type="module">
7+
const base = 'https://cdn.jsdelivr.net/npm/@micropython/micropython-webassembly-pyscript@latest';
8+
const { loadMicroPython } = await import(`${base}/micropython.mjs`);
9+
const interpreter = await loadMicroPython({ url: `${base}/micropython.wasm` });
10+
const { textContent } = document.querySelector('script[type=micropython]');
11+
interpreter.runPythonAsync(textContent);
12+
</script>
13+
<script type="micropython" async>
14+
import js
15+
js.document.body.textContent = "MicroPython"
16+
</script>
17+
</head>
18+
</html>

test/raw/pyodide/index.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
6+
<script type="module">
7+
const base = 'https://cdn.jsdelivr.net/npm/pyodide@latest';
8+
const { loadPyodide } = await import(`${base}/pyodide.mjs`);
9+
const interpreter = await loadPyodide();
10+
const { textContent } = document.querySelector('script[type=pyodide]');
11+
interpreter.runPythonAsync(textContent);
12+
</script>
13+
<script type="pyodide" async>
14+
import js
15+
js.document.body.textContent = "Pyodide"
16+
</script>
17+
</head>
18+
</html>

0 commit comments

Comments
 (0)