mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-22 11:45:28 -05:00
Compare commits
4 Commits
2023.11.2
...
fpliger/ex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9e1abf6d1 | ||
|
|
24da768959 | ||
|
|
72955bced9 | ||
|
|
c63c4043d3 |
34
README.md
34
README.md
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
### Summary
|
### Summary
|
||||||
|
|
||||||
PyScript is a framework that allows users to create rich Python applications in the browser using HTML's interface and the power of [Pyodide](https://pyodide.org/en/stable/), [MicroPython](https://micropython.org/) and [WASM](https://webassembly.org/), and modern web technologies.
|
PyScript is a framework that allows users to create rich Python applications in the browser using HTML's interface and the power of [Pyodide](https://pyodide.org/en/stable/), [WASM](https://webassembly.org/), and modern web technologies.
|
||||||
|
|
||||||
To get started see the [getting started tutorial](docs/tutorials/getting-started.md).
|
To get started see the [getting started tutorial](docs/tutorials/getting-started.md).
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ PyScript is a meta project that aims to combine multiple open technologies into
|
|||||||
|
|
||||||
## Try PyScript
|
## Try PyScript
|
||||||
|
|
||||||
To try PyScript, import the appropriate pyscript files into the `<head>` tag of your html page:
|
To try PyScript, import the appropriate pyscript files into the `<head>` tag of your html page with:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<head>
|
<head>
|
||||||
@@ -29,25 +29,14 @@ To try PyScript, import the appropriate pyscript files into the `<head>` tag of
|
|||||||
src="https://pyscript.net/releases/2023.11.1/core.js"
|
src="https://pyscript.net/releases/2023.11.1/core.js"
|
||||||
></script>
|
></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
<script type="py" terminal>
|
|
||||||
from pyscript import display
|
|
||||||
display("Hello World!") # this goes to the DOM
|
|
||||||
print("Hello terminal") # this goes to the terminal
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can then use PyScript components in your html page. PyScript currently offers various ways of running Python code:
|
You can then use PyScript components in your html page. PyScript currently implements the following elements:
|
||||||
|
|
||||||
- `<script type="py">`: can be used to define python code that is executable within the web page.
|
- `<py-script>`: can be used to define python code that is executable within the web page. The element itself is not rendered to the page and is only used to add logic
|
||||||
- `<script type="py" src="hello.py">`: same as above, but the python source is fetched from the given URL.
|
- `<py-repl>`: creates a REPL component that is rendered to the page as a code editor and allows users to write executable code
|
||||||
- `<script type="py" terminal>`: same as above, but also creates a terminal where to display stdout and stderr (e.g., the output of `print()`); `input()` does not work.
|
|
||||||
- `<script type="py" terminal worker>`: run Python inside a web worker: the terminal is fully functional and `input()` works.
|
|
||||||
- `<py-script>`: same as `<script type="py">`, but it is not recommended because if the code contains HTML tags, they could be parsed wrongly.
|
|
||||||
- `<script type="mpy">`: same as above but use MicroPython instead of Python.
|
|
||||||
|
|
||||||
Check out the [official docs](https://docs.pyscript.net) for more detailed documentation.
|
Check out the [the examples directory](examples) folder for more examples on how to use it, all you need to do is open them in Chrome.
|
||||||
|
|
||||||
## How to Contribute
|
## How to Contribute
|
||||||
|
|
||||||
@@ -55,17 +44,6 @@ Read the [contributing guide](CONTRIBUTING.md) to learn about our development pr
|
|||||||
|
|
||||||
Check out the [developing process](https://docs.pyscript.net/latest/contributing) documentation for more information on how to setup your development environment.
|
Check out the [developing process](https://docs.pyscript.net/latest/contributing) documentation for more information on how to setup your development environment.
|
||||||
|
|
||||||
## Community calls and events
|
|
||||||
|
|
||||||
Every Tuesday at 15:30 UTC there is the _PyScript Community Call_ on zoom, where we can talk about PyScript development in the open. Most of the maintainers regularly participate in the call, and everybody is welcome to join.
|
|
||||||
|
|
||||||
Every other Thursday at 16:00 UTC there is the _PyScript FUN_ call: this is a call in which everybody is encouraged to show what they did with PyScript.
|
|
||||||
|
|
||||||
For more details on how to join the calls and up to date schedule, consult the official calendar:
|
|
||||||
|
|
||||||
- [Google calendar](https://calendar.google.com/calendar/u/0/embed?src=d3afdd81f9c132a8c8f3290f5cc5966adebdf61017fca784eef0f6be9fd519e0@group.calendar.google.com&ctz=UTC) in UTC time;
|
|
||||||
- [iCal format](https://calendar.google.com/calendar/ical/d3afdd81f9c132a8c8f3290f5cc5966adebdf61017fca784eef0f6be9fd519e0%40group.calendar.google.com/public/basic.ics).
|
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [Official docs](https://docs.pyscript.net)
|
- [Official docs](https://docs.pyscript.net)
|
||||||
|
|||||||
196
pyscript.core/package-lock.json
generated
196
pyscript.core/package-lock.json
generated
@@ -1,35 +1,34 @@
|
|||||||
{
|
{
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.3.5",
|
"version": "0.3.4",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.3.5",
|
"version": "0.3.4",
|
||||||
"license": "APACHE-2.0",
|
"license": "APACHE-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ungap/with-resolvers": "^0.1.0",
|
"@ungap/with-resolvers": "^0.1.0",
|
||||||
"basic-devtools": "^0.1.6",
|
"basic-devtools": "^0.1.6",
|
||||||
"polyscript": "^0.6.0",
|
"polyscript": "^0.5.11",
|
||||||
"sticky-module": "^0.1.1",
|
"sticky-module": "^0.1.1",
|
||||||
"to-json-callback": "^0.1.1",
|
"to-json-callback": "^0.1.1",
|
||||||
"type-checked-collections": "^0.1.7"
|
"type-checked-collections": "^0.1.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.40.0",
|
"@playwright/test": "^1.39.0",
|
||||||
"@rollup/plugin-commonjs": "^25.0.7",
|
"@rollup/plugin-commonjs": "^25.0.7",
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"@webreflection/toml-j0.4": "^1.1.3",
|
"@webreflection/toml-j0.4": "^1.1.3",
|
||||||
"@xterm/addon-fit": "^0.9.0-beta.1",
|
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"eslint": "^8.54.0",
|
"eslint": "^8.53.0",
|
||||||
"rollup": "^4.5.1",
|
"rollup": "^4.3.0",
|
||||||
"rollup-plugin-postcss": "^4.0.2",
|
"rollup-plugin-postcss": "^4.0.2",
|
||||||
"rollup-plugin-string": "^3.0.0",
|
"rollup-plugin-string": "^3.0.0",
|
||||||
"static-handler": "^0.4.3",
|
"static-handler": "^0.4.3",
|
||||||
"typescript": "^5.3.2",
|
"typescript": "^5.2.2",
|
||||||
"xterm": "^5.3.0",
|
"xterm": "^5.3.0",
|
||||||
"xterm-readline": "^1.1.1"
|
"xterm-readline": "^1.1.1"
|
||||||
}
|
}
|
||||||
@@ -91,9 +90,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@eslint/js": {
|
"node_modules/@eslint/js": {
|
||||||
"version": "8.54.0",
|
"version": "8.53.0",
|
||||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz",
|
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.53.0.tgz",
|
||||||
"integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==",
|
"integrity": "sha512-Kn7K8dx/5U6+cT1yEhpX1w4PCSg0M+XyRILPgvwcEBjerFWCwQj5sbr3/VmxqV0JGHCBCzyd6LxypEuehypY1w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@@ -226,12 +225,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@playwright/test": {
|
"node_modules/@playwright/test": {
|
||||||
"version": "1.40.0",
|
"version": "1.39.0",
|
||||||
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.0.tgz",
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz",
|
||||||
"integrity": "sha512-PdW+kn4eV99iP5gxWNSDQCbhMaDVej+RXL5xr6t04nbKLCBwYtA046t7ofoczHOm8u6c+45hpDKQVZqtqwkeQg==",
|
"integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright": "1.40.0"
|
"playwright": "1.39.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
@@ -375,9 +374,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.3.0.tgz",
|
||||||
"integrity": "sha512-YaN43wTyEBaMqLDYeze+gQ4ZrW5RbTEGtT5o1GVDkhpdNcsLTnLRcLccvwy3E9wiDKWg9RIhuoy3JQKDRBfaZA==",
|
"integrity": "sha512-/4pns6BYi8MXdwnXM44yoGAcFYVHL/BYlB2q1HXZ6AzH++LaiEVWFpBWQ/glXhbMbv3E3o09igrHFbP/snhAvA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -388,9 +387,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-android-arm64": {
|
"node_modules/@rollup/rollup-android-arm64": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.3.0.tgz",
|
||||||
"integrity": "sha512-n1bX+LCGlQVuPlCofO0zOKe1b2XkFozAVRoczT+yxWZPGnkEAKTTYVOGZz8N4sKuBnKMxDbfhUsB1uwYdup/sw==",
|
"integrity": "sha512-nLO/JsL9idr416vzi3lHm3Xm+QZh4qHij8k3Er13kZr5YhL7/+kBAx84kDmPc7HMexLmwisjDCeDIKNFp8mDlQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -401,9 +400,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
"node_modules/@rollup/rollup-darwin-arm64": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.3.0.tgz",
|
||||||
"integrity": "sha512-QqJBumdvfBqBBmyGHlKxje+iowZwrHna7pokj/Go3dV1PJekSKfmjKrjKQ/e6ESTGhkfPNLq3VXdYLAc+UtAQw==",
|
"integrity": "sha512-dGhVBlllt4iHwTGy21IEoMOTN5wZoid19zEIxsdY29xcEiOEHqzDa7Sqrkh5OE7LKCowL61eFJXxYe/+pYa7ZQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -414,9 +413,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-darwin-x64": {
|
"node_modules/@rollup/rollup-darwin-x64": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.3.0.tgz",
|
||||||
"integrity": "sha512-RrkDNkR/P5AEQSPkxQPmd2ri8WTjSl0RYmuFOiEABkEY/FSg0a4riihWQGKDJ4LnV9gigWZlTMx2DtFGzUrYQw==",
|
"integrity": "sha512-h8wRfHeLEbU3NzaP1Oku7BYXCJQiTRr+8U0lklyOQXxXiEpHLL8tk1hFl+tezoRKLcPJD7joKaK74ASsqt3Ekg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -427,9 +426,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.3.0.tgz",
|
||||||
"integrity": "sha512-ZFPxvUZmE+fkB/8D9y/SWl/XaDzNSaxd1TJUSE27XAKlRpQ2VNce/86bGd9mEUgL3qrvjJ9XTGwoX0BrJkYK/A==",
|
"integrity": "sha512-wP4VgR/gfV18sylTuym3sxRTkAgUR2vh6YLeX/GEznk5jCYcYSlx585XlcUcl0c8UffIZlRJ09raWSX3JDb4GA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -440,9 +439,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.3.0.tgz",
|
||||||
"integrity": "sha512-FEuAjzVIld5WVhu+M2OewLmjmbXWd3q7Zcx+Rwy4QObQCqfblriDMMS7p7+pwgjZoo9BLkP3wa9uglQXzsB9ww==",
|
"integrity": "sha512-v/14JCYVkqRSJeQbxFx4oUkwVQQw6lFMN7bd4vuARBc3X2lmomkxBsc+BFiIDL/BK+CTx5AOh/k9XmqDnKWRVg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -453,9 +452,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.3.0.tgz",
|
||||||
"integrity": "sha512-f5Gs8WQixqGRtI0Iq/cMqvFYmgFzMinuJO24KRfnv7Ohi/HQclwrBCYkzQu1XfLEEt3DZyvveq9HWo4bLJf1Lw==",
|
"integrity": "sha512-tNhfYqFH5OxtRzfkTOKdgFYlPSZnlDLNW4+leNEvQZhwTJxoTwsZAAhR97l3qVry/kkLyJPBK+Q8EAJLPinDIg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -466,9 +465,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.3.0.tgz",
|
||||||
"integrity": "sha512-CWPkPGrFfN2vj3mw+S7A/4ZaU3rTV7AkXUr08W9lNP+UzOvKLVf34tWCqrKrfwQ0NTk5GFqUr2XGpeR2p6R4gw==",
|
"integrity": "sha512-pw77m8QywdsoFdFOgmc8roF1inBI0rciqzO8ffRUgLoq7+ee9o5eFqtEcS6hHOOplgifAUUisP8cAnwl9nUYPw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -479,9 +478,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-linux-x64-musl": {
|
"node_modules/@rollup/rollup-linux-x64-musl": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.3.0.tgz",
|
||||||
"integrity": "sha512-ZRETMFA0uVukUC9u31Ed1nx++29073goCxZtmZARwk5aF/ltuENaeTtRVsSQzFlzdd4J6L3qUm+EW8cbGt0CKQ==",
|
"integrity": "sha512-tJs7v2MnV2F8w6X1UpPHl/43OfxjUy9SuJ2ZPoxn79v9vYteChVYO/ueLHCpRMmyTUIVML3N9z4azl9ENH8Xxg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -492,9 +491,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.3.0.tgz",
|
||||||
"integrity": "sha512-ihqfNJNb2XtoZMSCPeoo0cYMgU04ksyFIoOw5S0JUVbOhafLot+KD82vpKXOurE2+9o/awrqIxku9MRR9hozHQ==",
|
"integrity": "sha512-OKGxp6kATQdTyI2DF+e9s+hB3/QZB45b6e+dzcfW1SUqiF6CviWyevhmT4USsMEdP3mlpC9zxLz3Oh+WaTMOSw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -505,9 +504,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.3.0.tgz",
|
||||||
"integrity": "sha512-zK9MRpC8946lQ9ypFn4gLpdwr5a01aQ/odiIJeL9EbgZDMgbZjjT/XzTqJvDfTmnE1kHdbG20sAeNlpc91/wbg==",
|
"integrity": "sha512-DDZ5AH68JJ2ClQFEA1aNnfA7Ybqyeh0644rGbrLOdNehTmzfICHiWSn0OprzYi9HAshTPQvlwrM+bi2kuaIOjQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -518,9 +517,9 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.3.0.tgz",
|
||||||
"integrity": "sha512-5I3Nz4Sb9TYOtkRwlH0ow+BhMH2vnh38tZ4J4mggE48M/YyJyp/0sPSxhw1UeS1+oBgQ8q7maFtSeKpeRJu41Q==",
|
"integrity": "sha512-dMvGV8p92GQ8jhNlGIKpyhVZPzJlT258pPrM5q2F8lKcc9Iv9BbfdnhX1OfinYWnb9ms5zLw6MlaMnqLfUkKnQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -567,15 +566,6 @@
|
|||||||
"integrity": "sha512-ragv0U1Hy9JTyFpUqApu/UwF4Qhn0Y5GnQR4Bmy/+wYLKbHNS6hLN6bJR44v5DumaocJ4vpF6HVtYWeDJVs3qg==",
|
"integrity": "sha512-ragv0U1Hy9JTyFpUqApu/UwF4Qhn0Y5GnQR4Bmy/+wYLKbHNS6hLN6bJR44v5DumaocJ4vpF6HVtYWeDJVs3qg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@xterm/addon-fit": {
|
|
||||||
"version": "0.9.0-beta.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@xterm/addon-fit/-/addon-fit-0.9.0-beta.1.tgz",
|
|
||||||
"integrity": "sha512-HmGRUMMamUpQYuQBF2VP1LJ0xzqF85LMFfpaNu84t1Tsrl1lPKJWtqX9FDZ22Rf5q6bnKdbj44TRVAUHgDRbLA==",
|
|
||||||
"dev": true,
|
|
||||||
"peerDependencies": {
|
|
||||||
"xterm": "^5.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/acorn": {
|
"node_modules/acorn": {
|
||||||
"version": "8.10.0",
|
"version": "8.10.0",
|
||||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz",
|
||||||
@@ -859,14 +849,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/coincident": {
|
"node_modules/coincident": {
|
||||||
"version": "1.0.0",
|
"version": "0.14.4",
|
||||||
"resolved": "https://registry.npmjs.org/coincident/-/coincident-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/coincident/-/coincident-0.14.4.tgz",
|
||||||
"integrity": "sha512-tSAuLMLMzAPOb2B8tAiANLZ3LeB7dbueYxSV6Y9l/2FNZ8loBIc0jS1jEkrQK0g8UAslxLTd7+NCtpDr8YxNDQ==",
|
"integrity": "sha512-XLZs1S0ToZb8jAngtJQa5uFfhOdF168f+jodvkMOVpZl/JI9J+B1WdxX2PwU1vERxmahEubHv9Gr+a3XWOnccw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ungap/structured-clone": "^1.2.0",
|
"@ungap/structured-clone": "^1.2.0",
|
||||||
"@ungap/with-resolvers": "^0.1.0",
|
"@ungap/with-resolvers": "^0.1.0",
|
||||||
"gc-hook": "^0.2.5",
|
"gc-hook": "^0.2.4"
|
||||||
"proxy-target": "^2.0.4"
|
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"ws": "^8.14.2"
|
"ws": "^8.14.2"
|
||||||
@@ -1235,15 +1224,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/eslint": {
|
"node_modules/eslint": {
|
||||||
"version": "8.54.0",
|
"version": "8.53.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.53.0.tgz",
|
||||||
"integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==",
|
"integrity": "sha512-N4VuiPjXDUa4xVeV/GC/RV3hQW9Nw+Y463lkWaKKXKYMvmRiRDAtfpuPFLN+E1/6ZhyR8J2ig+eVREnYgUsiag==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@eslint-community/regexpp": "^4.6.1",
|
"@eslint-community/regexpp": "^4.6.1",
|
||||||
"@eslint/eslintrc": "^2.1.3",
|
"@eslint/eslintrc": "^2.1.3",
|
||||||
"@eslint/js": "8.54.0",
|
"@eslint/js": "8.53.0",
|
||||||
"@humanwhocodes/config-array": "^0.11.13",
|
"@humanwhocodes/config-array": "^0.11.13",
|
||||||
"@humanwhocodes/module-importer": "^1.0.1",
|
"@humanwhocodes/module-importer": "^1.0.1",
|
||||||
"@nodelib/fs.walk": "^1.2.8",
|
"@nodelib/fs.walk": "^1.2.8",
|
||||||
@@ -1496,9 +1485,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/gc-hook": {
|
"node_modules/gc-hook": {
|
||||||
"version": "0.2.5",
|
"version": "0.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/gc-hook/-/gc-hook-0.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/gc-hook/-/gc-hook-0.2.4.tgz",
|
||||||
"integrity": "sha512-808B9hJ1T7ak4HRYdXgQjDaHexlaUOBuNFuqOnYotxfKjOHTDxAy8r1Oe7LI+KBeb/H6XUBKzuYi626DjxhxIg=="
|
"integrity": "sha512-IP7xtJGpaqbzj7Jn3KMhvVPVp3W7LXGbtz/D1dd147ocWg/7nl9TT28TQ+/o+qmn1hI2oCrI86vUvv9WlIbGwQ=="
|
||||||
},
|
},
|
||||||
"node_modules/generic-names": {
|
"node_modules/generic-names": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
@@ -2198,12 +2187,12 @@
|
|||||||
"integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA=="
|
"integrity": "sha512-yyVAOFKTAElc7KdLt2+UKGExNYwYb/Y/WE9i+1ezCQsJE8gbKSjewfpRqK2nQgZ4d4hhAAGgDCOcIZVilqE5UA=="
|
||||||
},
|
},
|
||||||
"node_modules/playwright": {
|
"node_modules/playwright": {
|
||||||
"version": "1.40.0",
|
"version": "1.39.0",
|
||||||
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.0.tgz",
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz",
|
||||||
"integrity": "sha512-gyHAgQjiDf1m34Xpwzaqb76KgfzYrhK7iih+2IzcOCoZWr/8ZqmdBw+t0RU85ZmfJMgtgAiNtBQ/KS2325INXw==",
|
"integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"playwright-core": "1.40.0"
|
"playwright-core": "1.39.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright": "cli.js"
|
"playwright": "cli.js"
|
||||||
@@ -2216,9 +2205,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/playwright-core": {
|
"node_modules/playwright-core": {
|
||||||
"version": "1.40.0",
|
"version": "1.39.0",
|
||||||
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.0.tgz",
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz",
|
||||||
"integrity": "sha512-fvKewVJpGeca8t0ipM56jkVSU6Eo0RmFvQ/MaCQNDYm+sdvKkMBBWTE1FdeMqIdumRaXXjZChWHvIzCGM/tA/Q==",
|
"integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"playwright-core": "cli.js"
|
"playwright-core": "cli.js"
|
||||||
@@ -2242,15 +2231,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/polyscript": {
|
"node_modules/polyscript": {
|
||||||
"version": "0.6.0",
|
"version": "0.5.11",
|
||||||
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/polyscript/-/polyscript-0.5.11.tgz",
|
||||||
"integrity": "sha512-e9nR1770DaJXMPV7fjhM7wh7sfeMAHfDIx16V1UtU3p1QoV2Z+jxZq+LuKumKlgsN82Yl56D1rP9qriie9omHQ==",
|
"integrity": "sha512-/QAp2qkvR9i3n1oSy2mo6DOdCQDRIeZnJhSLjhwghmoAflB0q2VPod21Bl4PS0mlNv50441/zutWix/pFNAsIg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ungap/structured-clone": "^1.2.0",
|
"@ungap/structured-clone": "^1.2.0",
|
||||||
"@ungap/with-resolvers": "^0.1.0",
|
"@ungap/with-resolvers": "^0.1.0",
|
||||||
"basic-devtools": "^0.1.6",
|
"basic-devtools": "^0.1.6",
|
||||||
"codedent": "^0.1.2",
|
"codedent": "^0.1.2",
|
||||||
"coincident": "^1.0.0",
|
"coincident": "^0.14.4",
|
||||||
"html-escaper": "^3.0.3",
|
"html-escaper": "^3.0.3",
|
||||||
"sticky-module": "^0.1.1"
|
"sticky-module": "^0.1.1"
|
||||||
}
|
}
|
||||||
@@ -2833,11 +2822,6 @@
|
|||||||
"node": ">=0.12"
|
"node": ">=0.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/proxy-target": {
|
|
||||||
"version": "2.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/proxy-target/-/proxy-target-2.1.0.tgz",
|
|
||||||
"integrity": "sha512-kgF20JQr+2uRX1024gAn/PV36IiOU1Rcmsphf6nHWh+d5XmkMOOMIoqYjLw7qe+iN0ix1lVMAYtJERlP3DQLiQ=="
|
|
||||||
},
|
|
||||||
"node_modules/punycode": {
|
"node_modules/punycode": {
|
||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
|
||||||
@@ -2940,9 +2924,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rollup": {
|
"node_modules/rollup": {
|
||||||
"version": "4.5.1",
|
"version": "4.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.3.0.tgz",
|
||||||
"integrity": "sha512-0EQribZoPKpb5z1NW/QYm3XSR//Xr8BeEXU49Lc/mQmpmVVG5jPUVrpc2iptup/0WMrY9mzas0fxH+TjYvG2CA==",
|
"integrity": "sha512-scIi1NrKLDIYSPK66jjECtII7vIgdAMFmFo8h6qm++I6nN9qDSV35Ku6erzGVqYjx+lj+j5wkusRMr++8SyDZg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"rollup": "dist/bin/rollup"
|
"rollup": "dist/bin/rollup"
|
||||||
@@ -2952,18 +2936,18 @@
|
|||||||
"npm": ">=8.0.0"
|
"npm": ">=8.0.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@rollup/rollup-android-arm-eabi": "4.5.1",
|
"@rollup/rollup-android-arm-eabi": "4.3.0",
|
||||||
"@rollup/rollup-android-arm64": "4.5.1",
|
"@rollup/rollup-android-arm64": "4.3.0",
|
||||||
"@rollup/rollup-darwin-arm64": "4.5.1",
|
"@rollup/rollup-darwin-arm64": "4.3.0",
|
||||||
"@rollup/rollup-darwin-x64": "4.5.1",
|
"@rollup/rollup-darwin-x64": "4.3.0",
|
||||||
"@rollup/rollup-linux-arm-gnueabihf": "4.5.1",
|
"@rollup/rollup-linux-arm-gnueabihf": "4.3.0",
|
||||||
"@rollup/rollup-linux-arm64-gnu": "4.5.1",
|
"@rollup/rollup-linux-arm64-gnu": "4.3.0",
|
||||||
"@rollup/rollup-linux-arm64-musl": "4.5.1",
|
"@rollup/rollup-linux-arm64-musl": "4.3.0",
|
||||||
"@rollup/rollup-linux-x64-gnu": "4.5.1",
|
"@rollup/rollup-linux-x64-gnu": "4.3.0",
|
||||||
"@rollup/rollup-linux-x64-musl": "4.5.1",
|
"@rollup/rollup-linux-x64-musl": "4.3.0",
|
||||||
"@rollup/rollup-win32-arm64-msvc": "4.5.1",
|
"@rollup/rollup-win32-arm64-msvc": "4.3.0",
|
||||||
"@rollup/rollup-win32-ia32-msvc": "4.5.1",
|
"@rollup/rollup-win32-ia32-msvc": "4.3.0",
|
||||||
"@rollup/rollup-win32-x64-msvc": "4.5.1",
|
"@rollup/rollup-win32-x64-msvc": "4.3.0",
|
||||||
"fsevents": "~2.3.2"
|
"fsevents": "~2.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3347,9 +3331,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.3.2",
|
"version": "5.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
||||||
"integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==",
|
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pyscript/core",
|
"name": "@pyscript/core",
|
||||||
"version": "0.3.5",
|
"version": "0.3.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "PyScript",
|
"description": "PyScript",
|
||||||
"module": "./index.js",
|
"module": "./index.js",
|
||||||
@@ -41,25 +41,24 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ungap/with-resolvers": "^0.1.0",
|
"@ungap/with-resolvers": "^0.1.0",
|
||||||
"basic-devtools": "^0.1.6",
|
"basic-devtools": "^0.1.6",
|
||||||
"polyscript": "^0.6.0",
|
"polyscript": "^0.5.11",
|
||||||
"sticky-module": "^0.1.1",
|
"sticky-module": "^0.1.1",
|
||||||
"to-json-callback": "^0.1.1",
|
"to-json-callback": "^0.1.1",
|
||||||
"type-checked-collections": "^0.1.7"
|
"type-checked-collections": "^0.1.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "^1.40.0",
|
"@playwright/test": "^1.39.0",
|
||||||
"@rollup/plugin-commonjs": "^25.0.7",
|
"@rollup/plugin-commonjs": "^25.0.7",
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
||||||
"@rollup/plugin-terser": "^0.4.4",
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"@webreflection/toml-j0.4": "^1.1.3",
|
"@webreflection/toml-j0.4": "^1.1.3",
|
||||||
"@xterm/addon-fit": "^0.9.0-beta.1",
|
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"eslint": "^8.54.0",
|
"eslint": "^8.53.0",
|
||||||
"rollup": "^4.5.1",
|
"rollup": "^4.3.0",
|
||||||
"rollup-plugin-postcss": "^4.0.2",
|
"rollup-plugin-postcss": "^4.0.2",
|
||||||
"rollup-plugin-string": "^3.0.0",
|
"rollup-plugin-string": "^3.0.0",
|
||||||
"static-handler": "^0.4.3",
|
"static-handler": "^0.4.3",
|
||||||
"typescript": "^5.3.2",
|
"typescript": "^5.2.2",
|
||||||
"xterm": "^5.3.0",
|
"xterm": "^5.3.0",
|
||||||
"xterm-readline": "^1.1.1"
|
"xterm-readline": "^1.1.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ const modules = {
|
|||||||
(b) => b.text(),
|
(b) => b.text(),
|
||||||
),
|
),
|
||||||
"xterm-readline.js": resolve("xterm-readline"),
|
"xterm-readline.js": resolve("xterm-readline"),
|
||||||
"xterm_addon-fit.js": fetch(`${CDN}/@xterm/addon-fit/+esm`).then((b) =>
|
|
||||||
b.text(),
|
|
||||||
),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (const [target, source] of Object.entries(modules)) {
|
for (const [target, source] of Object.entries(modules)) {
|
||||||
|
|||||||
@@ -45,19 +45,6 @@ export const createFunction = (self, name) => {
|
|||||||
const SetFunction = typedSet({ typeof: "function" });
|
const SetFunction = typedSet({ typeof: "function" });
|
||||||
const SetString = typedSet({ typeof: "string" });
|
const SetString = typedSet({ typeof: "string" });
|
||||||
|
|
||||||
const inputFailure = `
|
|
||||||
import builtins
|
|
||||||
def input(prompt=""):
|
|
||||||
raise Exception("\\n ".join([
|
|
||||||
"input() doesn't work when PyScript runs in the main thread.",
|
|
||||||
"Consider using the worker attribute: https://docs.pyscript.net/2023.11.1/user-guide/workers/"
|
|
||||||
]))
|
|
||||||
|
|
||||||
builtins.input = input
|
|
||||||
del builtins
|
|
||||||
del input
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const hooks = {
|
export const hooks = {
|
||||||
main: {
|
main: {
|
||||||
/** @type {Set<function>} */
|
/** @type {Set<function>} */
|
||||||
@@ -73,7 +60,7 @@ export const hooks = {
|
|||||||
/** @type {Set<function>} */
|
/** @type {Set<function>} */
|
||||||
onAfterRunAsync: new SetFunction(),
|
onAfterRunAsync: new SetFunction(),
|
||||||
/** @type {Set<string>} */
|
/** @type {Set<string>} */
|
||||||
codeBeforeRun: new SetString([inputFailure]),
|
codeBeforeRun: new SetString(),
|
||||||
/** @type {Set<string>} */
|
/** @type {Set<string>} */
|
||||||
codeBeforeRunAsync: new SetString(),
|
codeBeforeRunAsync: new SetString(),
|
||||||
/** @type {Set<string>} */
|
/** @type {Set<string>} */
|
||||||
|
|||||||
@@ -40,10 +40,9 @@ const pyTerminal = async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// lazy load these only when a valid terminal is found
|
// lazy load these only when a valid terminal is found
|
||||||
const [{ Terminal }, { Readline }, { FitAddon }] = await Promise.all([
|
const [{ Terminal }, { Readline }] = await Promise.all([
|
||||||
import(/* webpackIgnore: true */ "../3rd-party/xterm.js"),
|
import(/* webpackIgnore: true */ "../3rd-party/xterm.js"),
|
||||||
import(/* webpackIgnore: true */ "../3rd-party/xterm-readline.js"),
|
import(/* webpackIgnore: true */ "../3rd-party/xterm-readline.js"),
|
||||||
import(/* webpackIgnore: true */ "../3rd-party/xterm_addon-fit.js"),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const readline = new Readline();
|
const readline = new Readline();
|
||||||
@@ -70,11 +69,8 @@ const pyTerminal = async () => {
|
|||||||
},
|
},
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
const fitAddon = new FitAddon();
|
|
||||||
terminal.loadAddon(fitAddon);
|
|
||||||
terminal.loadAddon(readline);
|
terminal.loadAddon(readline);
|
||||||
terminal.open(target);
|
terminal.open(target);
|
||||||
fitAddon.fit();
|
|
||||||
terminal.focus();
|
terminal.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>PyScript Next</title>
|
|
||||||
<script>
|
|
||||||
addEventListener("py:ready", console.log);
|
|
||||||
</script>
|
|
||||||
<link rel="stylesheet" href="../dist/core.css">
|
|
||||||
<script type="module" src="../dist/core.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<py-script>
|
|
||||||
input("what's your name?")
|
|
||||||
</py-script>
|
|
||||||
<mpy-script>
|
|
||||||
input("what's your name?")
|
|
||||||
</mpy-script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
78
pyscript.core/test/panel/panel.py
Normal file
78
pyscript.core/test/panel/panel.py
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
import json
|
||||||
|
|
||||||
|
import js
|
||||||
|
import panel as pn
|
||||||
|
from js import JSON
|
||||||
|
from panel.io.pyodide import init_doc, write_doc
|
||||||
|
from polyscript import xworker
|
||||||
|
from pyodide.ffi import create_once_callable, create_proxy, to_js
|
||||||
|
from pyscript import document, window
|
||||||
|
|
||||||
|
js.document = document
|
||||||
|
init_doc()
|
||||||
|
|
||||||
|
print("Hello from panel.py")
|
||||||
|
|
||||||
|
slider = pn.widgets.FloatSlider(start=0, end=10, name="Amplitude")
|
||||||
|
|
||||||
|
|
||||||
|
def callback(new):
|
||||||
|
print(f"Amplitude is: {new}")
|
||||||
|
return f"Amplitude is: {new}"
|
||||||
|
|
||||||
|
|
||||||
|
print("made this far...")
|
||||||
|
pn.Row(slider, pn.bind(callback, slider)).servable(target="simple_app")
|
||||||
|
|
||||||
|
# ------ END OF PANEL CODE ------
|
||||||
|
|
||||||
|
docs_json_str, render_items_str, root_ids_str = await write_doc()
|
||||||
|
docs_json = JSON.parse(docs_json_str) # .as_object_map()
|
||||||
|
# render_items = to_js(JSON.parse(render_items_str), depth=-1, pyproxies=None, create_pyproxies=False, dict_converter=js.Object.fromEntries)#.as_object_map()
|
||||||
|
root_ids = JSON.parse(root_ids_str) # .as_object_map()
|
||||||
|
|
||||||
|
# docs_json = json.loads(docs_json_str)
|
||||||
|
render_items = json.loads(render_items_str)
|
||||||
|
# root_ids = json.loads(root_ids_str)
|
||||||
|
|
||||||
|
print(type(render_items))
|
||||||
|
root_elements = document.querySelectorAll("[data-root-id]")
|
||||||
|
data_roots = []
|
||||||
|
for el in root_elements:
|
||||||
|
el.innerHTML = ""
|
||||||
|
data_roots.append([el.getAttribute("data-root-id"), el.id])
|
||||||
|
|
||||||
|
roots = {root_ids[i]: root for i, root in enumerate(data_roots)}
|
||||||
|
|
||||||
|
print("Quick check")
|
||||||
|
print(roots)
|
||||||
|
print(root_ids)
|
||||||
|
print(render_items)
|
||||||
|
# render_items[0]['roots'] = roots
|
||||||
|
# render_items[0]['root_ids'] = root_ids
|
||||||
|
# render_items[0].roots = to_js(roots)
|
||||||
|
# render_items[0].root_ids = to_js(root_ids)
|
||||||
|
|
||||||
|
|
||||||
|
# print(roots)
|
||||||
|
# print(data_roots)
|
||||||
|
print(docs_json)
|
||||||
|
print(render_items)
|
||||||
|
print("here....")
|
||||||
|
|
||||||
|
# views = await window.Bokeh.embed.embed_items(to_js(docs_json), to_js(render_items))
|
||||||
|
views = await window.Bokeh.embed.embed_items(
|
||||||
|
docs_json, # to_js(docs_json, depth=-1, pyproxies=None, create_pyproxies=False, dict_converter=js.Object.fromEntries),
|
||||||
|
to_js(
|
||||||
|
render_items,
|
||||||
|
depth=-1,
|
||||||
|
pyproxies=None,
|
||||||
|
create_pyproxies=False,
|
||||||
|
dict_converter=js.Object.fromEntries,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
# Experiments back to main thread
|
||||||
|
# await xworker.sync.render_full(docs_json_str, render_items_str, root_ids_str)
|
||||||
|
print("made it to the end")
|
||||||
|
print(docs_json)
|
||||||
5
pyscript.core/test/panel/panel.toml
Normal file
5
pyscript.core/test/panel/panel.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
packages = [
|
||||||
|
"https://cdn.holoviz.org/panel/0.14.3/dist/wheels/bokeh-2.4.3-py3-none-any.whl",
|
||||||
|
"numpy",
|
||||||
|
"panel==0.14.1"
|
||||||
|
]
|
||||||
71
pyscript.core/test/panel/panel_worker.html
Normal file
71
pyscript.core/test/panel/panel_worker.html
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Panel Example</title>
|
||||||
|
<meta charset="iso-8859-1" />
|
||||||
|
<link rel="icon" type="image/x-icon" href="./favicon.png" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<section class="pyscript">
|
||||||
|
<div id="simple_app"></div>
|
||||||
|
|
||||||
|
<py-tutor>
|
||||||
|
<script defer src="https://cdn.bokeh.org/bokeh/release/bokeh-2.4.3.js"></script>
|
||||||
|
<script defer src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-2.4.3.min.js"></script>
|
||||||
|
<script defer src="https://cdn.bokeh.org/bokeh/release/bokeh-tables-2.4.3.min.js"></script>
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/@holoviz/panel@0.14.1/dist/panel.min.js"></script>
|
||||||
|
|
||||||
|
<script type="module" src="../../core.js"></script>
|
||||||
|
<!-- <script
|
||||||
|
type="module"
|
||||||
|
src="https://esm.sh/@pyscript/core@latest/core.js"
|
||||||
|
></script> -->
|
||||||
|
|
||||||
|
<script type="py" worker="./panel.py" config="./panel.toml" async></script>
|
||||||
|
|
||||||
|
<!-- Code below borrowed for reference from example working on polyscript directly -->
|
||||||
|
<!-- <script type="micropython">
|
||||||
|
from pyscript import PyWorker
|
||||||
|
import json
|
||||||
|
import js
|
||||||
|
|
||||||
|
w = PyWorker('./panel.py', **{'type': 'pyodide', 'async': True, 'config': './panel.toml'})
|
||||||
|
|
||||||
|
# xworker.window made the following completely unnecessary
|
||||||
|
document = js.document
|
||||||
|
|
||||||
|
async def render_full(docs_json_str, render_items_str, root_ids_str):
|
||||||
|
docs_json = json.loads(docs_json_str)
|
||||||
|
render_items = json.loads(render_items_str)
|
||||||
|
root_ids = json.loads(root_ids_str)
|
||||||
|
|
||||||
|
print(type(render_items))
|
||||||
|
root_elements = document.querySelectorAll('[data-root-id]')
|
||||||
|
data_roots = []
|
||||||
|
for el in root_elements:
|
||||||
|
el.innerHTML = ''
|
||||||
|
data_roots.append([el.getAttribute('data-root-id'), el.id])
|
||||||
|
|
||||||
|
roots = {root_ids[i]: root for i, root in enumerate(data_roots)}
|
||||||
|
|
||||||
|
print("Quick check")
|
||||||
|
render_items[0]['roots'] = roots
|
||||||
|
render_items[0]['root_ids'] = root_ids
|
||||||
|
print("here....")
|
||||||
|
views = await js.Bokeh.embed.embed_items(docs_json, render_items)
|
||||||
|
|
||||||
|
|
||||||
|
def render(docs_json, render_items):
|
||||||
|
print(f"GOT DATA: {docs_json}")
|
||||||
|
print(f"GOT ITEMS: {render_items}")
|
||||||
|
|
||||||
|
await js.Bokeh.embed.embed_items(json.loads(docs_json), json.loads(render_items))
|
||||||
|
# views = await xworker.window.Bokeh.embed.embed_items(create_proxy(docs_json), create_proxy(render_items))
|
||||||
|
|
||||||
|
w.sync.render = render
|
||||||
|
w.sync.render_full = render_full
|
||||||
|
|
||||||
|
</script> -->
|
||||||
|
</py-tutor>
|
||||||
|
</section>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -93,19 +93,6 @@ class TestBasic(PyScriptTest):
|
|||||||
)
|
)
|
||||||
assert self.console.log.lines[-1] == "hello pyscript"
|
assert self.console.log.lines[-1] == "hello pyscript"
|
||||||
|
|
||||||
@only_main
|
|
||||||
def test_input_exception(self):
|
|
||||||
self.pyscript_run(
|
|
||||||
"""
|
|
||||||
<script type="py">
|
|
||||||
input("what's your name?")
|
|
||||||
</script>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
self.check_py_errors(
|
|
||||||
"Exception: input() doesn't work when PyScript runs in the main thread."
|
|
||||||
)
|
|
||||||
|
|
||||||
@skip_worker("NEXT: exceptions should be displayed in the DOM")
|
@skip_worker("NEXT: exceptions should be displayed in the DOM")
|
||||||
def test_python_exception(self):
|
def test_python_exception(self):
|
||||||
self.pyscript_run(
|
self.pyscript_run(
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
declare var i: any;
|
|
||||||
declare var o: any;
|
|
||||||
declare var s: {};
|
|
||||||
export { i as FitAddon, o as __esModule, s as default };
|
|
||||||
Reference in New Issue
Block a user