Skip to content

gh-92679: Clarify roles of asyncio protocols and transports #92680

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from

Conversation

arhadthedev
Copy link
Member

@arhadthedev arhadthedev commented May 11, 2022

@arhadthedev arhadthedev requested review from 1st1 and asvetlov as code owners May 11, 2022 16:55
@bedevere-bot bedevere-bot added docs Documentation in the Doc dir awaiting review labels May 11, 2022
@kumaraditya303 kumaraditya303 self-requested a review May 11, 2022 17:29
@arhadthedev
Copy link
Member Author

@1st1 Could you review and possibly merge please?

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I'm not convinced that this rewrite makes the matter all that much clearer to someone who doesn't already know what Protocols and Transports are.

FWIW, we didn't invent the terminology, we borrowed it from Twisted. I can never remember what they are until I see some source code -- then it falls in place easily. The second paragraph of the original, which you ruthlessly deleted, actually explains it rather clearly. You may object that it doesn't allow for a protocol/transport pair to be inserted between another transport/protocol pair, like middleware, e.g. start_tls. But the point of middleware (in this sense) is that it doesn't matter whether the "other end" is literally what you think it is (the application or the network, depending on which side you are standing), since it's always in fact some kind of abstraction. As long as it conforms to the right interface.

is an abstraction for an application, from the transport's point
of view.
The protocol object may either generate and consume data by its own (like a
fallback background sender behind :func:`~asyncio.loop.sendfile`), be an
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what a "fallback background sender" would be or why sendfile is used here. I suppose I could look it up in the source, but that's asking a bit much in a section labeled "Introduction". It should speak for itself.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry for postponing the stuff for so long. I've got a load of thesis work in the university so I'll be free and able to address all the comments a couple of weeks later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I am patiently waiting.

Yet another view is the transport and protocol interfaces
together define an abstract interface for using network I/O and
interprocess I/O.
While the transport is actively puppeteered by an asyncio event loop, the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"puppeteered" is a bit poetic for technical documentation. :-)

@kumaraditya303
Copy link
Contributor

The issue #92679 is closed, is this still relevant? @arhadthedev

@arhadthedev
Copy link
Member Author

@kumaraditya303 I believe it is. The issue had a greater scope of serious rehaul found to be worth a proper pypi library for real-world testing.

Co-authored-by: Guido van Rossum <[email protected]>
@kumaraditya303
Copy link
Contributor

I believe it is. The issue had a greater scope of serious rehaul found to be worth a proper pypi library for real-world testing.

Okay thanks! I believe Guido will review this better than me so leaving this to him.

@kumaraditya303 kumaraditya303 removed their request for review November 30, 2022 16:22
@arhadthedev
Copy link
Member Author

TBH I'm not convinced that this rewrite makes the matter all that much clearer to someone who doesn't already know what Protocols and Transports are.

FWIW, we didn't invent the terminology, we borrowed it from Twisted.

For a year, I've seen no evidence of the contrary so closing this PR.

@arhadthedev arhadthedev deleted the asyncio-protocol-doc branch April 16, 2023 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants