So, there is this already -- not sure how "complete" it is though (and looks like hasn't seen commits for 2+ years) but might have useful code:
Thanks meejah! Took a peek but they both look pretty old and it's unclear to me how complete either got. If there's something in particular you think is worthwhile integrating I'm all ears.
For any of these efforts, writing a "Tor protocol library" that *doesn't* do any I/O would be the most useful; then other Python tools can benefit from the protocol support without being tied to "threads" or to a particular async framework.
Actually, this uses a similar pattern as the rest of Stem in that cell packing/unpacking is independent of the threaded socket. Just as you could use stem.response for controller message parsing in txtorcon, you can use stem.client.cell for cell packing/unpacking with a twisted application too. That said, thanks for the reminder to keep this in mind as we go.
Cheers! -Damian