-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #195 from berinhard/feature/serve-pyodide-locally
Feature/serve pyodide locally
- Loading branch information
Showing
15 changed files
with
163 additions
and
55 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
TRANSCRYPT_INTERPRETER = 'transcrypt' | ||
PYODIDE_INTERPRETER = 'pyodide' | ||
P5_JS_CDN = 'https://cdn.jsdelivr.net/npm/[email protected]/lib/p5.min.js' | ||
PYODIDE_JS_CDN = 'https://cdn.jsdelivr.net/pyodide/v0.18.1/full/pyodide.js' | ||
|
||
|
||
class SketchConfig: | ||
|
||
|
@@ -19,6 +21,7 @@ def __init__(self, interpreter, **kwargs): | |
self.interpreter = interpreter | ||
self.index_template = kwargs.get("index_template", "") | ||
self.p5_js_url = kwargs.get("p5_js_url", P5_JS_CDN) | ||
self.pyodide_js_url = kwargs.get("pyodide_js_url", PYODIDE_JS_CDN) | ||
|
||
@property | ||
def index_template_path(self): | ||
|
@@ -31,10 +34,12 @@ def write(self, fname): | |
with open(fname, "w") as fd: | ||
data = { | ||
"interpreter": self.interpreter, | ||
"index_template": index_template, | ||
# TODO: also store pyodide_js_url | ||
"p5_js_url": self.p5_js_url, | ||
} | ||
if self.index_template: | ||
data.update({"index_template": index_template}) | ||
if self.is_pyodide: | ||
data.update({"pyodide_js_url": self.pyodide_js_url}) | ||
json.dump(data, fd) | ||
|
||
@property | ||
|
This file contains 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 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 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 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 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 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 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 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 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
Oops, something went wrong.