Although installing a web framework in the browser is really a pointless and futile exercise, we could maybe still create a demo showcasing the test client? :thinking:
In any case, I tried installing Falcon in Pyodide REPL just for fun, and hit quite many roadblocks.
[x] micropip picks only Falcon 2.0, because in the 3.x series we have no universal wheel. This will be addressed as part of the 4.0 release, where we ship one. I could specify the 4.0dev2 wheel by URL from TestPyPI.
[ ] WSGI test client fails wsgiref validation: AssertionError: wsgi.errors (<pyodide.console._WriteStream object at 0x15653e8>) doesn't have the attribute writelines. Not sure if it is something we should address, or we could file a bug upstream. :arrow_left: Filed as https://github.com/pyodide/pyodide/issues/5053 for now.
[ ] ASGI test client fails running anything, because our async_to_sync(...) doesn't work from inside a loop: RuntimeError: Runner.run() cannot be called from a running event loop. The Pyodide REPL seems to run the equivalent of python -m asyncio. :arrow_left: Filed as #2321.
ASGIConductor works out of the box though!
(With Cibuildwheel, we could also prepare a binary Pyodide wheel for 3.13, but I think optimizing performance in this scenario is pretty much moot.)
One could take a look if it is easy to embed that REPL script with our code snippets preseeded, ideally with a selector to test different examples and/or tutorials.
Although installing a web framework in the browser is really a pointless and futile exercise, we could maybe still create a demo showcasing the test client? :thinking:
In any case, I tried installing Falcon in Pyodide REPL just for fun, and hit quite many roadblocks.
micropip
picks only Falcon 2.0, because in the 3.x series we have no universal wheel. This will be addressed as part of the 4.0 release, where we ship one. I could specify the 4.0dev2 wheel by URL from TestPyPI.AssertionError: wsgi.errors (<pyodide.console._WriteStream object at 0x15653e8>) doesn't have the attribute writelines
. Not sure if it is something we should address, or we could file a bug upstream. :arrow_left: Filed as https://github.com/pyodide/pyodide/issues/5053 for now.async_to_sync(...)
doesn't work from inside a loop:RuntimeError: Runner.run() cannot be called from a running event loop
. The Pyodide REPL seems to run the equivalent ofpython -m asyncio
. :arrow_left: Filed as #2321.ASGIConductor
works out of the box though!(With Cibuildwheel, we could also prepare a binary Pyodide wheel for 3.13, but I think optimizing performance in this scenario is pretty much moot.)
One could take a look if it is easy to embed that REPL script with our code snippets preseeded, ideally with a selector to test different examples and/or tutorials.