Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a Falcon demonstration in Pyodide #2320

Open
1 of 3 tasks
vytas7 opened this issue Sep 5, 2024 · 0 comments
Open
1 of 3 tasks

Create a Falcon demonstration in Pyodide #2320

vytas7 opened this issue Sep 5, 2024 · 0 comments
Labels
community documentation needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks!
Milestone

Comments

@vytas7
Copy link
Member

vytas7 commented Sep 5, 2024

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? 🤔

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.
  • 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. ⬅️ Filed as sys.stderr has no attribute writelines pyodide/pyodide#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. ⬅️ Filed as falcon.async_to_sync() does not work inside an async loop #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.

@vytas7 vytas7 added this to the Version 4.x milestone Sep 5, 2024
@vytas7 vytas7 added the needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks! label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community documentation needs contributor Comment on this issue if you'd like to volunteer to work on this. Thanks!
Projects
None yet
Development

No branches or pull requests

1 participant