pyodide-wrapper-loader
v1.0.6
Published
A simple Python loader wrapper for Pyodide
Readme
Pyodide Loader
A simple Python loader wrapper for Pyodide that makes it easy to run Python code in JavaScript environments.
Installation
npm install pyodide-loaderUsage
import PythonLoader from 'pyodide-loader'
const loader = new PythonLoader()
// Run Python code
const myCode = loader.code(`
result = "Hello World"
result
`)
myCode().then(result => console.log(result))
// Fetch and run external Python script
loader.fetchExternalScript("http://localhost:8000/script.py")
.then(result => console.log(result))API
new PythonLoader()
Creates a new instance and initializes Pyodide.
code(pythonCode)
Returns an async function that executes the provided Python code.
fetchExternalScript(url)
Fetches and executes a Python script from a URL.
License
MIT
