◐ Shell
reader mode source ↗
Skip to content

bpo-36889: Document Stream and StreamServer.#14203

Merged
asvetlov merged 6 commits into
python:masterfrom
tirkarthi:bpo36889-docs
Jun 24, 2019
Merged

bpo-36889: Document Stream and StreamServer.#14203
asvetlov merged 6 commits into
python:masterfrom
tirkarthi:bpo36889-docs

Conversation

@tirkarthi

@tirkarthi tirkarthi commented Jun 18, 2019

Copy link
Copy Markdown
Member
  • Add docs for Stream, StreamServer, UnixStreamServer, connect and connect_unix.
  • Rewrite examples using Stream to avoid DeprecationWarning.

https://bugs.python.org/issue36889

@tirkarthi

Copy link
Copy Markdown
Member Author

Clarifications :

  • Stream object has mode that is an Enum. Does mode and enum values should be documented? StreamServer and connect that is recommended return Stream with READWRITE value.
  • Given that StreamReader and StreamWriter are merged together should I copy paste their methods to Stream?
  • StreamServer and UnixStreamServer have very similar API. I have copy pasted them but does it make sense to just redirect the user with a note to StreamServer that the methods are similar.

Thanks

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

Good job!
I have several comments/suggestions.

  1. There are connect_read_pipe() and connect_write_pipe() functions. Please document them.
  2. All public StreamServer / UnixStreamServer functions should be documented: bind(), is_bound(), abort().

5 hidden conversations Load more…
@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@tirkarthi

Copy link
Copy Markdown
Member Author

I have made the requested changes; please review again

  • Added doc for connect_read_pipe and connect_write_pipe. I have added a note that they can be used as context manager.
  • Modified all the examples to use context managers.
  • write calls are awaited.
  • Changed enter to __aenter__ and exit to __aexit__.
  • Added all public methods to StreamServer and also updated UnixStreamServer.

Clarifications :

  • I feel StreamServer and UnixStreamServer are almost exact duplicates. Can UnixStreamServer be added a note that it provides all methods as StreamServer? The downside is that user who visits UnixStreamServer is redirected to StreamServer that there is a slight redirection overhead.
  • I have documented connect_read_pipe and connect_write_pipe similar that they return Stream object of READ and Write mode. Should we document the StreamMode Enum?

@bedevere-bot

Copy link
Copy Markdown

Thanks for making the requested changes!

@asvetlov: please review the changes made to this pull request.

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

A good step forward!
I left some comments, please fix/discuss

4 hidden conversations Load more…
@asvetlov

Copy link
Copy Markdown
Contributor

I feel StreamServer and UnixStreamServer are almost exact duplicates. Can UnixStreamServer be added a note that it provides all methods as StreamServer? The downside is that user who visits UnixStreamServer is redirected to StreamServer that there is a slight redirection overhead.

I don't know. I don't want to make their base class public, so duplication is probably ok. We keep references is a good shape at least.

I have documented connect_read_pipe and connect_write_pipe similar that they return Stream object of READ and Write mode. Should we document the StreamMode Enum?

Yes, please do. StreamMode is a public class

@tirkarthi

Copy link
Copy Markdown
Member Author

Changes made :

  • Documented StreamMode and it's values. Linked the mode values in relevant places like connect, connect_unix, etc.
  • Used PEP 572 in example for while loop.
  • Added doc for constructor arguments in StreamServer and UnixStreamServer and a note on rest of the arguments.
  • Added doc for limit parameter to the functions.
  • Minor doc fixes to use double backticks and added more links to relevant StreamMode docs.

Please review the changes. Thanks.

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hide comment

Awesome!

@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @tirkarthi for the PR, and @asvetlov for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 24, 2019
(cherry picked from commit 6793cce)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
@bedevere-bot

Copy link
Copy Markdown

GH-14349 is a backport of this pull request to the 3.8 branch.

@tirkarthi

Copy link
Copy Markdown
Member Author

Thank you very much for the guidance Andrew :)

miss-islington added a commit that referenced this pull request Jun 24, 2019
(cherry picked from commit 6793cce)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
aeros added a commit to aeros/cpython that referenced this pull request Sep 27, 2019
aeros added a commit to aeros/cpython that referenced this pull request Sep 28, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip news

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants