From c70e12107821145224ad4a34b5bc8fe4ecff9a8b Mon Sep 17 00:00:00 2001
From: Madhur Tandon <20173739+madhur-tandon@users.noreply.github.com>
Date: Tue, 4 Oct 2022 19:00:39 +0530
Subject: [PATCH] eliminate py-env altogether (#775)
* examples use toml now
* use 0.21.2 for now
* change config in docs
* fix pre-commit
---
docs/_static/examples/what-is-pyscript.html | 10 +-
docs/tutorials/getting-started.md | 103 +--------------
examples/altair.html | 10 +-
examples/antigravity.html | 10 +-
examples/bokeh.html | 13 +-
examples/bokeh_interactive.html | 13 +-
examples/folium.html | 8 +-
examples/matplotlib.html | 6 +-
examples/message_passing.html | 14 +-
examples/micrograd_ai.html | 10 +-
examples/numpy_canvas_fractals.html | 26 ++--
examples/panel.html | 14 +-
examples/panel_deckgl.html | 17 ++-
examples/panel_kmeans.html | 19 ++-
examples/panel_stream.html | 17 ++-
examples/repl.html | 11 +-
examples/repl2.html | 21 ++-
examples/simple_clock.html | 6 +-
examples/todo-pylist.html | 6 +-
examples/todo.html | 6 +-
examples/toga/freedom.html | 16 +--
pyscriptjs/package-lock.json | 134 +++++++++-----------
pyscriptjs/package.json | 2 -
pyscriptjs/src/components/pyenv.ts | 82 ------------
pyscriptjs/src/main.ts | 2 -
pyscriptjs/src/pyodide.ts | 2 +-
pyscriptjs/src/utils.ts | 2 +-
27 files changed, 193 insertions(+), 387 deletions(-)
delete mode 100644 pyscriptjs/src/components/pyenv.ts
diff --git a/docs/_static/examples/what-is-pyscript.html b/docs/_static/examples/what-is-pyscript.html
index d4264d22..e469bf61 100644
--- a/docs/_static/examples/what-is-pyscript.html
+++ b/docs/_static/examples/what-is-pyscript.html
@@ -16,10 +16,12 @@
}
}
-
- - numpy
- - matplotlib
-
+
+ packages = [
+ "numpy",
+ "matplotlib"
+ ]
+
diff --git a/docs/tutorials/getting-started.md b/docs/tutorials/getting-started.md
index c281b487..2c14b176 100644
--- a/docs/tutorials/getting-started.md
+++ b/docs/tutorials/getting-started.md
@@ -258,9 +258,12 @@ OR in JSON like
```
If your `.whl` is not a pure Python wheel, then open a PR or issue with [pyodide](https://github.com/pyodide/pyodide) to get it added [here](https://github.com/pyodide/pyodide/tree/main/packages).
+
If there's enough popular demand, the pyodide team will likely work on supporting your package. Regardless, things will likely move faster if you make the PR and consult with the team to get unblocked.
+
For example, NumPy and Matplotlib are available. Notice here we're using ``
as a shortcut, which takes the expression on the last line of the script and runs `pyscript.write('plot', fig)`.
+
```html
@@ -290,9 +293,11 @@ as a shortcut, which takes the expression on the last line of the script and run
```
### Local modules
+
In addition to packages, you can declare local Python modules that will
be imported in the `` tag. For example, we can place the random
number generation steps in a function in the file `data.py`.
+
```python
# data.py
import numpy as np
@@ -377,104 +382,6 @@ OR in JSON like
If this `"magic"` key is present in config supplied via `src` and also present in config supplied via `inline`, then the value in the inline config is given priority i.e. the overriding process also works for custom keys.
-## The py-env tag (Deprecated)
-
-**The tag is deprecated as of `2022.09.1` release but you can still use the functionality explained below. It will be removed in the next release. To specify packages in the recommended way, please see the section.**
-
-In addition to the [Python Standard Library](https://docs.python.org/3/library/) and
-the `pyscript` module, many 3rd-party OSS packages will work out-of-the-box with PyScript.
-
-In order to use them, you will need to declare the dependencies using the `` tag in the
-HTML head. You can also link to `.whl` files directly on disk like in our [toga example](https://github.com/pyscript/pyscript/blob/main/examples/toga/freedom.html).
-
-```
-
-- './static/wheels/travertino-0.1.3-py3-none-any.whl'
-
-```
-
-If your `.whl` is not a pure Python wheel, then open a PR or issue with [pyodide](https://github.com/pyodide/pyodide) to get it added [here](https://github.com/pyodide/pyodide/tree/main/packages).
-If there's enough popular demand, the pyodide team will likely work on supporting your package. Regardless, things will likely move faster if you make the PR and consult with the team to get unblocked.
-
-For example, NumPy and Matplotlib are available. Notice here we're using ``
-as a shortcut, which takes the expression on the last line of the script and runs `pyscript.write('plot', fig)`.
-
-```html
-
-
-
-
-
- - numpy
- - matplotlib
-
-
-
-
- Let's plot random numbers
-
-
- import matplotlib.pyplot as plt
- import numpy as np
-
- x = np.random.randn(1000)
- y = np.random.randn(1000)
-
- fig, ax = plt.subplots()
- ax.scatter(x, y)
- fig
-
-
-
-```
-
-### Local modules with py-env (Deprecated)
-
-**The tag is deprecated as of `2022.09.1` release but you can still use the functionality explained below. It will be removed in the next release. To specify local modules in the recommended way, please see the section.**
-
-In addition to packages, you can declare local Python modules that will
-be imported in the `` tag. For example, we can place the random
-number generation steps in a function in the file `data.py`.
-```python
-# data.py
-import numpy as np
-def make_x_and_y(n):
- x = np.random.randn(n)
- y = np.random.randn(n)
- return x, y
-```
-
-In the HTML tag ``, paths to local modules are provided in the
-`paths:` key.
-
-```html
-
-
-
-
-
- - numpy
- - matplotlib
- - paths:
- - ./data.py
-
-
-
-
- Let's plot random numbers
-
-
- import matplotlib.pyplot as plt
- from data import make_x_and_y
- x, y = make_x_and_y(n=1000)
- fig, ax = plt.subplots()
- ax.scatter(x, y)
- fig
-
-
-
-```
-
## The py-repl tag
The `` tag creates a REPL component that is rendered to the page as a code editor, allowing you to write executable code inline.
diff --git a/examples/altair.html b/examples/altair.html
index 68b3b490..71fe3e3e 100644
--- a/examples/altair.html
+++ b/examples/altair.html
@@ -6,11 +6,11 @@
-packages = [
- "altair",
- "pandas",
- "vega_datasets"
-]
+ packages = [
+ "altair",
+ "pandas",
+ "vega_datasets"
+ ]
diff --git a/examples/antigravity.html b/examples/antigravity.html
index 611f6ea6..bf73bed9 100644
--- a/examples/antigravity.html
+++ b/examples/antigravity.html
@@ -5,12 +5,12 @@
+
+ paths = [
+ "./antigravity.py"
+ ]
+
-
-paths = [
- "./antigravity.py"
-]
-
Based on xkcd: antigravity https://xkcd.com/353/.
diff --git a/examples/bokeh.html b/examples/bokeh.html
index 44380afa..b7c41f5e 100644
--- a/examples/bokeh.html
+++ b/examples/bokeh.html
@@ -14,15 +14,14 @@
-
+
+ packages = [
+ "bokeh",
+ "numpy"
+ ]
+
-
-packages = [
- "bokeh",
- "numpy"
-]
-
Bokeh Example
diff --git a/examples/bokeh_interactive.html b/examples/bokeh_interactive.html
index 7eb2fc60..2b73e16f 100644
--- a/examples/bokeh_interactive.html
+++ b/examples/bokeh_interactive.html
@@ -14,15 +14,14 @@
-
+
+ packages = [
+ "bokeh",
+ "numpy"
+ ]
+
-
-packages = [
- "bokeh",
- "numpy"
-]
-
Bokeh Example
diff --git a/examples/folium.html b/examples/folium.html
index a3aeb4c2..d698e081 100644
--- a/examples/folium.html
+++ b/examples/folium.html
@@ -6,10 +6,10 @@
-packages = [
- "folium",
- "pandas"
-]
+ packages = [
+ "folium",
+ "pandas"
+ ]
diff --git a/examples/matplotlib.html b/examples/matplotlib.html
index 205efa14..bf363edf 100644
--- a/examples/matplotlib.html
+++ b/examples/matplotlib.html
@@ -6,9 +6,9 @@
-packages = [
- "matplotlib"
-]
+ packages = [
+ "matplotlib"
+ ]
diff --git a/examples/message_passing.html b/examples/message_passing.html
index 329810d6..d9aa6e30 100644
--- a/examples/message_passing.html
+++ b/examples/message_passing.html
@@ -4,16 +4,16 @@
+
+ packages = [
+ "numpy",
+ "networkx",
+ "matplotlib"
+ ]
+
-
-packages = [
- "numpy",
- "networkx",
- "matplotlib"
-]
-
import numpy as np
import networkx as nx
diff --git a/examples/micrograd_ai.html b/examples/micrograd_ai.html
index a31a272b..1bc92c10 100644
--- a/examples/micrograd_ai.html
+++ b/examples/micrograd_ai.html
@@ -10,11 +10,11 @@
-packages = [
- "micrograd",
- "numpy",
- "matplotlib"
-]
+ packages = [
+ "micrograd",
+ "numpy",
+ "matplotlib"
+ ]
diff --git a/examples/numpy_canvas_fractals.html b/examples/numpy_canvas_fractals.html
index 98588f1f..39c76658 100644
--- a/examples/numpy_canvas_fractals.html
+++ b/examples/numpy_canvas_fractals.html
@@ -28,6 +28,19 @@
}
+
+ {
+ "packages": [
+ "numpy",
+ "sympy"
+ ],
+ "paths": [
+ "./palettes.py",
+ "./fractals.py"
+ ]
+ }
+
+
@@ -78,19 +91,6 @@
-
-{
- "packages": [
- "numpy",
- "sympy"
- ],
- "paths": [
- "./palettes.py",
- "./fractals.py"
- ]
-}
-
-
from pyodide.ffi import to_js, create_proxy
diff --git a/examples/panel.html b/examples/panel.html
index 78dedf76..d417fdf7 100644
--- a/examples/panel.html
+++ b/examples/panel.html
@@ -9,14 +9,14 @@
+
+ packages = [
+ "bokeh",
+ "numpy",
+ "panel==0.13.1"
+ ]
+
-
-packages = [
- "bokeh",
- "numpy",
- "panel==0.13.1"
-]
-
Panel Example
diff --git a/examples/panel_deckgl.html b/examples/panel_deckgl.html
index c387d3bb..f7d5f87e 100644
--- a/examples/panel_deckgl.html
+++ b/examples/panel_deckgl.html
@@ -40,17 +40,16 @@
+
+ packages = [
+ "bokeh",
+ "numpy",
+ "pandas",
+ "panel==0.13.1"
+ ]
+
-
-packages = [
- "bokeh",
- "numpy",
- "pandas",
- "panel==0.13.1"
-]
-
-
diff --git a/examples/panel_kmeans.html b/examples/panel_kmeans.html
index e7c7fe23..4c06ab17 100644
--- a/examples/panel_kmeans.html
+++ b/examples/panel_kmeans.html
@@ -41,18 +41,17 @@
+
+ packages = [
+ "altair",
+ "numpy",
+ "pandas",
+ "scikit-learn",
+ "panel==0.13.1"
+ ]
+
-
-packages = [
- "altair",
- "numpy",
- "pandas",
- "scikit-learn",
- "panel==0.13.1"
-]
-
-
diff --git a/examples/panel_stream.html b/examples/panel_stream.html
index 72efb89c..1bbda1d6 100644
--- a/examples/panel_stream.html
+++ b/examples/panel_stream.html
@@ -32,17 +32,16 @@
+
+ packages = [
+ "bokeh",
+ "numpy",
+ "pandas",
+ "panel==0.13.1"
+ ]
+
-
-packages = [
- "bokeh",
- "numpy",
- "pandas",
- "panel==0.13.1"
-]
-
-
diff --git a/examples/repl.html b/examples/repl.html
index f9b3c82f..ba3979a9 100644
--- a/examples/repl.html
+++ b/examples/repl.html
@@ -9,14 +9,13 @@
+
+ paths = [
+ "./antigravity.py"
+ ]
+
-
-paths = [
- "./antigravity.py"
-]
-
-
pyscript REPL
Tip: press Shift-ENTER to evaluate a cell
diff --git a/examples/repl2.html b/examples/repl2.html
index c477e1fd..91786c0e 100644
--- a/examples/repl2.html
+++ b/examples/repl2.html
@@ -11,19 +11,18 @@
+
+ packages = [
+ "bokeh",
+ "numpy"
+ ]
+ paths = [
+ "./utils.py",
+ "./antigravity.py"
+ ]
+
-
-packages = [
- "bokeh",
- "numpy"
-]
-paths = [
- "./utils.py",
- "./antigravity.py"
-]
-
-
Custom REPL
diff --git a/examples/simple_clock.html b/examples/simple_clock.html
index 87dcdc90..bc65f37c 100644
--- a/examples/simple_clock.html
+++ b/examples/simple_clock.html
@@ -11,9 +11,9 @@
-paths = [
- "./utils.py"
-]
+ paths = [
+ "./utils.py"
+ ]
diff --git a/examples/todo-pylist.html b/examples/todo-pylist.html
index 8150cb5d..865b4633 100644
--- a/examples/todo-pylist.html
+++ b/examples/todo-pylist.html
@@ -10,9 +10,9 @@
-paths = [
- "./utils.py"
-]
+ paths = [
+ "./utils.py"
+ ]
diff --git a/examples/todo.html b/examples/todo.html
index a5fb9210..7e47c390 100644
--- a/examples/todo.html
+++ b/examples/todo.html
@@ -11,9 +11,9 @@
-paths = [
- "./utils.py"
-]
+ paths = [
+ "./utils.py"
+ ]
diff --git a/examples/toga/freedom.html b/examples/toga/freedom.html
index abaa5f5a..2df84136 100644
--- a/examples/toga/freedom.html
+++ b/examples/toga/freedom.html
@@ -16,6 +16,14 @@
Loading...
+
+ packages = [
+ "./static/wheels/travertino-0.1.3-py3-none-any.whl",
+ "./static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl",
+ "./static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl",
+ "./static/wheels/freedom-0.0.1-py3-none-any.whl"
+ ]
+
Loading...
@@ -34,14 +42,6 @@
crossorigin="anonymous">
-
-packages = [
- "./static/wheels/travertino-0.1.3-py3-none-any.whl",
- "./static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl",
- "./static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl",
- "./static/wheels/freedom-0.0.1-py3-none-any.whl"
-]
-
from toga_web.dom import handle as dom_handle
diff --git a/pyscriptjs/package-lock.json b/pyscriptjs/package-lock.json
index 8abfd37b..997918a7 100644
--- a/pyscriptjs/package-lock.json
+++ b/pyscriptjs/package-lock.json
@@ -14,7 +14,6 @@
"@codemirror/theme-one-dark": "^0.19.1",
"@fortawesome/free-solid-svg-icons": "^6.0.0",
"codemirror": "^5.65.3",
- "js-yaml": "^4.1.0",
"sirv-cli": "^1.0.0",
"svelte-fa": "^2.4.0",
"svelte-promisable-stores": "^0.1.3"
@@ -26,7 +25,6 @@
"@rollup/plugin-typescript": "^8.4.0",
"@tsconfig/svelte": "^1.0.0",
"@types/jest": "^28.1.6",
- "@types/js-yaml": "^4.0.5",
"@types/node": "^18.7.11",
"@typescript-eslint/eslint-plugin": "^5.36.0",
"@typescript-eslint/parser": "^5.36.0",
@@ -1689,9 +1687,9 @@
}
},
"node_modules/@types/babel__traverse": {
- "version": "7.18.1",
- "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.1.tgz",
- "integrity": "sha512-FSdLaZh2UxaMuLp9lixWaHq/golWTRWOnRsAXzDTDSDOQLuZb1nsdCt6pJSPWSEQt2eFZ2YVk3oYhn+1kLMeMA==",
+ "version": "7.18.2",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.2.tgz",
+ "integrity": "sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg==",
"dev": true,
"dependencies": {
"@babel/types": "^7.3.0"
@@ -1765,12 +1763,6 @@
"pretty-format": "^28.0.0"
}
},
- "node_modules/@types/js-yaml": {
- "version": "4.0.5",
- "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
- "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==",
- "dev": true
- },
"node_modules/@types/jsdom": {
"version": "16.2.15",
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-16.2.15.tgz",
@@ -1795,9 +1787,9 @@
"dev": true
},
"node_modules/@types/node": {
- "version": "18.7.18",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.18.tgz",
- "integrity": "sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==",
+ "version": "18.7.19",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.19.tgz",
+ "integrity": "sha512-Sq1itGUKUX1ap7GgZlrzdBydjbsJL/NSQt/4wkAxUJ7/OS5c2WkoN6WSpWc2Yc5wtKMZOUA0VCs/j2XJadN3HA==",
"dev": true
},
"node_modules/@types/parse5": {
@@ -1807,9 +1799,9 @@
"dev": true
},
"node_modules/@types/prettier": {
- "version": "2.7.0",
- "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.0.tgz",
- "integrity": "sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==",
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.1.tgz",
+ "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==",
"dev": true
},
"node_modules/@types/pug": {
@@ -1849,9 +1841,9 @@
"dev": true
},
"node_modules/@types/yargs": {
- "version": "17.0.12",
- "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.12.tgz",
- "integrity": "sha512-Nz4MPhecOFArtm81gFQvQqdV7XYCrWKx5uUt6GNHredFHn1i2mtWqXTON7EPXMtNi1qjtjEM/VCHDhcHsAMLXQ==",
+ "version": "17.0.13",
+ "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.13.tgz",
+ "integrity": "sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg==",
"dev": true,
"dependencies": {
"@types/yargs-parser": "*"
@@ -2200,7 +2192,8 @@
"node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
},
"node_modules/array-union": {
"version": "2.1.0",
@@ -2485,9 +2478,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001409",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001409.tgz",
- "integrity": "sha512-V0mnJ5dwarmhYv8/MzhJ//aW68UpvnQBXv8lJ2QUsvn2pHcmAuNtu8hQEDz37XnA1iE+lRR9CIfGWWpgJ5QedQ==",
+ "version": "1.0.30001406",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001406.tgz",
+ "integrity": "sha512-bWTlaXUy/rq0BBtYShc/jArYfBPjEV95euvZ8JVtO43oQExEN/WquoqpufFjNu4kSpi5cy5kMbNvzztWDfv1Jg==",
"dev": true,
"funding": [
{
@@ -2884,9 +2877,9 @@
}
},
"node_modules/electron-to-chromium": {
- "version": "1.4.256",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.256.tgz",
- "integrity": "sha512-x+JnqyluoJv8I0U9gVe+Sk2st8vF0CzMt78SXxuoWCooLLY2k5VerIBdpvG7ql6GKI4dzNnPjmqgDJ76EdaAKw==",
+ "version": "1.4.261",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.261.tgz",
+ "integrity": "sha512-fVXliNUGJ7XUVJSAasPseBbVgJIeyw5M1xIkgXdTSRjlmCqBbiSTsEdLOCJS31Fc8B7CaloQ/BFAg8By3ODLdg==",
"dev": true
},
"node_modules/emittery": {
@@ -3026,13 +3019,13 @@
}
},
"node_modules/eslint": {
- "version": "8.23.1",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.1.tgz",
- "integrity": "sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==",
+ "version": "8.24.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz",
+ "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.2",
- "@humanwhocodes/config-array": "^0.10.4",
+ "@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
@@ -4559,6 +4552,7 @@
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
"dependencies": {
"argparse": "^2.0.1"
},
@@ -5626,9 +5620,9 @@
}
},
"node_modules/rollup": {
- "version": "2.79.0",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.0.tgz",
- "integrity": "sha512-x4KsrCgwQ7ZJPcFA/SUu6QVcYlO7uRLfLAy0DSA4NS2eG8japdbpM50ToH7z4iObodRYOJ0soneF0iaQRJ6zhA==",
+ "version": "2.79.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
+ "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
"dev": true,
"bin": {
"rollup": "dist/bin/rollup"
@@ -6759,9 +6753,9 @@
}
},
"node_modules/ws": {
- "version": "8.8.1",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz",
- "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==",
+ "version": "8.9.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz",
+ "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==",
"dev": true,
"engines": {
"node": ">=10.0.0"
@@ -8168,9 +8162,9 @@
}
},
"@types/babel__traverse": {
- "version": "7.18.1",
- "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.1.tgz",
- "integrity": "sha512-FSdLaZh2UxaMuLp9lixWaHq/golWTRWOnRsAXzDTDSDOQLuZb1nsdCt6pJSPWSEQt2eFZ2YVk3oYhn+1kLMeMA==",
+ "version": "7.18.2",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.2.tgz",
+ "integrity": "sha512-FcFaxOr2V5KZCviw1TnutEMVUVsGt4D2hP1TAfXZAMKuHYW3xQhe3jTxNPWutgCJ3/X1c5yX8ZoGVEItxKbwBg==",
"dev": true,
"requires": {
"@babel/types": "^7.3.0"
@@ -8244,12 +8238,6 @@
"pretty-format": "^28.0.0"
}
},
- "@types/js-yaml": {
- "version": "4.0.5",
- "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.5.tgz",
- "integrity": "sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==",
- "dev": true
- },
"@types/jsdom": {
"version": "16.2.15",
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-16.2.15.tgz",
@@ -8274,9 +8262,9 @@
"dev": true
},
"@types/node": {
- "version": "18.7.18",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.18.tgz",
- "integrity": "sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==",
+ "version": "18.7.19",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.7.19.tgz",
+ "integrity": "sha512-Sq1itGUKUX1ap7GgZlrzdBydjbsJL/NSQt/4wkAxUJ7/OS5c2WkoN6WSpWc2Yc5wtKMZOUA0VCs/j2XJadN3HA==",
"dev": true
},
"@types/parse5": {
@@ -8286,9 +8274,9 @@
"dev": true
},
"@types/prettier": {
- "version": "2.7.0",
- "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.0.tgz",
- "integrity": "sha512-RI1L7N4JnW5gQw2spvL7Sllfuf1SaHdrZpCHiBlCXjIlufi1SMNnbu2teze3/QE67Fg2tBlH7W+mi4hVNk4p0A==",
+ "version": "2.7.1",
+ "resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.1.tgz",
+ "integrity": "sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow==",
"dev": true
},
"@types/pug": {
@@ -8328,9 +8316,9 @@
"dev": true
},
"@types/yargs": {
- "version": "17.0.12",
- "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.12.tgz",
- "integrity": "sha512-Nz4MPhecOFArtm81gFQvQqdV7XYCrWKx5uUt6GNHredFHn1i2mtWqXTON7EPXMtNi1qjtjEM/VCHDhcHsAMLXQ==",
+ "version": "17.0.13",
+ "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.13.tgz",
+ "integrity": "sha512-9sWaruZk2JGxIQU+IhI1fhPYRcQ0UuTNuKuCW9bR5fp7qi2Llf7WDzNa17Cy7TKnh3cdxDOiyTu6gaLS0eDatg==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"
@@ -8546,7 +8534,8 @@
"argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
- "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
},
"array-union": {
"version": "2.1.0",
@@ -8748,9 +8737,9 @@
"dev": true
},
"caniuse-lite": {
- "version": "1.0.30001409",
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001409.tgz",
- "integrity": "sha512-V0mnJ5dwarmhYv8/MzhJ//aW68UpvnQBXv8lJ2QUsvn2pHcmAuNtu8hQEDz37XnA1iE+lRR9CIfGWWpgJ5QedQ==",
+ "version": "1.0.30001406",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001406.tgz",
+ "integrity": "sha512-bWTlaXUy/rq0BBtYShc/jArYfBPjEV95euvZ8JVtO43oQExEN/WquoqpufFjNu4kSpi5cy5kMbNvzztWDfv1Jg==",
"dev": true
},
"chalk": {
@@ -9054,9 +9043,9 @@
}
},
"electron-to-chromium": {
- "version": "1.4.256",
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.256.tgz",
- "integrity": "sha512-x+JnqyluoJv8I0U9gVe+Sk2st8vF0CzMt78SXxuoWCooLLY2k5VerIBdpvG7ql6GKI4dzNnPjmqgDJ76EdaAKw==",
+ "version": "1.4.261",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.261.tgz",
+ "integrity": "sha512-fVXliNUGJ7XUVJSAasPseBbVgJIeyw5M1xIkgXdTSRjlmCqBbiSTsEdLOCJS31Fc8B7CaloQ/BFAg8By3ODLdg==",
"dev": true
},
"emittery": {
@@ -9159,13 +9148,13 @@
}
},
"eslint": {
- "version": "8.23.1",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.23.1.tgz",
- "integrity": "sha512-w7C1IXCc6fNqjpuYd0yPlcTKKmHlHHktRkzmBPZ+7cvNBQuiNjx0xaMTjAJGCafJhQkrFJooREv0CtrVzmHwqg==",
+ "version": "8.24.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz",
+ "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.2",
- "@humanwhocodes/config-array": "^0.10.4",
+ "@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
@@ -10326,6 +10315,7 @@
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
+ "dev": true,
"requires": {
"argparse": "^2.0.1"
}
@@ -11098,9 +11088,9 @@
}
},
"rollup": {
- "version": "2.79.0",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.0.tgz",
- "integrity": "sha512-x4KsrCgwQ7ZJPcFA/SUu6QVcYlO7uRLfLAy0DSA4NS2eG8japdbpM50ToH7z4iObodRYOJ0soneF0iaQRJ6zhA==",
+ "version": "2.79.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz",
+ "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==",
"dev": true,
"requires": {
"fsevents": "~2.3.2"
@@ -11913,9 +11903,9 @@
}
},
"ws": {
- "version": "8.8.1",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.8.1.tgz",
- "integrity": "sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==",
+ "version": "8.9.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.9.0.tgz",
+ "integrity": "sha512-Ja7nszREasGaYUYCI2k4lCKIRTt+y7XuqVoHR44YpI49TtryyqbqvDMn5eqfW7e6HzTukDRIsXqzVHScqRcafg==",
"dev": true,
"requires": {}
},
diff --git a/pyscriptjs/package.json b/pyscriptjs/package.json
index dda09a20..e5f77188 100644
--- a/pyscriptjs/package.json
+++ b/pyscriptjs/package.json
@@ -23,7 +23,6 @@
"@rollup/plugin-typescript": "^8.4.0",
"@tsconfig/svelte": "^1.0.0",
"@types/jest": "^28.1.6",
- "@types/js-yaml": "^4.0.5",
"@types/node": "^18.7.11",
"@typescript-eslint/eslint-plugin": "^5.36.0",
"@typescript-eslint/parser": "^5.36.0",
@@ -54,7 +53,6 @@
"@codemirror/theme-one-dark": "^0.19.1",
"@fortawesome/free-solid-svg-icons": "^6.0.0",
"codemirror": "^5.65.3",
- "js-yaml": "^4.1.0",
"sirv-cli": "^1.0.0",
"svelte-fa": "^2.4.0",
"svelte-promisable-stores": "^0.1.3"
diff --git a/pyscriptjs/src/components/pyenv.ts b/pyscriptjs/src/components/pyenv.ts
deleted file mode 100644
index dd76d754..00000000
--- a/pyscriptjs/src/components/pyenv.ts
+++ /dev/null
@@ -1,82 +0,0 @@
-import * as jsyaml from 'js-yaml';
-
-import { runtimeLoaded, addInitializer } from '../stores';
-import { handleFetchError } from '../utils';
-import type { Runtime } from '../runtime';
-import { getLogger } from '../logger';
-
-const logger = getLogger('py-env');
-
-// Premise used to connect to the first available runtime (can be pyodide or others)
-let runtime: Runtime;
-
-runtimeLoaded.subscribe(value => {
- runtime = value;
-});
-
-export class PyEnv extends HTMLElement {
- shadow: ShadowRoot;
- wrapper: HTMLElement;
- code: string;
- environment: unknown;
- runtime: Runtime;
- env: string[];
- paths: string[];
-
- constructor() {
- super();
-
- this.shadow = this.attachShadow({ mode: 'open' });
- this.wrapper = document.createElement('slot');
- }
-
- connectedCallback() {
- logger.info("The tag is deprecated, please use instead.")
- this.code = this.innerHTML;
- this.innerHTML = '';
-
- const env: string[] = [];
- const paths: string[] = [];
-
- this.environment = jsyaml.load(this.code);
- if (this.environment === undefined) return;
-
- for (const entry of Array.isArray(this.environment) ? this.environment : []) {
- if (typeof entry == 'string') {
- env.push(entry);
- } else if (entry && typeof entry === 'object') {
- const obj = >entry;
- for (const path of Array.isArray(obj.paths) ? obj.paths : []) {
- if (typeof path === 'string') {
- paths.push(path);
- }
- }
- }
- }
-
- this.env = env;
- this.paths = paths;
-
- async function loadEnv() {
- logger.info("Loading env: ", env);
- await runtime.installPackage(env);
- }
-
- async function loadPaths() {
- logger.info("Paths to load: ", paths)
- for (const singleFile of paths) {
- logger.info(` loading path: ${singleFile}`);
- try {
- await runtime.loadFromFile(singleFile);
- } catch (e) {
- //Should we still export full error contents to console?
- handleFetchError(e, singleFile);
- }
- }
- logger.info("All paths loaded");
- }
-
- addInitializer(loadEnv);
- addInitializer(loadPaths);
- }
-}
diff --git a/pyscriptjs/src/main.ts b/pyscriptjs/src/main.ts
index edc570f6..35825473 100644
--- a/pyscriptjs/src/main.ts
+++ b/pyscriptjs/src/main.ts
@@ -4,7 +4,6 @@ import { loadConfigFromElement } from './pyconfig';
import type { AppConfig } from './pyconfig';
import type { Runtime } from './runtime';
import { PyScript } from './components/pyscript';
-import { PyEnv } from './components/pyenv';
import { PyLoader } from './components/pyloader';
import { PyodideRuntime } from './pyodide';
import { getLogger } from './logger';
@@ -31,7 +30,6 @@ class PyScriptApp {
/* eslint-disable @typescript-eslint/no-unused-vars */
const xPyScript = customElements.define('py-script', PyScript);
const xPyLoader = customElements.define('py-loader', PyLoader);
- const xPyEnv = customElements.define('py-env', PyEnv);
/* eslint-disable @typescript-eslint/no-unused-vars */
// add loader to the page body
diff --git a/pyscriptjs/src/pyodide.ts b/pyscriptjs/src/pyodide.ts
index 1c113bae..b000dd2e 100644
--- a/pyscriptjs/src/pyodide.ts
+++ b/pyscriptjs/src/pyodide.ts
@@ -99,7 +99,7 @@ export class PyodideRuntime extends Runtime {
try:
response = await pyfetch("${path}")
except Exception as err:
- console.warn("PyScript: Access to local files (using 'paths:' in py-env) is not available when directly opening a HTML file; you must use a webserver to serve the additional files. See https://github.com/pyscript/pyscript/issues/257#issuecomment-1119595062 on starting a simple webserver with Python.")
+ console.warn("PyScript: Access to local files (using 'paths:' in py-config) is not available when directly opening a HTML file; you must use a webserver to serve the additional files. See https://github.com/pyscript/pyscript/issues/257#issuecomment-1119595062 on starting a simple webserver with Python.")
raise(err)
content = await response.bytes()
with open("${filename}", "wb") as f:
diff --git a/pyscriptjs/src/utils.ts b/pyscriptjs/src/utils.ts
index cb5377a3..eaffcd9b 100644
--- a/pyscriptjs/src/utils.ts
+++ b/pyscriptjs/src/utils.ts
@@ -68,7 +68,7 @@ function handleFetchError(e: Error, singleFile: string) {
let errorContent: string;
if (e.message.includes('TypeError: Failed to fetch')) {
errorContent = `PyScript: Access to local files
- (using "Paths:" in <py-env>)
+ (using "Paths:" in <py-config>)
is not available when directly opening a HTML file;
you must use a webserver to serve the additional files.
See this reference