Osiris Educational Transpiler
raw JSON → 1.0.28 verified Fri May 01 auth: no javascript
Osiris is an educational transpiler that converts Python and Logo code to JavaScript for browser execution, targeting learners of programming language transpilation. Current version 1.0.28 (stable, low release cadence). Key differentiators: supports Python and Logo, provides a sandboxed execution environment using Web Workers, and includes a built-in execution timeout to prevent infinite loops. Compared to alternatives like Skulpt or Pyodide, Osiris is simpler and focuses on the transpilation learning process rather than full language compatibility.
Common errors
error Cannot find module 'osiris-educational-transpiler' or its corresponding type declarations. ↓
cause Missing or incorrect import path.
fix
Use one of: 'osiris-educational-transpiler', 'osiris-educational-transpiler/Python', or 'osiris-educational-transpiler/logo'.
error TypeError: transpiler.sendCode is not a function ↓
cause Using wrong class (e.g., Osiris instead of OsirisPython) or missing import.
fix
Import the correct class: import OsirisPython from 'osiris-educational-transpiler/Python'.
error Uncaught ReferenceError: OsirisPython is not defined ↓
cause Using CommonJS require instead of ES module import.
fix
Use ES module syntax: import OsirisPython from 'osiris-educational-transpiler/Python'.
error Error: No canvas element with id 'myCanvas' found. ↓
cause Canvas element with configured ID not present in DOM.
fix
Add a canvas element with id matching the configuration before calling runCode().
Warnings
gotcha sendCode only transpiles; you must call runCode() separately to execute. ↓
fix Ensure you call runCode() after a successful sendCode().
gotcha Logo canvas requires a canvas element with specified ID before runCode(). ↓
fix Create a canvas element with id matching the configured canvasId, e.g., '<canvas id="myCanvas"></canvas>'.
gotcha Package only works in browser environment due to Web Worker usage for Logo and Python execution. ↓
fix Use Osiris only in browser-based projects; it will fail in Node.js.
gotcha Import paths are case-sensitive; using wrong case leads to module resolution failure. ↓
fix Use exactly 'osiris-educational-transpiler/Python' and 'osiris-educational-transpiler/logo'.
Install
npm install osiris-educational-transpiler yarn add osiris-educational-transpiler pnpm add osiris-educational-transpiler Imports
- Osiris wrong
const Osiris = require('osiris-educational-transpiler')correctimport {Osiris} from 'osiris-educational-transpiler' - OsirisPython wrong
import {OsirisPython} from 'osiris-educational-transpiler'correctimport OsirisPython from 'osiris-educational-transpiler/Python' - OsirisLogo wrong
import OsirisLogo from 'osiris-educational-transpiler/Logo'correctimport OsirisLogo from 'osiris-educational-transpiler/logo'
Quickstart
import OsirisPython from 'osiris-educational-transpiler/Python';
const transpiler = new OsirisPython();
transpiler.setEventHandler((event) => {
if (event.type === 'output') {
console.log(event.output);
}
});
const result = transpiler.sendCode('print("Hello, World!")');
if (result.success) {
transpiler.runCode();
} else {
console.error(result.errors);
}