-
Notifications
You must be signed in to change notification settings - Fork 1.5k
support different pyodide versions #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fpliger
merged 11 commits into
main
from
fpliger/172_support_different_pyodide_versions
May 11, 2022
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2dde43e
add PyLoader class
fpliger 5266c99
create global loader during app creation time and remove it when pysc…
fpliger a8e00c7
make the loader global and open/close when apps is starting. Also add…
fpliger 25da2ea
add pyconfig file
fpliger 271024a
auto add global config if there's no config set in the page
fpliger 48fed33
export initializer type
fpliger e5e6b74
define type for config
fpliger b03e7a9
move initialization out of svelte file, into app config
fpliger d31392d
Merge branch 'main' into fpliger/172_support_different_pyodide_versions
fpliger a3771ea
change runtimes from strings to objects
fpliger c4a25a1
fix typo
fpliger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
change runtimes from strings to objects
- Loading branch information
commit a3771ea0bc5fb7822174747e2c89eb825ed3556c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,14 +5,24 @@ import { loadInterpreter } from '../interpreter'; | |
import type { PyScript } from './pyscript'; | ||
|
||
|
||
const DEFAULT_RUNTIME = "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js"; | ||
const DEFAULT_RUNTIME = { | ||
src: "https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js", | ||
name: "pyodide-default", | ||
lang: "python" | ||
} | ||
|
||
export type Runtime = { | ||
src: string; | ||
name?: string; | ||
lang?: string; | ||
}; | ||
|
||
export type AppConfig = { | ||
autoclose_loader: boolean; | ||
name?: string; | ||
version?: string; | ||
runtimes?: Array<string>; | ||
}; | ||
runtimes?: Array<Runtime>; | ||
}; | ||
|
||
let appConfig_: AppConfig = { | ||
autoclose_loader: true, | ||
|
@@ -169,8 +179,8 @@ export class PyConfig extends BaseEvalElement { | |
console.log("Initializing runetimes...") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo? |
||
for (const runtime of this.values.runtimes) { | ||
const script = document.createElement("script"); // create a script DOM node | ||
const runtimeSpec = new PyodideRuntime(runtime); | ||
script.src = runtime; // set its src to the provided URL | ||
const runtimeSpec = new PyodideRuntime(runtime.src); | ||
script.src = runtime.src; // set its src to the provided URL | ||
script.onload = () => { | ||
runtimeSpec.initialize(); | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like this pattern