DEV Community

Discussion on: Use Python in your browser client code together with JS. No server required, thanks to Web Assembly

Collapse
 
jackryan1989 profile image
Jack Ryan

Hey Reuben, this is super exciting! Thanks for showcasing this. For someone who is a total newbie to WASM (and web development generally) can you point out the bits in your snippet that are WASM functions/methods? For example is the window.languagePluginUrl a WASM method?

Collapse
 
rubenwap profile image
Ruben Sanchez

Thanks Jack! I am a newbie myself in WASM, so I hope I am not getting this wrong:

The methods and functions that you see in the snippet are all Javascript. The .wasm module which contains the Python distribution used for this (Pyodide) is also loaded via Javascript, but you don't see it here because the loading takes place in the imported pyodide.js file

This Pyodide project not only compiles Python into Web Assembly, but it also provides a Javascript API so you can interact with it via the browser, so all what you see here are functions related to the API. You might be interested in this, which contains the JS API explanation: pyodide.readthedocs.io/en/latest/a...