How to use sqlalchemy via pyodide

I understand that with Pyodide I can:

A) install a pure Python package via micropip from PyPI or a URL to a .whl file

Example:

        pyodide.runPythonAsync(`
          import micropip
          await micropip.install('pyicloud')
        `);

B) load a package with native extensions if it was built with Pyodide and is present in the Pyodide repository:

Example:

        pyodide.loadPackage(
          [
            "pandas",
          ]
        );

However, how do you handle cases of dependencies that are neither A) nor B)?

Example: my_new_library requires sqlmodel which requires sqlalchemy which has native extensions but is not in list of pre-built packages for Pyodide.

Therefore, if I try to install the .whl of my_new_library with micropip, I get the following error on the JavaScript console:

    pyodide.asm.js:14 Uncaught (in promise) PythonError: Traceback (most recent call last):
      File "/lib/python3.9/asyncio/futures.py", line 201, in result
        raise self._exception
      File "/lib/python3.9/asyncio/tasks.py", line 258, in __step
        result = coro.throw(exc)
      File "/lib/python3.9/site-packages/_pyodide/_base.py", line 494, in eval_code_async
        await CodeRunner(
      File "/lib/python3.9/site-packages/_pyodide/_base.py", line 347, in run_async
        await coroutine
      File "<exec>", line 3, in <module>
      File "/lib/python3.9/asyncio/futures.py", line 284, in __await__
        yield self  # This tells Task to wait for completion.
      File "/lib/python3.9/asyncio/tasks.py", line 328, in __wakeup
        future.result()
      File "/lib/python3.9/asyncio/futures.py", line 201, in result
        raise self._exception
      File "/lib/python3.9/asyncio/tasks.py", line 256, in __step
        result = coro.send(None)
      File "/lib/python3.9/site-packages/micropip/_micropip.py", line 191, in install
        raise ValueError(
    ValueError: Couldn't find a pure Python 3 wheel for: 'sqlalchemy<1.5.0,>=1.4.17'
    
        at new_error (pyodide.asm.js:14)
        at pyodide.asm.wasm:0xe6eb0
        at pyodide.asm.wasm:0xeacfd
        at method_call_trampoline (pyodide.asm.js:14)
        at pyodide.asm.wasm:0x121318
        at pyodide.asm.wasm:0x209acf
        at pyodide.asm.wasm:0x160f8b
        at pyodide.asm.wasm:0x121865
        at pyodide.asm.wasm:0x12195f
        at pyodide.asm.wasm:0x121a2d

Solution 1:

Looks like it should work now.. I see, its added to the officially supported built-in packages.

https://github.com/pyodide/pyodide/tree/main/packages

enter image description here