Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@cxphoenix/vp-wasm-coding-core

Framework-agnostic, client-side Python execution engine. Pure TypeScript — no Vue, no VitePress. It runs Python in an isolated Pyodide module Web Worker, captures stdin/stdout, and produces AC / WA / RE / TLE verdicts. Works on a plain static host; no COOP/COEP / cross-origin isolation required.

For the VitePress component built on top of this engine, see @cxphoenix/vp-wasm-coding.

Install

npm install @cxphoenix/vp-wasm-coding-core

Use

import { createExecutor } from '@cxphoenix/vp-wasm-coding-core'

const executor = createExecutor({ pyodideIndexURL: '/pyodide/' })
const summary = await executor.run('print(int(input()) * 2)', [
  { input: '5', expected_output: '10' },
])
console.log(summary.passed, '/', summary.total)

The Pyodide runtime is fetched at runtime from pyodideIndexURL; host those files yourself (or via a CDN). The worker is exposed at the ./worker subpath export for advanced custom setups.

Security boundary

This engine does not safely sandbox hostile code. The real boundary is Web Worker isolation + a connect-src 'self' CSP + worker.terminate() (the only authoritative time limit). The in-worker op-counter and import blocklist are best-effort, not security guarantees.

License

ECL-2.0 (Educational Community License, Version 2.0).