[openstack-dev] [solum] async / threading for python 2 and 3

victor stinner victor.stinner at enovance.com
Thu Feb 20 12:52:52 UTC 2014


Hi,

> On 19/02/14 10:09 +0100, Julien Danjou wrote:
> >On Wed, Feb 19 2014, Angus Salkeld wrote:
> >
> >> 2) use tulip and give up python 2
> >
> >+ use trollius to have Python 2 support.
> >
> >  https://pypi.python.org/pypi/trollius
> 
> So I have been giving this a go.

FYI I'm the author of Trollius project.

> We use pecan and wsme (like ceilometer), I wanted to use
> a httpserver library in place of wsgiref.server so had a
> look at a couple and can't use them as they all have "yield from"
> all over the place (i.e. python 3 only). The quesion I have
> is:
> How useful is trollius if we can't use other thirdparty libraries
> written for asyncio?
> https://github.com/KeepSafe/aiohttp/blob/master/aiohttp/server.py#L171
> 
> Maybe I am missing something?

(Tulip and Trollius unit tests use wsgiref.simple_server module of the standard library. It works but you said that you don't want to use it.)

Honestly, I have no answer to your question right now ("How useful is trollius ..."). asyncio developers are working on fixing last bugs in asyncio (Trollius is a fork, I merge regulary updates from Tulip into Trollius) and adding some late features before the Python 3.4 release. This Python release will be somehow the "version 1.0" of asyncio and will freeze the API. Right now, I'm working on a proof-on-concept of eventlet hub using asyncio event loop. So it may be possible to use eventlet and asyncio APIs are the same time. And maybe slowly replace eventlet with asyncio, or at least use asyncio in new code.

I asked your question on Tulip mailing list to see how a single code base could support Tulip (yield from) and Trollius (yield). At least check if it's technically possible.

Victor



More information about the OpenStack-dev mailing list