Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ vite.config.js.timestamp-*
vite.config.ts.timestamp-*
*~
/venv
/static/vpython.zip
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,11 @@ You'll need to set a value for PUBLIC_TRUSTED_HOST in the .env file, e.g.:
PUBLIC_TRUSTED_HOST="http://localhost:8080"

There is a `sample.env` for your reference. you can: `cp sample.env .env` and then edit that .env file.

## Test harness

A local test page is in `test/index.html`. It embeds the runner in an iframe and lets you send programs via `postMessage`. With `PUBLIC_TRUSTED_HOST="http://localhost:8080"` in your `.env` and `npm run dev` running, open a second terminal and run:

npm run test-ui

Then visit `http://localhost:8080` and click **▶ Run**.
6 changes: 6 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build]
command = "npm run zip && npm run build"
publish = "build"

[build.environment]
NODE_VERSION = "18"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --plugin-search-dir . --check . && eslint .",
"test-ui": "npx serve test -p 8080",
"zip": "zip -r ./static/vpython.zip vpython",
"format": "prettier --plugin-search-dir . --write ."
},
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ await micropip.install('/cyvector-0.1-cp311-cp311-emscripten_3_1_39_wasm32.whl')

export const getPyodide = async (stdOutRedir, stdErrRedir, url) => {
const t0 = performance.now()
console.log(`=== utils.js v2.0.2 - Pyodide v0.23.3 ===`)
console.log(`=== utils.js v2.0.2 - Pyodide v0.29.4 ===`)
console.log(`[${t0.toFixed(2)}ms] Starting getPyodide`)

const pkgResponse = fetch('vpython.zip').then((x) => x.arrayBuffer())
Expand Down
2 changes: 1 addition & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<svelte:head>
<script src="https://cdn.jsdelivr.net/pyodide/v0.23.3/full/pyodide.js"></script>
<script src="https://cdn.jsdelivr.net/pyodide/v0.29.4/full/pyodide.js"></script>
<link
type="text/css"
href="https://www.glowscript.org/css/redmond/2.1/jquery-ui.custom.css"
Expand Down
5 changes: 2 additions & 3 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
let scene: any
let display: any
let mounted: boolean = false
let pyodideURL = 'https://cdn.jsdelivr.net/pyodide/v0.23.3/full/'
let pyodideURL = 'https://cdn.jsdelivr.net/pyodide/v0.29.4/full/'

// Standard library imports
let mathImportCode = `from math import *`
Expand All @@ -39,8 +39,7 @@
}

onMount(async () => {
console.log('=== wmWVPRunner v2.0.2 - Using Pyodide v0.23.3 (last known working) ===')
console.log('Newer Pyodide versions cause Chrome stack overflow with vpython.vector')
console.log('=== wmWVPRunner v2.0.2 - Using Pyodide v0.29.4 ===')
console.log('Public host =', PUBLIC_TRUSTED_HOST)
mounted = true
window.addEventListener('message', (e) => {
Expand Down
Binary file removed static/vpython.zip
Binary file not shown.
Loading