support different pyodide versions (#328)

* add PyLoader class

* create global loader during app creation time and remove it when pyscript loading operations are done

* make the loader global and open/close when apps is starting. Also add concept of app config so users can set if they want to autoclose the loader of handle it themselves

* add pyconfig file

* auto add global config if there's no config set in the page

* export initializer type

* define type for config

* move initialization out of svelte file, into app config

* change runtimes from strings to objects

* fix typo
This commit is contained in:
Fabio Pliger
2022-05-11 16:59:13 -05:00
committed by GitHub
parent 73a0d9b02e
commit 363f3751f9
7 changed files with 157 additions and 88 deletions

View File

@@ -3,11 +3,12 @@ import { getLastPath } from './utils';
let pyodideReadyPromise;
let pyodide;
const loadInterpreter = async function (): Promise<any> {
const loadInterpreter = async function (indexUrl:string): Promise<any> {
console.log('creating pyodide runtime');
// eslint-disable-next-line
// @ts-ignore
pyodide = await loadPyodide({
// indexURL: indexUrl,
stdout: console.log,
stderr: console.log,
fullStdLib: false