@stlite/desktop 0.56.0 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/bin/dump_artifacts.js +26 -26
- package/build/asset-manifest.json +3 -3
- package/build/electron/worker.js +19 -14
- package/build/index.html +1 -1
- package/build/static/js/2921.32cf8135.chunk.js +1 -0
- package/build/static/js/main.e800a125.js +28 -0
- package/package.json +4 -5
- package/wheels/stlite_server-0.1.0-py3-none-any.whl +0 -0
- package/wheels/streamlit-1.35.0-cp312-none-any.whl +0 -0
- package/build/static/js/3936.a3e17800.chunk.js +0 -1
- package/build/static/js/main.1e159f80.js +0 -28
- /package/build/static/js/{main.1e159f80.js.LICENSE.txt → main.e800a125.js.LICENSE.txt} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": {
|
|
3
3
|
"main.css": "/static/css/main.6fb7674e.css",
|
|
4
|
-
"main.js": "/static/js/main.
|
|
5
|
-
"static/js/
|
|
4
|
+
"main.js": "/static/js/main.e800a125.js",
|
|
5
|
+
"static/js/2921.32cf8135.chunk.js": "/static/js/2921.32cf8135.chunk.js",
|
|
6
6
|
"static/js/4994.2d981099.chunk.js": "/static/js/4994.2d981099.chunk.js",
|
|
7
7
|
"static/js/3685.39209b63.chunk.js": "/static/js/3685.39209b63.chunk.js",
|
|
8
8
|
"static/js/4785.0c41f474.chunk.js": "/static/js/4785.0c41f474.chunk.js",
|
|
@@ -163,6 +163,6 @@
|
|
|
163
163
|
},
|
|
164
164
|
"entrypoints": [
|
|
165
165
|
"static/css/main.6fb7674e.css",
|
|
166
|
-
"static/js/main.
|
|
166
|
+
"static/js/main.e800a125.js"
|
|
167
167
|
]
|
|
168
168
|
}
|
package/build/electron/worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).filter(e=>!e.startsWith("#")).map(e=>e.replace(
|
|
1
|
+
var fe=Object.create;var K=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var M=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var he=(o,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of pe(e))!ye.call(o,r)&&r!==t&&K(o,r,{get:()=>e[r],enumerable:!(s=me(e,r))||s.enumerable});return o};var V=(o,e,t)=>(t=o!=null?fe(_e(o)):{},he(e||!o||!o.__esModule?K(t,"default",{value:o,enumerable:!0}):t,o));var X=M(L=>{"use strict";Object.defineProperty(L,"__esModule",{value:!0});L.validateRequirements=void 0;var ve="[",be="(<=>!~",Pe=";",we="@",Se=new RegExp(`[${ve+be+Pe+we}]`);function ke(o){return o.split(Se)[0].trim()}function Ae(o){return o.forEach(t=>{let s;try{s=new URL(t)}catch{return}if(s.protocol==="emfs:"||s.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),o.filter(t=>ke(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}L.validateRequirements=Ae});var G=M(T=>{"use strict";Object.defineProperty(T,"__esModule",{value:!0});T.parseRequirementsTxt=void 0;var Fe=/\s#.*$/;function Re(o){return o.split(`
|
|
2
|
+
`).filter(e=>!e.startsWith("#")).map(e=>e.replace(Fe,"")).map(e=>e.trim()).filter(e=>e!=="")}T.parseRequirementsTxt=Re});var Q=M(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.PromiseDelegate=void 0;var D=class{constructor(){this.promise=new Promise((e,t)=>{this.resolveInternal=e,this.rejectInternal=t})}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}};N.PromiseDelegate=D});var Y=M(w=>{"use strict";var Me=w&&w.__createBinding||(Object.create?function(o,e,t,s){s===void 0&&(s=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(o,s,r)}:function(o,e,t,s){s===void 0&&(s=t),o[s]=e[t]}),q=w&&w.__exportStar||function(o,e){for(var t in o)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&Me(e,o,t)};Object.defineProperty(w,"__esModule",{value:!0});q(X(),w);q(G(),w);q(Q(),w)});var te=M((Je,ee)=>{"use strict";function b(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}function Z(o,e){for(var t="",s=0,r=-1,a=0,n,i=0;i<=o.length;++i){if(i<o.length)n=o.charCodeAt(i);else{if(n===47)break;n=47}if(n===47){if(!(r===i-1||a===1))if(r!==i-1&&a===2){if(t.length<2||s!==2||t.charCodeAt(t.length-1)!==46||t.charCodeAt(t.length-2)!==46){if(t.length>2){var l=t.lastIndexOf("/");if(l!==t.length-1){l===-1?(t="",s=0):(t=t.slice(0,l),s=t.length-1-t.lastIndexOf("/")),r=i,a=0;continue}}else if(t.length===2||t.length===1){t="",s=0,r=i,a=0;continue}}e&&(t.length>0?t+="/..":t="..",s=2)}else t.length>0?t+="/"+o.slice(r+1,i):t=o.slice(r+1,i),s=i-r-1;r=i,a=0}else n===46&&a!==-1?++a:a=-1}return t}function Oe(o,e){var t=e.dir||e.root,s=e.base||(e.name||"")+(e.ext||"");return t?t===e.root?t+s:t+o+s:s}var F={resolve:function(){for(var e="",t=!1,s,r=arguments.length-1;r>=-1&&!t;r--){var a;r>=0?a=arguments[r]:(s===void 0&&(s=process.cwd()),a=s),b(a),a.length!==0&&(e=a+"/"+e,t=a.charCodeAt(0)===47)}return e=Z(e,!t),t?e.length>0?"/"+e:"/":e.length>0?e:"."},normalize:function(e){if(b(e),e.length===0)return".";var t=e.charCodeAt(0)===47,s=e.charCodeAt(e.length-1)===47;return e=Z(e,!t),e.length===0&&!t&&(e="."),e.length>0&&s&&(e+="/"),t?"/"+e:e},isAbsolute:function(e){return b(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return".";for(var e,t=0;t<arguments.length;++t){var s=arguments[t];b(s),s.length>0&&(e===void 0?e=s:e+="/"+s)}return e===void 0?".":F.normalize(e)},relative:function(e,t){if(b(e),b(t),e===t||(e=F.resolve(e),t=F.resolve(t),e===t))return"";for(var s=1;s<e.length&&e.charCodeAt(s)===47;++s);for(var r=e.length,a=r-s,n=1;n<t.length&&t.charCodeAt(n)===47;++n);for(var i=t.length,l=i-n,_=a<l?a:l,u=-1,c=0;c<=_;++c){if(c===_){if(l>_){if(t.charCodeAt(n+c)===47)return t.slice(n+c+1);if(c===0)return t.slice(n+c)}else a>_&&(e.charCodeAt(s+c)===47?u=c:c===0&&(u=0));break}var S=e.charCodeAt(s+c),p=t.charCodeAt(n+c);if(S!==p)break;S===47&&(u=c)}var d="";for(c=s+u+1;c<=r;++c)(c===r||e.charCodeAt(c)===47)&&(d.length===0?d+="..":d+="/..");return d.length>0?d+t.slice(n+u):(n+=u,t.charCodeAt(n)===47&&++n,t.slice(n))},_makeLong:function(e){return e},dirname:function(e){if(b(e),e.length===0)return".";for(var t=e.charCodeAt(0),s=t===47,r=-1,a=!0,n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!a){r=n;break}}else a=!1;return r===-1?s?"/":".":s&&r===1?"//":e.slice(0,r)},basename:function(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');b(e);var s=0,r=-1,a=!0,n;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return"";var i=t.length-1,l=-1;for(n=e.length-1;n>=0;--n){var _=e.charCodeAt(n);if(_===47){if(!a){s=n+1;break}}else l===-1&&(a=!1,l=n+1),i>=0&&(_===t.charCodeAt(i)?--i===-1&&(r=n):(i=-1,r=l))}return s===r?r=l:r===-1&&(r=e.length),e.slice(s,r)}else{for(n=e.length-1;n>=0;--n)if(e.charCodeAt(n)===47){if(!a){s=n+1;break}}else r===-1&&(a=!1,r=n+1);return r===-1?"":e.slice(s,r)}},extname:function(e){b(e);for(var t=-1,s=0,r=-1,a=!0,n=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(l===47){if(!a){s=i+1;break}continue}r===-1&&(a=!1,r=i+1),l===46?t===-1?t=i:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||r===-1||n===0||n===1&&t===r-1&&t===s+1?"":e.slice(t,r)},format:function(e){if(e===null||typeof e!="object")throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return Oe("/",e)},parse:function(e){b(e);var t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;var s=e.charCodeAt(0),r=s===47,a;r?(t.root="/",a=1):a=0;for(var n=-1,i=0,l=-1,_=!0,u=e.length-1,c=0;u>=a;--u){if(s=e.charCodeAt(u),s===47){if(!_){i=u+1;break}continue}l===-1&&(_=!1,l=u+1),s===46?n===-1?n=u:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||l===-1||c===0||c===1&&n===l-1&&n===i+1?l!==-1&&(i===0&&r?t.base=t.name=e.slice(1,l):t.base=t.name=e.slice(i,l)):(i===0&&r?(t.name=e.slice(1,n),t.base=e.slice(1,l)):(t.name=e.slice(i,n),t.base=e.slice(i,l)),t.ext=e.slice(n,l)),i>0?t.dir=e.slice(0,i-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};F.posix=F;ee.exports=F});var W=require("node:worker_threads");var ie=V(Y());var U=V(te());function re(o,e){let t=U.default.normalize(e),r=U.default.dirname(t).split("/"),a=[];for(let n of r){a.push(n);let i=a.join("/");if(o.FS.analyzePath(i).exists){if(o.FS.isDir(i))throw new Error(`"${i}" already exists and is not a directory.`);continue}try{o.FS.mkdir(i)}catch(l){throw console.error(`Failed to create a directory "${i}"`),l}}}function $(o,e,t,s){re(o,e),o.FS.writeFile(e,t,s)}function oe(o,e,t){re(o,t),o.FS.rename(e,t)}var Ie="[",Ce="(<=>!~",Ee=";",Le="@",Te=new RegExp(`[${Ie+Ce+Ee+Le}]`);function Ne(o){return o.split(Te)[0].trim()}function H(o){return o.forEach(t=>{let s;try{s=new URL(t)}catch{return}if(s.protocol==="emfs:"||s.protocol==="file:")throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${t})`)}),o.filter(t=>Ne(t)==="streamlit"?(console.warn(`Streamlit is specified in the requirements ("${t}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1):!0)}function j(o){o.runPython(`
|
|
3
3
|
import micropip
|
|
4
4
|
micropip.add_mock_package(
|
|
5
5
|
"pyarrow", "0.0.1",
|
|
@@ -15,19 +15,24 @@ class Table:
|
|
|
15
15
|
"""
|
|
16
16
|
}
|
|
17
17
|
)
|
|
18
|
-
`)}
|
|
18
|
+
`)}function De(o,e){return o.pyodide_py.ffi._pyodide._base.find_imports(e).toJs()}async function se(o,e,t){let s=t.map(l=>De(o,l)),n=Array.from(new Set(s.flat())).filter(l=>!o.runPython(`__import__('importlib').util.find_spec('${l}')`)).map(l=>o._api._import_name_to_package_name.get(l)).filter(l=>l);if(n.length===0)return;let i=new MessageChannel;e({type:"event:moduleAutoLoad",data:{packagesToLoad:n}},i.port2);try{let l=await o.loadPackage(n);i.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:l}}),i.port1.close();return}catch(l){throw i.port1.postMessage({type:"moduleAutoLoad:error",error:l}),i.port1.close(),l}}async function qe(o,e){let t=o.slice(0,o.lastIndexOf("/")+1),s;return o.endsWith(".mjs")?s=(await import(o)).loadPyodide:(importScripts(o),s=O.loadPyodide),s({...e,indexURL:t})}var O=global;function ne(o,e,t){let s=se(o,e,t);O.__moduleAutoLoadPromise__=s,o.runPythonAsync(`
|
|
19
|
+
from streamlit.runtime.scriptrunner import script_runner
|
|
20
|
+
from js import __moduleAutoLoadPromise__
|
|
21
|
+
|
|
22
|
+
script_runner.moduleAutoLoadPromise = __moduleAutoLoadPromise__
|
|
23
|
+
`)}function ae(o,e,t){function s(u){e({type:"event:progress",data:{message:u}})}let r,a,n=new ie.PromiseDelegate;async function i(){let u=await n.promise,c={...t,...u};console.debug("Initial data",c);let{entrypoint:S,files:p,archives:d,requirements:m,prebuiltPackageNames:y,wheels:h,mountedSitePackagesSnapshotFilePath:v,pyodideUrl:k=o,streamlitConfig:A,idbfsMountpoints:I,nodefsMountpoints:x,moduleAutoLoad:ce}=c,C=H(m);s("Loading Pyodide."),console.debug("Loading Pyodide"),r=await qe(k,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide");let B=!1;I&&(B=!0,I.forEach(g=>{r.FS.mkdir(g),r.FS.mount(r.FS.filesystems.IDBFS,{},g)}),await new Promise((g,f)=>{r.FS.syncfs(!0,P=>{P?f(P):g()})})),x&&Object.entries(x).forEach(([g,f])=>{r.FS.mkdir(g),r.FS.mount(r.FS.filesystems.NODEFS,{root:f},g)}),s("Mounting files.");let z=[];if(await Promise.all(Object.keys(p).map(async g=>{let f=p[g],P;"url"in f?(console.debug(`Fetch a file from ${f.url}`),P=await fetch(f.url).then(R=>R.arrayBuffer()).then(R=>new Uint8Array(R))):P=f.data;let{opts:E}=p[g];console.debug(`Write a file "${g}"`),$(r,g,P,E),g.endsWith(".py")&&z.push(g)})),s("Unpacking archives."),await Promise.all(d.map(async g=>{let f;"url"in g?(console.debug(`Fetch an archive from ${g.url}`),f=await fetch(g.url).then(R=>R.arrayBuffer())):f=g.buffer;let{format:P,options:E}=g;console.debug("Unpack an archive",{format:P,options:E}),r.unpackArchive(f,P,E)})),!v&&!h)throw new Error("Neither snapshot nor wheel files are provided.");v&&(s("Restoring the snapshot."),await r.runPythonAsync("import tarfile, shutil, site"),await r.runPythonAsync(`
|
|
19
24
|
site_packages_dirs = site.getsitepackages()
|
|
20
25
|
for site_packages in site_packages_dirs:
|
|
21
26
|
shutil.rmtree(site_packages)
|
|
22
|
-
`),console.debug(`Unarchive ${
|
|
23
|
-
with tarfile.open("${
|
|
27
|
+
`),console.debug(`Unarchive ${v}`),await r.runPythonAsync(`
|
|
28
|
+
with tarfile.open("${v}", "r") as tar_gz_file:
|
|
24
29
|
tar_gz_file.extractall("/")
|
|
25
|
-
`),console.debug("Restored the snapshot"),s("Mocking some packages."),console.debug("Mock pyarrow")
|
|
30
|
+
`),console.debug("Restored the snapshot"),s("Mocking some packages."),console.debug("Mock pyarrow"),j(r),console.debug("Mocked pyarrow")),s("Installing packages."),console.debug("Installing the prebuilt packages:",y),await r.loadPackage(y),console.debug("Installed the prebuilt packages"),await r.loadPackage("micropip");let J=r.pyimport("micropip");if(h?(console.debug("Installing the wheels:",h,"and the requirements:",C),await J.install.callKwargs([h.stliteServer,h.streamlit,...C],{keep_going:!0}),console.debug("Installed the wheels and the requirements"),s("Mocking some packages."),console.debug("Mock pyarrow"),j(r),console.debug("Mocked pyarrow")):(console.debug("Installing the requirements:",C),await J.install.callKwargs(C,{keep_going:!0}),console.debug("Installed the requirements")),ce){let g=z.map(f=>r.FS.readFile(f,{encoding:"utf8"}));ne(r,e,g)}await r.runPythonAsync(`
|
|
26
31
|
import importlib
|
|
27
32
|
importlib.invalidate_caches()
|
|
28
|
-
`),s("Loading streamlit package."),console.debug("Loading the Streamlit package"),await
|
|
33
|
+
`),s("Loading streamlit package."),console.debug("Loading the Streamlit package"),await r.runPythonAsync(`
|
|
29
34
|
import streamlit.runtime
|
|
30
|
-
`),console.debug("Loaded the Streamlit package"),s("Setting up the loggers."),console.debug("Setting the loggers"),await
|
|
35
|
+
`),console.debug("Loaded the Streamlit package"),s("Setting up the loggers."),console.debug("Setting the loggers"),await r.runPythonAsync(`
|
|
31
36
|
import logging
|
|
32
37
|
import streamlit.logger
|
|
33
38
|
|
|
@@ -45,7 +50,7 @@ for name in streamlit.logger._loggers.keys():
|
|
|
45
50
|
logger.setLevel(logging.NOTSET)
|
|
46
51
|
|
|
47
52
|
streamlit.logger._loggers = {}
|
|
48
|
-
`);let
|
|
53
|
+
`);let de=(g,f)=>{g>=40?console.error(f):g>=30?console.warn(f):g>=20?console.info(f):console.debug(f)};O.__logCallback__=de,await r.runPythonAsync(`
|
|
49
54
|
def setup_loggers(streamlit_level, streamlit_message_format):
|
|
50
55
|
from js import __logCallback__
|
|
51
56
|
|
|
@@ -74,14 +79,14 @@ def setup_loggers(streamlit_level, streamlit_message_format):
|
|
|
74
79
|
streamlit_handler.setFormatter(streamlit_formatter)
|
|
75
80
|
streamlit_logger.addHandler(streamlit_handler)
|
|
76
81
|
streamlit_logger.setLevel(streamlit_level.upper())
|
|
77
|
-
`);let
|
|
82
|
+
`);let ge=(A?.["logger.level"]??"INFO").toString(),ue=A?.["logger.messageFormat"]??"%(asctime)s %(message)s";if(r.globals.get("setup_loggers")(ge,ue),console.debug("Set the loggers"),s("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),await r.runPythonAsync(`
|
|
78
83
|
import streamlit
|
|
79
84
|
|
|
80
85
|
def is_cacheable_msg(msg):
|
|
81
86
|
return False
|
|
82
87
|
|
|
83
88
|
streamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg
|
|
84
|
-
`),console.debug("Mocked some Streamlit functions"),B){s("Setting up the IndexedDB filesystem synchronizer."),console.debug("Setting up the IndexedDB filesystem synchronizer");let g=!1;
|
|
89
|
+
`),console.debug("Mocked some Streamlit functions"),B){s("Setting up the IndexedDB filesystem synchronizer."),console.debug("Setting up the IndexedDB filesystem synchronizer");let g=!1;O.__scriptFinishedCallback__=()=>{console.debug("The script has finished. Syncing the filesystem."),g||(g=!0,r.FS.syncfs(!1,f=>{g=!1,f&&console.error(f)}))},await r.runPythonAsync(`
|
|
85
90
|
from streamlit.runtime.app_session import AppSession
|
|
86
91
|
from streamlit.runtime.scriptrunner import ScriptRunnerEvent
|
|
87
92
|
from js import __scriptFinishedCallback__
|
|
@@ -96,7 +101,7 @@ def wrap_app_session_on_scriptrunner_event(original_method):
|
|
|
96
101
|
return wrapped
|
|
97
102
|
|
|
98
103
|
AppSession._on_scriptrunner_event = wrap_app_session_on_scriptrunner_event(AppSession._on_scriptrunner_event)
|
|
99
|
-
`),console.debug("Set up the IndexedDB filesystem synchronizer")}s("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),
|
|
104
|
+
`),console.debug("Set up the IndexedDB filesystem synchronizer")}return s("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),O.__streamlitFlagOptions__={"browser.gatherUsageStats":!1,...A,"runner.fastReruns":!1},await r.runPythonAsync(`
|
|
100
105
|
from stlite_server.bootstrap import load_config_options, prepare
|
|
101
106
|
from stlite_server.server import Server
|
|
102
107
|
from js import __streamlitFlagOptions__
|
|
@@ -104,11 +109,11 @@ from js import __streamlitFlagOptions__
|
|
|
104
109
|
flag_options = __streamlitFlagOptions__.to_py()
|
|
105
110
|
load_config_options(flag_options)
|
|
106
111
|
|
|
107
|
-
main_script_path = "${
|
|
112
|
+
main_script_path = "${S}"
|
|
108
113
|
args = []
|
|
109
114
|
|
|
110
115
|
prepare(main_script_path, args)
|
|
111
116
|
|
|
112
117
|
server = Server(main_script_path)
|
|
113
118
|
server.start()
|
|
114
|
-
`),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),a=
|
|
119
|
+
`),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),a=r.globals.get("server").copy(),console.debug("Set up the HTTP server"),e({type:"event:loaded"}),c}let l=i().catch(u=>{throw e({type:"event:error",data:{error:u}}),u}),_=async u=>{let c=u.data;if(c.type==="initData"){n.resolve(c.data);return}let{moduleAutoLoad:S}=await l,p=u.ports[0];try{switch(c.type){case"websocket:connect":{console.debug("websocket:connect",c.data);let{path:d}=c.data;a.start_websocket(d,(m,y)=>{if(y){let h=m,v=h.getBuffer("u8");h.destroy();let k=new Uint8ClampedArray(v.data.buffer,v.data.byteOffset,v.data.byteLength);e({type:"websocket:message",data:{payload:new Uint8Array(k)}})}else e({type:"websocket:message",data:{payload:m}})}),p.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",c.data);let{payload:d}=c.data;a.receive_websocket_from_js(d);break}case"http:request":{console.debug("http:request",c.data);let{request:d}=c.data,m=(y,h,v)=>{let k=new Map(h.toJs()),A=v.toJs();console.debug({statusCode:y,headers:k,body:A});let I={type:"http:response",data:{response:{statusCode:y,headers:k,body:A}}};p.postMessage(I)};a.receive_http_from_js(d.method,decodeURIComponent(d.path),d.headers,d.body,m);break}case"file:write":{let{path:d,data:m,opts:y}=c.data;S&&typeof m=="string"&&d.endsWith(".py")&&(console.debug(`Auto install the requirements in ${d}`),ne(r,e,[m])),console.debug(`Write a file "${d}"`),$(r,d,m,y),p.postMessage({type:"reply"});break}case"file:rename":{let{oldPath:d,newPath:m}=c.data;console.debug(`Rename "${d}" to ${m}`),oe(r,d,m),p.postMessage({type:"reply"});break}case"file:unlink":{let{path:d}=c.data;console.debug(`Remove "${d}`),r.FS.unlink(d),p.postMessage({type:"reply"});break}case"install":{let{requirements:d}=c.data,m=r.pyimport("micropip"),y=H(d);console.debug("Install the requirements:",y),await m.install.callKwargs(y,{keep_going:!0}).then(()=>{console.debug("Successfully installed"),p.postMessage({type:"reply"})})}}}catch(d){if(console.error(d),!(d instanceof Error))throw d;let m=new Error(d.message);m.name=d.name,m.stack=d.stack,p.postMessage({type:"reply",error:m})}};return e({type:"event:start"}),_}function le(){let o=process.env.NODEFS_MOUNTPOINTS;if(!o)return;let e;try{e=JSON.parse(o)}catch{console.error(`Failed to parse NODEFS_MOUNTPOINTS as JSON: ${o}`);return}if(typeof e!="object"){console.error(`NODEFS_MOUNTPOINTS is not an object: ${o}`);return}if(Array.isArray(e)){console.error(`NODEFS_MOUNTPOINTS is an array: ${o}`);return}if(Object.keys(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string keys: ${o}`);return}if(Object.values(e).some(t=>typeof t!="string")){console.error(`NODEFS_MOUNTPOINTS has non-string values: ${o}`);return}return e}var Ue=o=>{console.debug("[worker thread] postMessage from worker",o),W.parentPort?.postMessage(o)},$e=ae(process.env.PYODIDE_URL,Ue,{nodefsMountpoints:le()});W.parentPort?.on("message",({data:o,port:e})=>{console.debug("[worker thread] parentPort.onMessage",{data:o,port:e}),$e({data:o,ports:[e]})});
|
package/build/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><script defer="defer" src="/static/js/main.
|
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1"/><title>stlite</title><script defer="defer" src="/static/js/main.e800a125.js"></script><link href="/static/css/main.6fb7674e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var e={56977:e=>{function t(e){if("string"!==typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}function n(e,t){for(var n,r="",o=0,s=-1,a=0,i=0;i<=e.length;++i){if(i<e.length)n=e.charCodeAt(i);else{if(47===n)break;n=47}if(47===n){if(s===i-1||1===a);else if(s!==i-1&&2===a){if(r.length<2||2!==o||46!==r.charCodeAt(r.length-1)||46!==r.charCodeAt(r.length-2))if(r.length>2){var l=r.lastIndexOf("/");if(l!==r.length-1){-1===l?(r="",o=0):o=(r=r.slice(0,l)).length-1-r.lastIndexOf("/"),s=i,a=0;continue}}else if(2===r.length||1===r.length){r="",o=0,s=i,a=0;continue}t&&(r.length>0?r+="/..":r="..",o=2)}else r.length>0?r+="/"+e.slice(s+1,i):r=e.slice(s+1,i),o=i-s-1;s=i,a=0}else 46===n&&-1!==a?++a:a=-1}return r}var r={resolve:function(){for(var e,r="",o=!1,s=arguments.length-1;s>=-1&&!o;s--){var a;s>=0?a=arguments[s]:(void 0===e&&(e=process.cwd()),a=e),t(a),0!==a.length&&(r=a+"/"+r,o=47===a.charCodeAt(0))}return r=n(r,!o),o?r.length>0?"/"+r:"/":r.length>0?r:"."},normalize:function(e){if(t(e),0===e.length)return".";var r=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return 0!==(e=n(e,!r)).length||r||(e="."),e.length>0&&o&&(e+="/"),r?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0===arguments.length)return".";for(var e,n=0;n<arguments.length;++n){var o=arguments[n];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":r.normalize(e)},relative:function(e,n){if(t(e),t(n),e===n)return"";if((e=r.resolve(e))===(n=r.resolve(n)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var s=e.length,a=s-o,i=1;i<n.length&&47===n.charCodeAt(i);++i);for(var l=n.length-i,c=a<l?a:l,g=-1,d=0;d<=c;++d){if(d===c){if(l>c){if(47===n.charCodeAt(i+d))return n.slice(i+d+1);if(0===d)return n.slice(i+d)}else a>c&&(47===e.charCodeAt(o+d)?g=d:0===d&&(g=0));break}var u=e.charCodeAt(o+d);if(u!==n.charCodeAt(i+d))break;47===u&&(g=d)}var p="";for(d=o+g+1;d<=s;++d)d!==s&&47!==e.charCodeAt(d)||(0===p.length?p+="..":p+="/..");return p.length>0?p+n.slice(i+g):(i+=g,47===n.charCodeAt(i)&&++i,n.slice(i))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var n=e.charCodeAt(0),r=47===n,o=-1,s=!0,a=e.length-1;a>=1;--a)if(47===(n=e.charCodeAt(a))){if(!s){o=a;break}}else s=!1;return-1===o?r?"/":".":r&&1===o?"//":e.slice(0,o)},basename:function(e,n){if(void 0!==n&&"string"!==typeof n)throw new TypeError('"ext" argument must be a string');t(e);var r,o=0,s=-1,a=!0;if(void 0!==n&&n.length>0&&n.length<=e.length){if(n.length===e.length&&n===e)return"";var i=n.length-1,l=-1;for(r=e.length-1;r>=0;--r){var c=e.charCodeAt(r);if(47===c){if(!a){o=r+1;break}}else-1===l&&(a=!1,l=r+1),i>=0&&(c===n.charCodeAt(i)?-1===--i&&(s=r):(i=-1,s=l))}return o===s?s=l:-1===s&&(s=e.length),e.slice(o,s)}for(r=e.length-1;r>=0;--r)if(47===e.charCodeAt(r)){if(!a){o=r+1;break}}else-1===s&&(a=!1,s=r+1);return-1===s?"":e.slice(o,s)},extname:function(e){t(e);for(var n=-1,r=0,o=-1,s=!0,a=0,i=e.length-1;i>=0;--i){var l=e.charCodeAt(i);if(47!==l)-1===o&&(s=!1,o=i+1),46===l?-1===n?n=i:1!==a&&(a=1):-1!==n&&(a=-1);else if(!s){r=i+1;break}}return-1===n||-1===o||0===a||1===a&&n===o-1&&n===r+1?"":e.slice(n,o)},format:function(e){if(null===e||"object"!==typeof e)throw new TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||"")+(t.ext||"");return n?n===t.root?n+r:n+e+r:r}("/",e)},parse:function(e){t(e);var n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var r,o=e.charCodeAt(0),s=47===o;s?(n.root="/",r=1):r=0;for(var a=-1,i=0,l=-1,c=!0,g=e.length-1,d=0;g>=r;--g)if(47!==(o=e.charCodeAt(g)))-1===l&&(c=!1,l=g+1),46===o?-1===a?a=g:1!==d&&(d=1):-1!==a&&(d=-1);else if(!c){i=g+1;break}return-1===a||-1===l||0===d||1===d&&a===l-1&&a===i+1?-1!==l&&(n.base=n.name=0===i&&s?e.slice(1,l):e.slice(i,l)):(0===i&&s?(n.name=e.slice(1,a),n.base=e.slice(1,l)):(n.name=e.slice(i,a),n.base=e.slice(i,l)),n.ext=e.slice(a,l)),i>0?n.dir=e.slice(0,i-1):s&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};r.posix=r,e.exports=r}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{new RegExp("[[(<=>!~;@]");class e{constructor(){this.promise=new Promise(((e,t)=>{this.resolveInternal=e,this.rejectInternal=t}))}resolve(e){this.resolveInternal(e)}reject(e){this.rejectInternal(e)}}var t=n(56977),r=n.n(t);function o(e,t){const n=r().normalize(t),o=r().dirname(n).split("/"),s=[];for(const r of o){s.push(r);const t=s.join("/");if(e.FS.analyzePath(t).exists){if(e.FS.isDir(t))throw new Error(`"${t}" already exists and is not a directory.`)}else try{e.FS.mkdir(t)}catch(a){throw console.error(`Failed to create a directory "${t}"`),a}}}function s(e,t,n,r){o(e,t),e.FS.writeFile(t,n,r)}const a=new RegExp("[[(<=>!~;@]");function i(e){e.forEach((e=>{let t;try{t=new URL(e)}catch{return}if("emfs:"===t.protocol||"file:"===t.protocol)throw new Error(`"emfs:" and "file:" protocols are not allowed for the requirement (${e})`)}));return e.filter((e=>{const t="streamlit"===function(e){return e.split(a)[0].trim()}(e);return!t||(console.warn(`Streamlit is specified in the requirements ("${e}"), but it will be ignored. A built-in version of Streamlit will be used.`),!1)}))}function l(e){e.runPython('\nimport micropip\nmicropip.add_mock_package(\n "pyarrow", "0.0.1",\n modules={\n "pyarrow": """\n__version__ = \'0.0.1\' # TODO: Update when releasing\n\n\nclass Table:\n @classmethod\n def from_pandas(*args, **kwargs):\n raise NotImplementedError("stlite is not supporting this method.")\n"""\n }\n)\n')}var c=function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function a(e){try{l(r.next(e))}catch(t){s(t)}}function i(e){try{l(r.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}l((r=r.apply(e,t||[])).next())}))};var g=function(e,t,n,r){return new(n||(n=Promise))((function(o,s){function a(e){try{l(r.next(e))}catch(t){s(t)}}function i(e){try{l(r.throw(e))}catch(t){s(t)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}l((r=r.apply(e,t||[])).next())}))};const d=n.g;function u(e,t,n){const r=function(e,t,n){return c(this,void 0,void 0,(function*(){const r=n.map((t=>function(e,t){return e.pyodide_py.ffi._pyodide._base.find_imports(t).toJs()}(e,t))),o=Array.from(new Set(r.flat())).filter((t=>!e.runPython(`__import__('importlib').util.find_spec('${t}')`))).map((t=>e._api._import_name_to_package_name.get(t))).filter((e=>e));if(0===o.length)return;const s=new MessageChannel;t({type:"event:moduleAutoLoad",data:{packagesToLoad:o}},s.port2);try{const t=yield e.loadPackage(o);return s.port1.postMessage({type:"moduleAutoLoad:success",data:{loadedPackages:t}}),void s.port1.close()}catch(a){throw s.port1.postMessage({type:"moduleAutoLoad:error",error:a}),s.port1.close(),a}}))}(e,t,n);d.__moduleAutoLoadPromise__=r,e.runPythonAsync("\nfrom streamlit.runtime.scriptrunner import script_runner\nfrom js import __moduleAutoLoadPromise__\n\nscript_runner.moduleAutoLoadPromise = __moduleAutoLoadPromise__\n")}const p=self.postMessage;self.onmessage=function(t,n,r){function a(e){n({type:"event:progress",data:{message:e}})}let c,p;const m=new e,f=function(){var e,o;return g(this,void 0,void 0,(function*(){const f=yield m.promise,h=Object.assign(Object.assign({},r),f);console.debug("Initial data",h);const{entrypoint:_,files:y,archives:v,requirements:b,prebuiltPackageNames:w,wheels:k,mountedSitePackagesSnapshotFilePath:S,pyodideUrl:A=t,streamlitConfig:P,idbfsMountpoints:C,nodefsMountpoints:F,moduleAutoLoad:O}=h,j=i(b);a("Loading Pyodide."),console.debug("Loading Pyodide"),c=yield function(e,t){return g(this,void 0,void 0,(function*(){const n=e.slice(0,e.lastIndexOf("/")+1);let r;return e.endsWith(".mjs")?r=(yield import(e)).loadPyodide:(importScripts(e),r=d.loadPyodide),r(Object.assign(Object.assign({},t),{indexURL:n}))}))}(A,{stdout:console.log,stderr:console.error}),console.debug("Loaded Pyodide");let x=!1;C&&(x=!0,C.forEach((e=>{c.FS.mkdir(e),c.FS.mount(c.FS.filesystems.IDBFS,{},e)})),yield new Promise(((e,t)=>{c.FS.syncfs(!0,(n=>{n?t(n):e()}))}))),F&&Object.entries(F).forEach((([e,t])=>{c.FS.mkdir(e),c.FS.mount(c.FS.filesystems.NODEFS,{root:t},e)})),a("Mounting files.");const L=[];if(yield Promise.all(Object.keys(y).map((e=>g(this,void 0,void 0,(function*(){const t=y[e];let n;"url"in t?(console.debug(`Fetch a file from ${t.url}`),n=yield fetch(t.url).then((e=>e.arrayBuffer())).then((e=>new Uint8Array(e)))):n=t.data;const{opts:r}=y[e];console.debug(`Write a file "${e}"`),s(c,e,n,r),e.endsWith(".py")&&L.push(e)}))))),a("Unpacking archives."),yield Promise.all(v.map((e=>g(this,void 0,void 0,(function*(){let t;"url"in e?(console.debug(`Fetch an archive from ${e.url}`),t=yield fetch(e.url).then((e=>e.arrayBuffer()))):t=e.buffer;const{format:n,options:r}=e;console.debug("Unpack an archive",{format:n,options:r}),c.unpackArchive(t,n,r)}))))),!S&&!k)throw new Error("Neither snapshot nor wheel files are provided.");S&&(a("Restoring the snapshot."),yield c.runPythonAsync("import tarfile, shutil, site"),yield c.runPythonAsync("\nsite_packages_dirs = site.getsitepackages()\nfor site_packages in site_packages_dirs:\n shutil.rmtree(site_packages)\n"),console.debug(`Unarchive ${S}`),yield c.runPythonAsync(`\nwith tarfile.open("${S}", "r") as tar_gz_file:\n tar_gz_file.extractall("/")\n`),console.debug("Restored the snapshot"),a("Mocking some packages."),console.debug("Mock pyarrow"),l(c),console.debug("Mocked pyarrow")),a("Installing packages."),console.debug("Installing the prebuilt packages:",w),yield c.loadPackage(w),console.debug("Installed the prebuilt packages"),yield c.loadPackage("micropip");const I=c.pyimport("micropip");if(k?(console.debug("Installing the wheels:",k,"and the requirements:",j),yield I.install.callKwargs([k.stliteServer,k.streamlit,...j],{keep_going:!0}),console.debug("Installed the wheels and the requirements"),a("Mocking some packages."),console.debug("Mock pyarrow"),l(c),console.debug("Mocked pyarrow")):(console.debug("Installing the requirements:",j),yield I.install.callKwargs(j,{keep_going:!0}),console.debug("Installed the requirements")),O){const e=L.map((e=>c.FS.readFile(e,{encoding:"utf8"})));u(c,n,e)}yield c.runPythonAsync("\nimport importlib\nimportlib.invalidate_caches()\n"),a("Loading streamlit package."),console.debug("Loading the Streamlit package"),yield c.runPythonAsync("\nimport streamlit.runtime\n "),console.debug("Loaded the Streamlit package"),a("Setting up the loggers."),console.debug("Setting the loggers"),yield c.runPythonAsync('\nimport logging\nimport streamlit.logger\n\nstreamlit.logger.get_logger = logging.getLogger\nstreamlit.logger.setup_formatter = None\nstreamlit.logger.update_formatter = lambda *a, **k: None\nstreamlit.logger.set_log_level = lambda *a, **k: None\n\nfor name in streamlit.logger._loggers.keys():\n if name == "root":\n name = "streamlit"\n logger = logging.getLogger(name)\n logger.propagate = True\n logger.handlers.clear()\n logger.setLevel(logging.NOTSET)\n\nstreamlit.logger._loggers = {}\n');d.__logCallback__=(e,t)=>{e>=40?console.error(t):e>=30?console.warn(t):e>=20?console.info(t):console.debug(t)},yield c.runPythonAsync('\ndef setup_loggers(streamlit_level, streamlit_message_format):\n from js import __logCallback__\n\n\n class JsHandler(logging.Handler):\n def emit(self, record):\n msg = self.format(record)\n __logCallback__(record.levelno, msg)\n\n\n root_message_format = "%(levelname)s:%(name)s:%(message)s"\n\n root_logger = logging.getLogger()\n root_logger.handlers.clear()\n root_formatter = logging.Formatter(root_message_format)\n root_handler = JsHandler()\n root_handler.setFormatter(root_formatter)\n root_logger.addHandler(root_handler)\n root_logger.setLevel(logging.DEBUG)\n\n streamlit_logger = logging.getLogger("streamlit")\n streamlit_logger.propagate = False\n streamlit_logger.handlers.clear()\n streamlit_formatter = logging.Formatter(streamlit_message_format)\n streamlit_handler = JsHandler()\n streamlit_handler.setFormatter(streamlit_formatter)\n streamlit_logger.addHandler(streamlit_handler)\n streamlit_logger.setLevel(streamlit_level.upper())\n');const E=(null!==(e=null===P||void 0===P?void 0:P["logger.level"])&&void 0!==e?e:"INFO").toString(),M=null!==(o=null===P||void 0===P?void 0:P["logger.messageFormat"])&&void 0!==o?o:"%(asctime)s %(message)s";if(c.globals.get("setup_loggers")(E,M),console.debug("Set the loggers"),a("Mocking some Streamlit functions for the browser environment."),console.debug("Mocking some Streamlit functions"),yield c.runPythonAsync("\nimport streamlit\n\ndef is_cacheable_msg(msg):\n return False\n\nstreamlit.runtime.runtime.is_cacheable_msg = is_cacheable_msg\n"),console.debug("Mocked some Streamlit functions"),x){a("Setting up the IndexedDB filesystem synchronizer."),console.debug("Setting up the IndexedDB filesystem synchronizer");let e=!1;d.__scriptFinishedCallback__=()=>{console.debug("The script has finished. Syncing the filesystem."),e||(e=!0,c.FS.syncfs(!1,(t=>{e=!1,t&&console.error(t)})))},yield c.runPythonAsync('\nfrom streamlit.runtime.app_session import AppSession\nfrom streamlit.runtime.scriptrunner import ScriptRunnerEvent\nfrom js import __scriptFinishedCallback__\n\ndef wrap_app_session_on_scriptrunner_event(original_method):\n def wrapped(self, *args, **kwargs):\n if "event" in kwargs:\n event = kwargs["event"]\n if event == ScriptRunnerEvent.SCRIPT_STOPPED_WITH_SUCCESS or event == ScriptRunnerEvent.SCRIPT_STOPPED_FOR_RERUN or event == ScriptRunnerEvent.SHUTDOWN:\n __scriptFinishedCallback__()\n return original_method(self, *args, **kwargs)\n return wrapped\n\nAppSession._on_scriptrunner_event = wrap_app_session_on_scriptrunner_event(AppSession._on_scriptrunner_event)\n'),console.debug("Set up the IndexedDB filesystem synchronizer")}return a("Booting up the Streamlit server."),console.debug("Booting up the Streamlit server"),d.__streamlitFlagOptions__=Object.assign(Object.assign({"browser.gatherUsageStats":!1},P),{"runner.fastReruns":!1}),yield c.runPythonAsync(`\nfrom stlite_server.bootstrap import load_config_options, prepare\nfrom stlite_server.server import Server\nfrom js import __streamlitFlagOptions__\n\nflag_options = __streamlitFlagOptions__.to_py()\nload_config_options(flag_options)\n\nmain_script_path = "${_}"\nargs = []\n\nprepare(main_script_path, args)\n\nserver = Server(main_script_path)\nserver.start()\n`),console.debug("Booted up the Streamlit server"),console.debug("Setting up the HTTP server"),p=c.globals.get("server").copy(),console.debug("Set up the HTTP server"),n({type:"event:loaded"}),h}))}().catch((e=>{throw n({type:"event:error",data:{error:e}}),e}));return n({type:"event:start"}),e=>g(this,void 0,void 0,(function*(){const t=e.data;if("initData"===t.type)return void m.resolve(t.data);const{moduleAutoLoad:r}=yield f,a=e.ports[0];try{switch(t.type){case"websocket:connect":{console.debug("websocket:connect",t.data);const{path:e}=t.data;p.start_websocket(e,((e,t)=>{if(t){const t=e,r=t.getBuffer("u8");t.destroy();const o=new Uint8ClampedArray(r.data.buffer,r.data.byteOffset,r.data.byteLength);n({type:"websocket:message",data:{payload:new Uint8Array(o)}})}else{n({type:"websocket:message",data:{payload:e}})}})),a.postMessage({type:"reply"});break}case"websocket:send":{console.debug("websocket:send",t.data);const{payload:e}=t.data;p.receive_websocket_from_js(e);break}case"http:request":{console.debug("http:request",t.data);const{request:e}=t.data,n=(e,t,n)=>{const r=new Map(t.toJs()),o=n.toJs();console.debug({statusCode:e,headers:r,body:o});const s={type:"http:response",data:{response:{statusCode:e,headers:r,body:o}}};a.postMessage(s)};p.receive_http_from_js(e.method,decodeURIComponent(e.path),e.headers,e.body,n);break}case"file:write":{const{path:e,data:o,opts:i}=t.data;r&&"string"===typeof o&&e.endsWith(".py")&&(console.debug(`Auto install the requirements in ${e}`),u(c,n,[o])),console.debug(`Write a file "${e}"`),s(c,e,o,i),a.postMessage({type:"reply"});break}case"file:rename":{const{oldPath:e,newPath:n}=t.data;console.debug(`Rename "${e}" to ${n}`),function(e,t,n){o(e,n),e.FS.rename(t,n)}(c,e,n),a.postMessage({type:"reply"});break}case"file:unlink":{const{path:e}=t.data;console.debug(`Remove "${e}`),c.FS.unlink(e),a.postMessage({type:"reply"});break}case"install":{const{requirements:e}=t.data,n=c.pyimport("micropip"),r=i(e);console.debug("Install the requirements:",r),yield n.install.callKwargs(r,{keep_going:!0}).then((()=>{console.debug("Successfully installed"),a.postMessage({type:"reply"})}))}}}catch(l){if(console.error(l),!(l instanceof Error))throw l;const e=new Error(l.message);e.name=l.name,e.stack=l.stack,a.postMessage({type:"reply",error:e})}}))}("https://cdn.jsdelivr.net/pyodide/v0.26.0/full/pyodide.js",((e,t)=>p(e,t?[t]:void 0)))})()})();
|