Fwd: [python-tulip] Need help to finish asyncio documentation
We could really use more help reviewing and finishing asyncio's docs! ---------- Forwarded message ---------- From: Victor Stinner <victor.stinner@gmail.com> Date: Sat, Feb 8, 2014 at 2:38 PM Subject: [python-tulip] Need help to finish asyncio documentation To: python-tulip <python-tulip@googlegroups.com> Hi, I wrote most parts of the documentation of the asyncio module, but I'm not sure that anyone already read it yet. Can you please at least take at look? http://docs.python.org/dev/library/asyncio.html Tell me if the documentation needs more examples. I don't want to add whole applications, only very short examples to explain one feature or concept, or show how to use one specific API. I just realized that add/remove_reader/writer() methods of the event loop were not documented, sock_recv/sendall/accept/connect() methods neither. I documented them. There are still many functions which only have "XXX" for documentation. If you would like to contribute, send patches on .rst files. The source of the documentation is in the Doc/library/ directory of CPython repository: http://hg.python.org/cpython/ Files asyncio-*.rst: http://hg.python.org/cpython/file/default/Doc/library Victor -- --Guido van Rossum (python.org/~guido)
On Sat, 8 Feb 2014 15:32:23 -0800 Guido van Rossum <guido@python.org> wrote:
We could really use more help reviewing and finishing asyncio's docs!
Well, it's probably difficult for people to help when they are not acquainted with the details of asyncio's functioning :-) Regards Antoine.
On Sat, Feb 8, 2014 at 3:47 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
On Sat, 8 Feb 2014 15:32:23 -0800 Guido van Rossum <guido@python.org> wrote:
We could really use more help reviewing and finishing asyncio's docs!
Well, it's probably difficult for people to help when they are not acquainted with the details of asyncio's functioning :-)
Very funny. :-) But seriously: as a potential reviewer, you can try to write a simple asyncio app from scratch using the docs available, and report (preferably on the python-tulip list) any issues you encountered, whether they be English spelling or grammar (if those are your thing), confusing on incorrect documentation, missing or buggy examples, and so on. Plenty of people so far have contributed *code*, even without documentation (apart from PEP 3156), and it should be just as easy to contribute *docs*. -- --Guido van Rossum (python.org/~guido)
On 2014-02-08 23:32, Guido van Rossum wrote:
We could really use more help reviewing and finishing asyncio's docs!
Some spelling mistakes: http://docs.python.org/dev/library/asyncio.html mimicks http://docs.python.org/dev/library/asyncio-task.html returing nummber http://docs.python.org/dev/library/asyncio-protocol.html correspondong http://docs.python.org/dev/library/asyncio-stream.html Sublclass http://docs.python.org/dev/library/asyncio-subprocess.html subproces signale
---------- Forwarded message ---------- From: *Victor Stinner* <victor.stinner@gmail.com <mailto:victor.stinner@gmail.com>> Date: Sat, Feb 8, 2014 at 2:38 PM Subject: [python-tulip] Need help to finish asyncio documentation To: python-tulip <python-tulip@googlegroups.com <mailto:python-tulip@googlegroups.com>>
Hi,
I wrote most parts of the documentation of the asyncio module, but I'm not sure that anyone already read it yet. Can you please at least take at look? http://docs.python.org/dev/library/asyncio.html
Tell me if the documentation needs more examples. I don't want to add whole applications, only very short examples to explain one feature or concept, or show how to use one specific API.
I just realized that add/remove_reader/writer() methods of the event loop were not documented, sock_recv/sendall/accept/connect() methods neither. I documented them.
There are still many functions which only have "XXX" for documentation.
If you would like to contribute, send patches on .rst files. The source of the documentation is in the Doc/library/ directory of CPython repository: http://hg.python.org/cpython/
Files asyncio-*.rst: http://hg.python.org/cpython/file/default/Doc/library
Victor
-- --Guido van Rossum (python.org/~guido <http://python.org/~guido>)
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/python%40mrabarnett.plus....
No virus found in this message. Checked by AVG - www.avg.com <http://www.avg.com> Version: 2014.0.4259 / Virus Database: 3697/7075 - Release Date: 02/08/14
On Sat, Feb 8, 2014 at 6:00 PM, MRAB <python@mrabarnett.plus.com> wrote:
On 2014-02-08 23:32, Guido van Rossum wrote:
We could really use more help reviewing and finishing asyncio's docs!
Some spelling mistakes:
http://docs.python.org/dev/library/asyncio.html mimicks
http://docs.python.org/dev/library/asyncio-task.html returing nummber
http://docs.python.org/dev/library/asyncio-protocol.html correspondong
http://docs.python.org/dev/library/asyncio-stream.html Sublclass
http://docs.python.org/dev/library/asyncio-subprocess.html subproces signale
Fixed: http://hg.python.org/cpython/rev/3cfaeb788e00 - thanks!
In article <CAP7+vJKmBPYU_E+4TyC3X6oFC_ydmd9K9PXk8atoLL6oJ_8FeA@mail.gmail.com>, Guido van Rossum <guido@python.org> wrote:
We could really use more help reviewing and finishing asyncio's docs! ... http://docs.python.org/dev/library/asyncio.html
I think the documentation desperately needs an overview. I find it very confusing without one. I guess the links to PEPs are intended to be that, but it would be much more helpful to include the overview in the documentation. I think a bit of re-ordering of topics could also help: - One of the first things presented is a discussion of event loop policy, even though most users will never need to change the policy. Couldn't this go at the end? - It tells how to create and set event loops, with no hint as to why one would want to do that. Is it common to have multiple event loops? A related oddity: what is the point of BaseEventLoop.run_until_complete(future)? It sounds interesting but obscure (unless it applies to one of many event loops). In other words: if it was possible to show basic usage of event loops early, then discuss how to do the fancy stuff (new event loops, new even loop policies later) that might help. BaseEventLoop.stop() says: "Every callback scheduled before stop() is called will run." but it does not say WHEN it will run -- immediately due to the stop, or normally as if stop was never called? That said, I am very excited to have this functionality. I have been sticking with Python 2 for now, but this feature may entice me to make the switch. -- Russell
---------- Forwarded message ---------- From: Victor Stinner <victor.stinner@gmail.com> Date: Sat, Feb 8, 2014 at 2:38 PM Subject: [python-tulip] Need help to finish asyncio documentation To: python-tulip <python-tulip@googlegroups.com>
Hi,
I wrote most parts of the documentation of the asyncio module, but I'm not sure that anyone already read it yet. Can you please at least take at look? http://docs.python.org/dev/library/asyncio.html
Tell me if the documentation needs more examples. I don't want to add whole applications, only very short examples to explain one feature or concept, or show how to use one specific API.
I just realized that add/remove_reader/writer() methods of the event loop were not documented, sock_recv/sendall/accept/connect() methods neither. I documented them.
There are still many functions which only have "XXX" for documentation.
If you would like to contribute, send patches on .rst files. The source of the documentation is in the Doc/library/ directory of CPython repository: http://hg.python.org/cpython/
Files asyncio-*.rst: http://hg.python.org/cpython/file/default/Doc/library
Victor
On Mon, Feb 10, 2014 at 12:47 PM, Russell E. Owen <rowen@uw.edu> wrote:
In article <CAP7+vJKmBPYU_E+4TyC3X6oFC_ydmd9K9PXk8atoLL6oJ_8FeA@mail.gmail.com>, Guido van Rossum <guido@python.org> wrote:
We could really use more help reviewing and finishing asyncio's docs! ... http://docs.python.org/dev/library/asyncio.html
I think the documentation desperately needs an overview. I find it very confusing without one. I guess the links to PEPs are intended to be that, but it would be much more helpful to include the overview in the documentation.
Thanks very much -- this is the kind of thing that's hard to notice as the author (of either the code or the docs :-).
I think a bit of re-ordering of topics could also help: - One of the first things presented is a discussion of event loop policy, even though most users will never need to change the policy. Couldn't this go at the end?
Indeed.
- It tells how to create and set event loops, with no hint as to why one would want to do that. Is it common to have multiple event loops?
Shouldn't be that common (but more common than creating or even using the policy).
A related oddity: what is the point of BaseEventLoop.run_until_complete(future)? It sounds interesting but obscure (unless it applies to one of many event loops).
That's actually pretty common in a main() program. See several examples in the Tulip repo, e.g. http://code.google.com/p/tulip/source/browse/examples/crawl.py#851
In other words: if it was possible to show basic usage of event loops early, then discuss how to do the fancy stuff (new event loops, new even loop policies later) that might help.
BaseEventLoop.stop() says: "Every callback scheduled before stop() is called will run." but it does not say WHEN it will run -- immediately due to the stop, or normally as if stop was never called?
Yeah, this is confusing -- it only applies to callbacks scheduled with call_soon(), not for those scheduled with call_later() or call_at() (and for those scheduled with call_soon_threadsafe() all bets are off, of course). it may not even be such a good idea to make this promise (though it's also in PEP 3156) -- the promise constrains the behavior of stop(). The implementation is kind of cute though: call_soon() adds things to a FIFO and the event loop picks items to run off this FIFO -- and stop() just adds a sentinel item to the FIFO. The FIFO behavior implements the promise. Also notice that if a callback schedules a further callback using call_soon(), the latter will end up in the FIFO *after* the sentinel item, so it won't run. It's also important to understand that a stopped loop can always be resumed with no ill effects -- the sentinel having been popped off the FIFO, the loop will continue to run until it is stopped again. (But there's also a bit if an issue here if you stop it twice in a row -- the second stop() call will remain in the FIFO.) Finally, scheduling something with call_later(0, <cb>) is *not* the same as call_soon(<cb>). call_later() *always* creates a scheduler item which will require a separate "tick" of the loop before it gets moved to the above-mentioned FIFO (a.k.a. the ready queue). Perhaps the following is helpful (though it gives more implementation detail than we should probably put in the docs). The event loop repeats the following steps forever: 1. Wait for I/O ready with a deadline equal to the earliest scheduled item (zero if the ready queue is non-empty, infinity if nothing is scheduled) 2. Add I/O handlers that should be called to the ready queue 3. Move scheduled items that are now dueue to the ready queue 4. Run everything that is *currently* in the ready queue When the sentinel from stop() is found in the ready queue, the loop stops, leaving any remaining items in the ready queue. When the loop is restarted, we start from the top, with a deadline equal to zero. The other useful thing to understand is the data structures used by the event loop: - a ready queue (the aforementioned FIFO) - a heapq of scheduled items, sorted by the time they are due - a data structure to keep track of I/O callbacks (typically a selector, except when using IOCP on Windows) Much hand-wringing went into deciding what to do with callbacks put into the ready queue by call_soon() while step 4 above is running. The decision was *not* to run these immediately but to loop back to the top, using a deadline of zero for the I/O wait. This favors responding to I/O over running callbacks, but still runs the first "wave" of callbacks immediately without checking back for more I/O.
That said, I am very excited to have this functionality. I have been sticking with Python 2 for now, but this feature may entice me to make the switch.
That was part of the point. :-)
-- Russell
---------- Forwarded message ---------- From: Victor Stinner <victor.stinner@gmail.com> Date: Sat, Feb 8, 2014 at 2:38 PM Subject: [python-tulip] Need help to finish asyncio documentation To: python-tulip <python-tulip@googlegroups.com>
Hi,
I wrote most parts of the documentation of the asyncio module, but I'm not sure that anyone already read it yet. Can you please at least take at look? http://docs.python.org/dev/library/asyncio.html
Tell me if the documentation needs more examples. I don't want to add whole applications, only very short examples to explain one feature or concept, or show how to use one specific API.
I just realized that add/remove_reader/writer() methods of the event loop were not documented, sock_recv/sendall/accept/connect() methods neither. I documented them.
There are still many functions which only have "XXX" for documentation.
If you would like to contribute, send patches on .rst files. The source of the documentation is in the Doc/library/ directory of CPython repository: http://hg.python.org/cpython/
Files asyncio-*.rst: http://hg.python.org/cpython/file/default/Doc/library
Victor
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/guido%40python.org
-- --Guido van Rossum (python.org/~guido)
participants (6)
-
Antoine Pitrou
-
Brian Curtin
-
Guido van Rossum
-
MRAB
-
Russell E. Owen
-
Victor Stinner