bpo-36889: Merge asyncio streams by asvetlov · Pull Request #13251 · python/cpython
The main part is basically done. The functionality is test covered for all significant code paths because the PR doesn't change too much but "just" merges StreamReader and StreamWriter.
There are two options for future steps:
- Add several tests for
StreamModerelated API, write NEWS, merge and make other improvements in following pull requests. I prefer this way for the sake of simplifying the review process. I have a strong feeling that the proposed change is viable. We did miss it starting from Python 3.5. - Another approach is to keep working on this branch to collect all wish changes at once. The review becomes complicated though.
The wish list is:
- Add
asyncio.connect()andasyncio.StreamServer()to avoid working withstream, streamwhere wasreader, writer. The same for UNIX sockets.
StreamServershould be mimic toasyncio.AbstractServerbut without boilerplate. The usage is:
async with StreamServer(host, port) as server:
await server.serve_forever()
StreamServer should create low-level asyncio server (loop.create_server()) with start_serving=False. We discussed the server design with @1st1 offline already.
-
Support both Windows and UNIX pipes (a new API whose implementation is really trivial with unified streams). See
loop.connect_read_pipeandloop.connect_write_pipefor the context. -
Rewrite
SubprocessStreamProtocolto add subprotocols from stdin, stdout, and stderr. It can simplify things a lot.