-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Deprecate aiohttp.wsgi #1108
Comments
gunicorn.gaiohttp depends on wsgi |
Uuups. |
we can replace gaiohttp with newer implementation that support both aiohttp.wsgi and aiohttp.web |
Agree with the plan |
Hi! I'd like to put my ten kopeks in, regarding aiohttp.wsgi. Turned out useless for me, as my goal was to seamlessly attach inherently synchronous wsgi app (WsgiDav in my case) to an asyncio application, where aiohttp is used only for HTTP-based protocols. The solution was to develop the class which automatically performs 2way coroutine<->function conversion, thus allowing, for instance, to wrap async StreamReader into non-async one and pass it to an app. Well, no magic in here, drawbacks are obvious:
... so at least we could easily have a stall in our wsgi app, although never in the main event loop, so we could adjust the pool size, swap pools, etc. - all hypothetical, had no occasion to try that out, as our real loads are laughable :) For those, interested in actual code, here is the gist of the class (NB. it is from non-public application in alpha-stage so the clumsy code, I've also removed some aux. stuff, eg. our approach to routing, in order to be clean, just don't expect the code below to work as-is; moreover, WSGIHttpServerProtocol has poorly fitted my preference for abstractions used, so class is more-or-less application-like (conceptually, not literaly the web.Application)): Helpers operating at the very heart, to better understand what the heck is going on:) https://gist.github.com/xpinguin/e77a4a817aa1b1590de1743fa41f6671#file-wsgiapp_helpers-py corofunc<->func transforms, hardly any quirks, although may be interesting: Long story short, I do like aiohttp-core, very neat (unfortunately, couldn't say so about routers&resources). I am pretty much interested in the full-blown WSGI support, just not in the current form. What do you guys think about all that? |
|
I'm not from the webdev or mobile scene, so I could've misinterpreted the design goals behind aiohttp.wsgi, sorry then... Yet still, despite my ignorance about gunicorn and all the stuff alike, "aiohttp.wsgi" sounds just perfect for the module containing wsgi->aiohttp adaptor(s), isn't it? |
@xpinguin current |
Just to clarify:
@asvetlov got your reply while writing this comment, so I leave the clarification points, yet as I understood, the answer is "don't bother with PR, aiohttp has different design goals", correct? |
asyncio http server doesn't mean wsgi http server :) |
Ahh, ok then. That renders my suggestion irrelevant.
Yes. So if anyone shows interest towards the idea, I'd probably do that. |
@xpinguin i hope you understand that running sync and async code in same thread is bad idea. real approach should be spawn new thread for wsgi process and then forward data from aiohttp into that thread, but this project already exists, https://github.com/etianen/aiohttp-wsgi @asvetlov btw aiohttp-wsgi seems pretty active, should we mention that in documentation? |
Why not? What exact place in our doc is the best from your perspective? |
i think it should be faq, like "how to use wsgi app with aiohttp" |
@fafhrd91 I think you really should've read my first comment here, before diving in into the bliss of arrogance. I am not even mentioning the source code, I've provided (though it is indeed a laborous procedure, without any sarcasm) - then you'd be able to get an idea why P.S. I've never seen
IMO, solution with ReadBuffer, overflowing to the file is suboptimal. I think that project could benefit from the approach employed in |
Another problem with That's closely relates to the more broad concept which was touched slightly by |
Well, it means that making proper bridge between aiohttp and sync WSGI is hard. @xpinguin please send a link to your implementation when (and if) you publish it as Open Source. |
@asvetlov yeah, the very existence of I'll let you know (hopefully) soon, thanks! |
Hello! I'm the author of aiohttp-wsgi. 😄 I would be very happy to have it added to the aiohttp documentation as a 3rd party app. To explain some of my implementation decisions:
The end result is that a WSGI app running in aiohttp-wsgi is a bit like running gunicorn behind nginx. All network IO is buffered, and the web workers only perform short-running HTTP requests. |
@asvetlov lets mark |
added PR to gunicorn benoitc/gunicorn#1418 |
Cool! |
dropping wsgi support in 2.0 |
Currently the module is not 100% compatible with WSGI standard, it works bad with big payload but introduces
'async.reader'
and'async.writer'
fields in WSGI environment dictionary.It's not documented also.
Should we support it at all?
I suggest adding explicit deprecation and removing
wsgi
mentions from documentation.After 1.5 years of deprecation period we may drop the module at all.
If somebody want to support the module -- please do it outside of aiohttp project.
The text was updated successfully, but these errors were encountered: