Skip to content
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

Add a tutorial for AsyncIO in the documentation #71766

Closed
matrixise opened this issue Jul 20, 2016 · 7 comments
Closed

Add a tutorial for AsyncIO in the documentation #71766

matrixise opened this issue Jul 20, 2016 · 7 comments
Labels
docs Documentation in the Doc dir

Comments

@matrixise
Copy link
Member

BPO 27579
Nosy @terryjreedy, @vstinner, @asvetlov, @1st1, @matrixise

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2016-07-25.09:29:37.397>
created_at = <Date 2016-07-20.14:42:29.081>
labels = ['docs']
title = 'Add a tutorial for AsyncIO in the documentation'
updated_at = <Date 2016-07-26.01:43:21.957>
user = 'https://github.com/matrixise'

bugs.python.org fields:

activity = <Date 2016-07-26.01:43:21.957>
actor = 'terry.reedy'
assignee = 'docs@python'
closed = True
closed_date = <Date 2016-07-25.09:29:37.397>
closer = 'vstinner'
components = ['Documentation']
creation = <Date 2016-07-20.14:42:29.081>
creator = 'matrixise'
dependencies = []
files = []
hgrepos = []
issue_num = 27579
keywords = []
message_count = 7.0
messages = ['270876', '270878', '271043', '271121', '271244', '271245', '271317']
nosy_count = 7.0
nosy_names = ['terry.reedy', 'vstinner', 'asvetlov', 'docs@python', 'Ludovic.Gasc', 'yselivanov', 'matrixise']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue27579'
versions = ['Python 3.6']

@matrixise
Copy link
Member Author

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

@matrixise matrixise added the docs Documentation in the Doc dir label Jul 20, 2016
@1st1
Copy link
Member

1st1 commented Jul 20, 2016

I guess someone has to step forward -- i can propose an initial patch with the tutorial.

@vstinner
Copy link
Member

The tutorial is happening but outside Python:
https://github.com/asyncio-doc/asyncio-doc

I suggest to now close this issue.

@terryjreedy
Copy link
Member

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 bpo-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.

@LudovicGasc
Copy link
Mannequin

LudovicGasc mannequin commented Jul 25, 2016

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.

@vstinner
Copy link
Member

"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

@terryjreedy
Copy link
Member

Ludovic: Thank you for the offer. When I post a proposed text with code to bpo-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 bpo-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.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
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
Projects
None yet
Development

No branches or pull requests

4 participants