-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Update 'Asynchronous Applications' documentation #1464
Comments
Using an highly efficient async servers (e.g. gunicorn) is easy, as long as the server still speaks WSGI to applications. WSGI is synchronous by design, though. Bottle is a WSGI framework. Supporting ASGI and async/await request handlers in Bottle would be so much work, it may be easier to just build a new framework from scratch. So, that won't happen any time soon. There are lots of nice (and very Bottle-like) ASGI frameworks out there. Most applications do not need ASGI. Websockets are a very important exception, though. If you are fine with the synchronous nature of WSGI/Bottle and only need ASGI for websockets, then there are multiple options:
|
The gevent example still works, great. The last example is missing a I just found out that the gevent-websocket library also ships with a ready-to-use gunicorn worker! When starting the bottle app via I'll keep this issue open until I (or some one else?) find the time to update the documentation. |
Great, thanks for the speedy response. I think the FastAPI approach is a non-starter for me, the number of dependencies it would introduce adds way too much complexity to the project. I also found the greenlet/gevent stack to be rather heavyweight; I'll keep it in my back pocket but I'm pretty sure Python's I think the suggested approach of running an asynchronous server separately and reverse proxying to it makes the most sense to me. I'll need to find a good way of sharing application state between the two projects, or find a way to run them in a shared context. |
Regarding that last point, I think we might be back to my original question. Since libraries like |
Yes, with gunicorn+gevent you write your entire app as if you'd have an unlimited amount of threads in your thread pool and with the With |
If you want to try an asynchronous web framework with no dependencies and support for WebSockets, you might want to try baize. |
So, something that I didn't really consider until I found it saved in my GitHub stars: nchan It's a nginx library which seems to handle all of the complicated stuff in a very elegant way. You can POST data to the |
Happy to see Bottle get a version bump. I read through the patch notes and noticed added support for
aiohttp
anduvloop
server adapters. I'm hoping to add a basic websocket implementation to my bottle server (because this project is the best), and I would like to use the right tool for the job.According to this page of the bottle docs, the suggested solution is to use the gevent-websocket package. The library hasn't been updated in a while and I'm wondering if the solution you'd suggest has changed since the documentation was written. In this Github Issue defnull suggested using an asyncio server.
Given developments to asynchronous python libraries over the last few years, is there a more elegant solution to implementing asynchronous programming than is currently suggested by the documentation?
Also, as a higher level question - how much work would be required to adapt the current Bottle implementation to meet the newly established ASGI standard? Basically, is it within the scope of this project to fulfill that feature set or would it be a new thing entirely?
The text was updated successfully, but these errors were encountered: