mirror of
https://github.com/pyscript/pyscript.git
synced 2026-03-27 11:00:44 -04:00
refactor py-config to use json (#754)
* refactor py-config to use toml * switch from toml to json and add unit tests * fix test for py-config * fix integration test * use flat structure for JSON * allow merging configs * replace arrays instead of concatenating them * remove extra keys from inline config of integration test * simplify array replacement logic * allow config from src to be partial as well * add comments to unit tests * add unit test for setting config from both inline and src * handle parse errors + validate config supplied * separate functions for src and inline * suggested improvements * show error message in red on parser error * fix eslint * use resolveJsonModule as true * use default config defined as a variable without import * remove disable eslint comment * remove import for covfefe.json as well * metadata injection * add support for schema + extra keys * use schema_version
This commit is contained in:
@@ -8,12 +8,6 @@ import pyscript from './python/pyscript.py';
|
||||
|
||||
const logger = getLogger('pyscript/pyodide');
|
||||
|
||||
export const DEFAULT_RUNTIME_CONFIG: RuntimeConfig = {
|
||||
src: 'https://cdn.jsdelivr.net/pyodide/v0.21.2/full/pyodide.js',
|
||||
name: 'pyodide-default',
|
||||
lang: 'python'
|
||||
};
|
||||
|
||||
export class PyodideRuntime extends Runtime {
|
||||
src: string;
|
||||
name?: string;
|
||||
@@ -22,9 +16,9 @@ export class PyodideRuntime extends Runtime {
|
||||
globals: any;
|
||||
|
||||
constructor(
|
||||
src = DEFAULT_RUNTIME_CONFIG.src,
|
||||
name = DEFAULT_RUNTIME_CONFIG.name,
|
||||
lang = DEFAULT_RUNTIME_CONFIG.lang,
|
||||
src = 'https://cdn.jsdelivr.net/pyodide/v0.21.2/full/pyodide.js',
|
||||
name = 'pyodide-default',
|
||||
lang = 'python',
|
||||
) {
|
||||
logger.info('Runtime config:', { name, lang, src });
|
||||
super();
|
||||
|
||||
Reference in New Issue
Block a user