3 ms·
Question - is there any web/api framework that leverages asyncio ? This implicitly also means first class DB/ORM support. Flask, sqlalchemy ,etc seem to be usi
by sandGorgon 11y ago
Question - is there any web/api framework that leverages asyncio ? This implicitly also means first class DB/ORM support.
Flask, sqlalchemy ,etc seem to be using gevent and py 2.7.
- e12e 11y agoI'm not sure, but perhaps aiohttp[1] fits the bill? Not sure if there's a "full" framework that does everything, but take a look at the simple benchmark code: https://github.com/klen/py-frameworks-bench/blob/develop/frameworks/aiohttp/app.py https://github.com/klen/py-frameworks-bench/blob/develop/fra... (from: http://klen.github.io/py-frameworks-bench/ http://klen.github.io/py-frameworks-bench/) [1] http://aiohttp.readthedocs.org/en/stable/ http://aiohttp.readthedocs.org/en/stable/
- sandGorgon 11y agoin this case, how are most of you guys writing code with asyncio ? or is there any code being written at all. Right now, it seems to me that Python 3.5 is not ready for adoption since it is not usable with any framework at all. I mean, I really want to use asyncio, but 99% of python mindshare is around SqlAlchemy, Bottle, Flask, Django and Cherrypy. and I cant use it with any of them. aiohttp looks cool, but I would much rather use one of the above for now. Anybody know why are none of these framework maintainers leveraging this stuff ?
- deleted 11y ago[deleted]
- telendt 11y agoYes, there is. https://github.com/KeepSafe/aiohttp https://github.com/KeepSafe/aiohttp It's hard to write an asynchronous ORM though. Your options are either to use some existing synchronous ORM (like SQLAlchemy) in a thread pool (`loop.run_in_executor`) or use more low-level db driver: https://github.com/aio-libs/aiopg#example-of-sqlalchemy-optional-integration https://github.com/aio-libs/aiopg#example-of-sqlalchemy-opti...
- deleted 11y ago[deleted]
- sandGorgon 11y agopsycogreen is one such attempt with gevent - it works pretty well actually. that actually illustrates the confusion I'm having - gevent+py2.7 is actually working with all the major frameworks and giving all these performance benefits. In fact if you look closely at the benchmark code (https://github.com/klen/py-frameworks-bench/blob/develop/frameworks/flask/requirements.txt https://github.com/klen/py-frameworks-bench/blob/develop/fra...), the comparison is not against flask+gevent+psycogreen which may change the numbers. https://pypi.python.org/pypi/psycogreen/1.0 https://pypi.python.org/pypi/psycogreen/1.0
- eeZi 11y agoThe RethinkDB Python driver works exceptionally well with asyncio.
- e12e 11y agoThe asyncio example/benchmark snippet I linked above uses peewee-async: https://peewee-async.readthedocs.org https://peewee-async.readthedocs.org
- anebg 11y agoPulsar[1] and pulsar-odm seem to be the python equivalent of akka-http. (Actor based concurrency and ORM[2]) [1] http://pythonhosted.org/pulsar/ http://pythonhosted.org/pulsar/ [2] https://pypi.python.org/pypi/pulsar-odm https://pypi.python.org/pypi/pulsar-odm
- aldanor 11y agoTornado added support for that recently, I believe