I have implemented pyodide in browser for small web apps. Some python package have no pure python wheel so I have built locally then uploaded to CDN. This python wheel can be installed using micropip in pyodide.
So my questions, is there way to build the wheel in browser for pyodide. What will be difficulty for implementing this? I am curious to know. Thanks
To the extent that a wheel of a pure Python packages consists of some Python files with metadata, packaged as a ZIP file, you can certainly create such an archive in Pyodide.
In practice though, wheels are most commonly created with setuptools or the wheel package which has following challenges for pyodide:
subprocess
module which is not supported in WebAssembly VM, meaning that it would need to be patched to avoid making subprocess callssetup.py
(and build requirements inpyproject.toml
) imply that one is able to download and install dependencies with pip which poses its own chalenges, namely,For those reason, micropip was written as very rudimentary alternative to pip in the context of pyodide.
It's also a good idea to create wheels for pure python packages even for Python on classical architectures, as they don't require arbitrary code execution to install. Which means that wheels are safer, more reliable and faster to install.