[issue27579] Add a tutorial for AsyncIO in the documentation
New submission from Stéphane Wirtel: The documentation of AsyncIO is well written for a developer, but it's a reference. We have the description of all the methods, classes, etc... But we want to learn to develop with AsyncIO, it's difficult, because there is no many examples in this reference and we have to look for some examples on Internet. Could we add a AsyncIO tutorial|cookbook|howto ? because we have a "Logging Cookbook" but not a "AsyncIO 101". Thank you Stephane ---------- assignee: docs@python components: Documentation messages: 270876 nosy: asvetlov, docs@python, haypo, matrixise, yselivanov priority: normal severity: normal status: open title: Add a tutorial for AsyncIO in the documentation versions: Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
Yury Selivanov added the comment: I guess someone has to step forward -- i can propose an initial patch with the tutorial. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
Changes by Ludovic Gasc <gmludo@gmail.com>: ---------- nosy: +Ludovic.Gasc _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
Changes by Terry J. Reedy <tjreedy@udel.edu>: ---------- nosy: +terry.reedy _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
STINNER Victor added the comment: The tutorial is happening but outside Python: https://github.com/asyncio-doc/asyncio-doc I suggest to now close this issue. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
Terry J. Reedy added the comment: I would like the tutorial to include something like the following. Adding Tkinter GUI to Asyncio Program ------------------------------------- Assuming that the tkinter Tk instance is called 'root' and the asyncio loop is called 'loop', add the following callback loop. def tk_update(): root.update() loop.call_soon(tk_update) Before each loop.run_forever() or loop.run_until_complete(...) call, add tk_update() Do not call root.mainloop() or root.quit(). Loop.stop() or completion of run_until_complete will stop the tk_update loop. --- This is the result of my experiments in #27546. One of my tests was running IDLE with an asyncio loop augmented with the above replacing root.mainloop. I don't yet know how to work with git and github. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
Ludovic Gasc added the comment: Hi Terry,
I don't yet know how to work with git and github.
I don't yet know how to work with tkinter and TK. I propose to combine our respective knowledge to improve the documentation together. If you give an all in one python file example with tkinter, I'll add that in the documentation via git and Github. Thanks for your help. Have a nice day. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
STINNER Victor added the comment: "I would like the tutorial to include something like the following: Adding Tkinter GUI to Asyncio Program" Please open an issue in the asyncio-doc project: https://github.com/asyncio-doc/asyncio-doc There is now a small community working on this documentation project, so I don't think that it's worth to keep this issue open. But today, Tkinter is not really fully integrated with asyncio. So I'm not sure that it's only a matter of *documentation*, it's more a matter of code that should be written and/or completed no? Or maybe open a thread on the new async-sig mailing list? http://asyncio.readthedocs.io/en/latest/getting_help.html ---------- resolution: -> fixed status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
Terry J. Reedy added the comment: Ludovic: Thank you for the offer. When I post a proposed text with code to #27546, I will nosy you if you have not already done so by then. Viktor: 'full integration' by adding a tk update in the standard _run_once is not possible as tkinter is not always present. I started #27546 by creating a custom subclass, but that requires dealing with the Selector and Proactor subclasses and default loop policy and still will not work with independent implementations. I considered a tk-loop implementation, but speed tests do not make that very inviting. The simple code I then tried is my current best recommendation. It will work with any asyncio compatible implementation. Besides the test with IDLE, Guido tested it with Examples/crawl.py, and I will improve on that. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue27579> _______________________________________
participants (5)
-
Ludovic Gasc -
STINNER Victor -
Stéphane Wirtel -
Terry J. Reedy -
Yury Selivanov