You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the current WASM build we can import the stdlib libraries written in Rust (time, hashlib for example) but we cannot import any python libs (collections for example). I would suggest to freeze all the modules in the Lib/ folder to allow them to be imported in WASM.
Detailed Explanation
When building the WASM build we will add all the modules in Lib/ to the hashmap in frozen.rs.
Drawbacks, Rationale, and Alternatives
This will increase the WASM build size.
Unresolved Questions
Should we add libraries like io and os?
Should we add this as a feature flag to the regular build?
The text was updated successfully, but these errors were encountered:
What we could also do, it extend the pythonpath with an url, and create wasm import hook. So, sys.path will contain https://demo.rustpython.github.io/stdlib, and when we import the logging module, this url is also queried. If a 404 is returned, it means not found, and import resolution continues.
The only problem with that is that http requests are asynchronous, so we'd have to have some way of pausing execution of a module and then coming back to it once the promise resolves.
@windelbouwman I actually thought the same could be done but as @coolreader18 says that will be a problem with the asynchronous requests.
I think that allowing people to import code in the WASM without having to deal with asynchronous requests and promises will be great. I believe we should add the stdlib as default but allowing people to freeze whatever they want into the binary would be a great feature.
Summary
In the current WASM build we can import the stdlib libraries written in Rust (
time
,hashlib
for example) but we cannot import any python libs (collections
for example). I would suggest to freeze all the modules in theLib/
folder to allow them to be imported in WASM.Detailed Explanation
When building the WASM build we will add all the modules in
Lib/
to the hashmap infrozen.rs
.Drawbacks, Rationale, and Alternatives
Unresolved Questions
io
andos
?The text was updated successfully, but these errors were encountered: