Hi all,

Last month I've been playing with asyncio and I ended up writing an 
asynchronous console. It's a python console just like the one in the 'code' 
module, but running in an asyncio event loop instead. That means it lets 
you interact with the program environment while it's running other 
asynchronous tasks. It also supports the `await` syntax so it is possible 
to wait for a task to complete:

>>> await asyncio.sleep(1, result=3)
# Wait 1 sec
3

I then realized It could easily be adapted to support asyncio streams in 
order to serve the console over the network. But since sharing a direct 
access to your machine is probably not the best idea, I thought it'd be 
nice to replace the arbitrary code execution with a limited set of 
commands. Those commands are described using 'argparse' parsers, leading to 
a fairly simple way to create and share a command line interface over the 
network.

All this work is available in a github repo. The README file covers most of 
the features and includes step-by-step examples:
https://github.com/vxgmichel/python3-apython

I could definitely use some feedback on this project. Some parts of the 
code are pretty hackish (especially for the asynchronous exec part), and 
I'm not sure I handle the standard streams correctly. Although it was a fun 
project to work on, it is still unclear what it could be useful for, and 
what the use cases would be. I think debugging might be one thing, though 
there might be other, more powerful tools around to serve this purpose. So 
I'm also interested in comments from people with a wider view of the 
asyncio ecosystem.

Thanks,

Vincent

Reply via email to