<div dir="ltr"><div class="gmail_extra">On 12 March 2014 07:28, Chris Withers <span dir="ltr"><<a href="mailto:chris@simplistix.co.uk" target="_blank">chris@simplistix.co.uk</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>So, I see python now has a plethora of async frameworks and I need to try and pick one to use from:<br><br>- asyncio/tulip<br>- tornado<br>- twisted<br><br>From my side, I'm looking to experimentally build a network testing tool that will need to speak a fair few protocols, both classic tcp and multicast-based, and have a web api living on top of it that most likely will have a websocket for pumping data to the browser. It'll also need to write out JUnit-compatible xml results, but that's like the easiest bit ;-)<br>
<br>I'd like to be able to serve the rest of the web api using a pyramid wsgi app if possible, and I'd like to be able to write the things that process requests in and validation out in a synchronous fashion, most likely spinning off a thread for each one.<br>
</blockquote><div><br></div><div>Tornado is a web-framework, if you are going to use pyramid for handling wsgi requests asyncio or twisted are probably a better solution. They can handle your synchronous wsgi responses via the event loop executor (a thread pool).</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><br>The protocols are all financial (do we really not have a pure-python FIX library?!) but none are likely to have existing python implementations.<br>
</blockquote><div><br></div><div>Both asyncio and twisted offer an extensive, somehow similar, API for writing protocols, TCP and UDP.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>How should I pick between the options? What would people recommend and why?<br><br></blockquote><div><br></div><div>If you are using python 3.3 I would strongly recommend asyncio, it has a clean and unintrusive API and, importantly, it is part of the standard library (in python 3.4).</div>
<div>If you are using python 2 I would still recommend it, the trollius project has backported the library (although there are some important differences).</div><div>Pulsar, is a server side library I maintain which is now fully based on asyncio, works on python 3 & 2, and does more or less what you are looking for.</div>
<div>Of course, twisted is more tested and has a longer history, but if you are forward looking asyncio might be a better bet.</div><div><br></div></div></div>