Skip to content
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

Serve JS dependency files locally #186

Merged
merged 3 commits into from
Oct 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.swn
*.sqlite3
*.map
!pyodide.js.map
__target__
build
dist
Expand Down
1 change: 1 addition & 0 deletions pyp5js/http/static/js/pyodide/packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info": {"arch": "wasm32", "platform": "Emscripten-1.0"}, "packages": {"asciitree": {"name": "asciitree", "version": "0.3.3", "depends": [], "imports": ["asciitree"]}, "astropy": {"name": "astropy", "version": "3.2.3", "depends": ["distutils", "numpy"], "imports": ["astropy"]}, "atomicwrites": {"name": "atomicwrites", "version": "1.4.0", "depends": [], "imports": ["atomicwrites"]}, "attrs": {"name": "attrs", "version": "21.2.0", "depends": ["six"], "imports": ["attr"]}, "autograd": {"name": "autograd", "version": "1.3", "depends": ["numpy", "future"], "imports": ["autograd"]}, "beautifulsoup4": {"name": "beautifulsoup4", "version": "4.9.3", "depends": ["soupsieve"], "imports": ["bs4"]}, "biopython": {"name": "biopython", "version": "1.79", "depends": ["numpy"], "imports": ["Bio"]}, "bleach": {"name": "bleach", "version": "3.3.0", "depends": ["webencodings", "packaging", "six"], "imports": ["bleach"]}, "bokeh": {"name": "bokeh", "version": "2.3.3", "depends": ["distutils", "numpy", "jinja2", "pillow", "python-dateutil", "six", "typing-extensions", "pyyaml"], "imports": ["bokeh"]}, "cffi": {"name": "cffi", "version": "1.14.6", "depends": ["pycparser"], "imports": ["cffi"]}, "cffi_example": {"name": "cffi_example", "version": "0.1", "depends": ["cffi"], "imports": ["cffi_example"]}, "clapack": {"name": "CLAPACK", "version": "3.2.1", "shared_library": true, "depends": [], "imports": ["CLAPACK"]}, "cloudpickle": {"name": "cloudpickle", "version": "1.6.0", "depends": [], "imports": ["cloudpickle"]}, "cssselect": {"name": "cssselect", "version": "1.1.0", "depends": [], "imports": ["cssselect"]}, "cycler": {"name": "cycler", "version": "0.10.0", "depends": ["six"], "imports": ["cycler"]}, "cytoolz": {"name": "cytoolz", "version": "0.11.0", "depends": ["nose", "toolz"], "imports": ["cytoolz"]}, "decorator": {"name": "decorator", "version": "5.0.9", "depends": [], "imports": ["decorator"]}, "distlib": {"name": "distlib", "version": "0.3.1", "depends": [], "imports": ["distlib"]}, "distutils": {"name": "distutils", "version": "1.0", "depends": [], "imports": ["distutils"]}, "docutils": {"name": "docutils", "version": "0.17.1", "depends": [], "imports": ["docutils"]}, "freesasa": {"name": "freesasa", "version": "2.1.0", "depends": [], "imports": ["freesasa"]}, "future": {"name": "future", "version": "0.18.2", "depends": [], "imports": ["future"]}, "html5lib": {"name": "html5lib", "version": "1.1", "depends": ["webencodings", "six"], "imports": ["html5lib"]}, "imageio": {"name": "imageio", "version": "2.9.0", "depends": ["numpy", "pillow"], "imports": ["imageio"]}, "iniconfig": {"name": "iniconfig", "version": "1.1.1", "depends": [], "imports": ["iniconfig"]}, "jedi": {"name": "jedi", "version": "0.18.0", "depends": ["parso"], "imports": ["jedi"]}, "jinja2": {"name": "Jinja2", "version": "3.0.1", "depends": ["markupsafe"], "imports": ["jinja2"]}, "joblib": {"name": "joblib", "version": "0.11", "depends": ["distutils"], "imports": ["joblib"]}, "kiwisolver": {"name": "kiwisolver", "version": "1.3.1", "depends": [], "imports": ["kiwisolver"]}, "lxml": {"name": "lxml", "version": "4.4.1", "depends": ["beautifulsoup4", "cssselect", "html5lib"], "imports": ["lxml", "lxml.etree", "lxml.objectify"]}, "markupsafe": {"name": "MarkupSafe", "version": "2.0.1", "depends": [], "imports": ["markupsafe"]}, "matplotlib": {"name": "matplotlib", "version": "3.3.3", "depends": ["distutils", "cycler", "kiwisolver", "numpy", "pillow", "pyparsing", "python-dateutil", "pytz"], "imports": ["matplotlib", "mpl_toolkits"]}, "micropip": {"name": "micropip", "version": "0.1", "depends": ["pyparsing", "packaging", "distutils"], "imports": ["micropip"]}, "mne": {"name": "mne", "version": "0.23.0", "depends": ["distutils", "numpy", "scipy"], "imports": ["mne"]}, "more-itertools": {"name": "more-itertools", "version": "8.8.0", "depends": [], "imports": ["more_itertools"]}, "mpmath": {"name": "mpmath", "version": "1.2.1", "depends": [], "imports": ["mpmath"]}, "msgpack": {"name": "msgpack", "version": "1.0.2", "depends": [], "imports": ["msgpack"]}, "networkx": {"name": "networkx", "version": "2.5.1", "depends": ["decorator", "setuptools", "matplotlib", "numpy"], "imports": ["networkx", "networkx.algorithms", "networkx.algorithms.approximation", "networkx.algorithms.assortativity", "networkx.algorithms.bipartite", "networkx.algorithms.centrality", "networkx.algorithms.chordal", "networkx.algorithms.coloring", "networkx.algorithms.community", "networkx.algorithms.components", "networkx.algorithms.connectivity", "networkx.algorithms.flow", "networkx.algorithms.isomorphism", "networkx.algorithms.link_analysis", "networkx.algorithms.node_classification", "networkx.algorithms.operators", "networkx.algorithms.shortest_paths", "networkx.algorithms.traversal", "networkx.algorithms.tree", "networkx.classes", "networkx.drawing", "networkx.generators", "networkx.linalg", "networkx.readwrite", "networkx.readwrite.json_graph", "networkx.utils"]}, "nlopt": {"name": "nlopt", "version": "2.7.0", "depends": ["numpy"], "imports": ["nlopt"]}, "nltk": {"name": "nltk", "version": "3.6.2", "depends": ["regex"], "imports": ["nltk", "sqlite3"]}, "nose": {"name": "nose", "version": "1.3.7", "depends": ["setuptools"], "imports": ["nose"]}, "numcodecs": {"name": "numcodecs", "version": "0.8.0", "depends": ["numpy", "msgpack"], "imports": ["numcodecs"]}, "numpy": {"name": "numpy", "version": "1.17.5", "depends": [], "imports": ["numpy"]}, "optlang": {"name": "optlang", "version": "1.5.2", "depends": ["sympy", "six", "swiglpk"], "imports": ["optlang", "optlang.glpk_interface", "optlang.symbolics"]}, "packaging": {"name": "packaging", "version": "21.0", "depends": ["pyparsing"], "imports": ["packaging"]}, "pandas": {"name": "pandas", "version": "1.0.5", "depends": ["distutils", "numpy", "python-dateutil", "pytz"], "imports": ["pandas"]}, "parso": {"name": "parso", "version": "0.8.2", "depends": [], "imports": ["parso"]}, "patsy": {"name": "patsy", "version": "0.5.1", "depends": ["numpy", "six"], "imports": ["patsy"]}, "pillow": {"name": "pillow", "version": "8.3.1", "depends": [], "imports": ["PIL"]}, "pluggy": {"name": "pluggy", "version": "0.13.1", "depends": [], "imports": ["pluggy"]}, "py": {"name": "py", "version": "1.9.0", "depends": [], "imports": ["py", "py.code"]}, "pycparser": {"name": "pycparser", "version": "2.20", "depends": [], "imports": ["pycparser"]}, "pygments": {"name": "Pygments", "version": "2.9.0", "depends": [], "imports": ["pygments"]}, "pyodide-interrupts": {"name": "pyodide-interrupts", "version": "0.1.1", "depends": [], "imports": ["pyodide_interrupts"]}, "pyparsing": {"name": "pyparsing", "version": "2.4.7", "depends": [], "imports": ["pyparsing"]}, "pyrtl": {"name": "pyrtl", "version": "0.10.0", "depends": ["pyparsing", "six"], "imports": ["pyrtl"]}, "pytest": {"name": "pytest", "version": "6.2.4", "depends": ["atomicwrites", "attrs", "more-itertools", "pluggy", "py", "setuptools", "six", "iniconfig"], "imports": ["pytest"]}, "python-dateutil": {"name": "python-dateutil", "version": "2.8.1", "depends": ["six"], "imports": ["dateutil"]}, "python-sat": {"name": "python-sat", "version": "0.1.6.dev6", "depends": ["six"], "imports": ["pysat"]}, "pytz": {"name": "pytz", "version": "2021.1", "depends": [], "imports": ["pytz"]}, "pywavelets": {"name": "pywavelets", "version": "1.1.1", "depends": ["distutils", "numpy", "matplotlib", "scipy"], "imports": ["pywt"]}, "pyyaml": {"name": "pyyaml", "version": "5.4.1", "depends": [], "imports": ["yaml"]}, "regex": {"name": "regex", "version": "2021.7.6", "depends": [], "imports": ["regex"]}, "retrying": {"name": "retrying", "version": "1.3.3", "depends": ["six"], "imports": ["retrying"]}, "scikit-image": {"name": "scikit-image", "version": "0.15.0", "depends": ["distutils", "numpy", "scipy", "matplotlib", "networkx", "pillow", "imageio", "pywavelets"], "imports": ["skimage"]}, "scikit-learn": {"name": "scikit-learn", "version": "0.22.2", "depends": ["numpy", "scipy", "joblib"], "imports": ["sklearn", "sklearn.calibration", "sklearn.cluster", "sklearn.compose", "sklearn.covariance", "sklearn.cross_decomposition", "sklearn.datasets", "sklearn.decomposition", "sklearn.discriminant_analysis", "sklearn.dummy", "sklearn.ensemble", "sklearn.exceptions", "sklearn.externals", "sklearn.feature_extraction", "sklearn.feature_selection", "sklearn.gaussian_process", "sklearn.impute", "sklearn.isotonic", "sklearn.kernel_approximation", "sklearn.kernel_ridge", "sklearn.linear_model", "sklearn.manifold", "sklearn.metrics", "sklearn.mixture", "sklearn.model_selection", "sklearn.multiclass", "sklearn.multioutput", "sklearn.naive_bayes", "sklearn.neighbors", "sklearn.neural_network", "sklearn.pipeline", "sklearn.preprocessing", "sklearn.random_projection", "sklearn.semi_supervised", "sklearn.svm", "sklearn.tree", "sklearn.utils"]}, "scipy": {"name": "scipy", "version": "0.17.1", "depends": ["numpy", "clapack"], "imports": ["scipy", "scipy.cluster", "scipy.constants", "scipy.fftpack", "scipy.odr", "scipy.sparse", "scipy.interpolate", "scipy.integrate", "scipy.linalg", "scipy.misc", "scipy.ndimage", "scipy.spatial", "scipy.special"]}, "setuptools": {"name": "setuptools", "version": "57.1.0", "depends": ["distutils", "pyparsing"], "imports": ["setuptools", "pkg_resources"]}, "six": {"name": "six", "version": "1.16.0", "depends": [], "imports": ["six"]}, "soupsieve": {"name": "soupsieve", "version": "2.2.1", "depends": ["beautifulsoup4"], "imports": ["soupsieve"]}, "statsmodels": {"name": "statsmodels", "version": "0.9.0", "depends": ["distutils", "numpy", "scipy", "pandas", "patsy"], "imports": ["statsmodels"]}, "swiglpk": {"name": "swiglpk", "version": "4.65.1", "depends": [], "imports": ["swiglpk"]}, "sympy": {"name": "sympy", "version": "1.8", "depends": ["distutils", "mpmath"], "imports": ["sympy"]}, "test": {"name": "test", "version": "1.0", "depends": [], "imports": ["test"]}, "toolz": {"name": "toolz", "version": "0.11.1", "depends": [], "imports": ["toolz"]}, "traits": {"name": "traits", "version": "6.2.0", "depends": [], "imports": ["traits"]}, "typing-extensions": {"name": "typing-extensions", "version": "3.10.0.0", "depends": [], "imports": ["typing_extensions"]}, "uncertainties": {"name": "uncertainties", "version": "3.1.5", "depends": ["future"], "imports": ["uncertainties"]}, "webencodings": {"name": "webencodings", "version": "0.5.1", "depends": [], "imports": ["webencodings"]}, "xlrd": {"name": "xlrd", "version": "2.0.1", "depends": [], "imports": ["xlrd"]}, "yt": {"name": "yt", "version": "3.6.1", "depends": ["numpy", "matplotlib", "sympy", "setuptools"], "imports": ["yt"]}, "zarr": {"name": "zarr", "version": "2.8.3", "depends": ["numpy", "asciitree", "numcodecs"], "imports": ["zarr"]}}}
Binary file added pyp5js/http/static/js/pyodide/pyodide.asm.data
Binary file not shown.
27 changes: 27 additions & 0 deletions pyp5js/http/static/js/pyodide/pyodide.asm.js

Large diffs are not rendered by default.

Binary file added pyp5js/http/static/js/pyodide/pyodide.asm.wasm
Binary file not shown.
1 change: 1 addition & 0 deletions pyp5js/http/static/js/pyodide/pyodide.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions pyp5js/http/static/js/pyodide/pyodide_v0.18.1.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions pyp5js/http/templates/view_sketch.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{% block title %}{{ sketch_name }}{% endblock title %}

{% block extra_head %}
<link rel="stylesheet" href="/static/styles/highlightjs.min.css">
<style>
html {
overflow-y: scroll;
Expand Down Expand Up @@ -121,7 +120,7 @@
</script>

{% if live_run %}
<script src="https://pyodide-cdn2.iodide.io/v0.18.1/full/pyodide.js"></script>
<script src="/static/js/pyodide/pyodide_v0.18.1.js"></script>
{% endif %}

<script src="{{ p5_js_url }}"></script>
Expand Down
2 changes: 1 addition & 1 deletion pyp5js/templates/pyodide/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<title>{{ sketch_name }} - pyp5js (using pyodide)</title>
<style> body, html, canvas {padding: 0; margin: 0; overflow: hidden;} </style>

<script src="https://pyodide-cdn2.iodide.io/v0.18.1/full/pyodide.js"></script>
<script src="/static/js/pyodide/pyodide_v0.18.1.js"></script>
<script src="{{ p5_js_url }}"></script>
<script src="{{ sketch_js_url }}" type="module"></script>
</head>
Expand Down
2 changes: 1 addition & 1 deletion pyp5js/templates/pyodide/target_sketch.js.template
Original file line number Diff line number Diff line change
Expand Up @@ -1648,7 +1648,7 @@ function runCode() {

async function main() {
const config = {
indexURL : "https://pyodide-cdn2.iodide.io/v0.18.1/full/",
indexURL : "/static/js/pyodide/",
fullStdLib: false,
}
window.pyodide = await loadPyodide(config);
Expand Down