> On Nov 8, 2016, at 2:17 AM, Cory Benfield <c...@lukasa.co.uk> wrote:
> 
> Tubes is unquestionably a better API for this, but suffers from a lack of 
> accessibility.

What is "accessibility" in this context?

> It would definitely be interesting to see if tubes can be easily replicated 
> on top of asyncio (and indeed curio), because at least for me something like 
> tubes is what I’ve wanted for a long time in the Python world. If the design 
> of tubes is interesting to the asyncio team, it would justify spending more 
> time trying to integrate it

I obviously can't speak to the interest of the asyncio team, but binding it to 
asyncio (you shouldn't need to "replicate" it, the library is designed to be 
portable to multiple backends) should be pretty easy.  All you need to do is to 
write asyncio versions of these two modules:

https://github.com/twisted/tubes/blob/2089781479a8f4a2d3027c88560bb5f39cfd90a1/tubes/protocol.py
https://github.com/twisted/tubes/blob/2089781479a8f4a2d3027c88560bb5f39cfd90a1/tubes/undefer.py

That's <500 lines of heavily documented, generously spaced code.  Nothing else 
in the package ought to import Twisted.

Given the similarity of asyncio's and Twisted's low-level callback interfaces, 
I imagine the translation would be fairly literal; the only real stumbling 
block is the lack of interfaces like IStreamServerEndpoint and 
IStreamClientEndpoint in asyncio.  However, given that these interfaces are 
just one method each, adding a literal equivalent that just calls 
event_loop.create_connection and event_loop.create_server just for Tubes would 
give you _exactly_ the same interface.

-glyph

_______________________________________________
Async-sig mailing list
Async-sig@python.org
https://mail.python.org/mailman/listinfo/async-sig
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to