Re: [python-tulip] Suggestions for topics in an asyncio 2-hour workshop targeting beginner/intermediate Python users?

2018-01-22 Thread Luciano Ramalho
dering the time constrains including a minimal explanation > or the possibility to include complimentary textual resources to be read > afterwards the workshop? > > As an example, I would focus in an application client, probably to web > context, but it is not a definitive optio

Re: [python-tulip] Discussion thread for: http://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/

2016-10-30 Thread Luciano Ramalho
7 we can add a Socket-like object with asynchronous “recv”, “send”, >>> etc coroutines. Turns out people want this, as it’s more convenient to use >>> than loop.sock_sendall. Using streams is of course better, but sometimes >>> you want to quickly make your existing program async without a full rewrite. >> >> I'd question *why* people want sockets. > > Just more familiar API I think. > >> Perhaps it's really just a >> wrapper around a StreamReader/Writer pair? Can a curio socket wrap a >> subprocess? A pipe? A tty device? > > Curio socket is a very thin wrapper on top of python socket and whatever > non-blocking stuff python allows to do. The API is essentially the same, > with all blocking methods made coroutines. > > I think people find Curio streams a bit more intuitive because they are just > one object, not a pair of reader/writer. > > Yury -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Technical Principal at ThoughtWorks | Twitter: @ramalhoorg

Re: [python-tulip] Re: Notes on writing a new official asyncio tutorial

2016-07-22 Thread Luciano Ramalho
very happy as separate library available on > PyPI (as well as aiohttp BTW). > > On Fri, Jul 22, 2016 at 4:22 PM Luciano Ramalho wrote: >> >> Thanks for starting this effort, a beginner friendly tutorial with >> broad coverage of AsyncIO is sorely needed. >> >

Re: [python-tulip] Re: Notes on writing a new official asyncio tutorial

2016-07-22 Thread Luciano Ramalho
we have some GitHub >> "experts" here? :-) >> >> My goal is to allow more people to push directly in asyncio-doc than >> in the asyncio code (where we prefer to have reviews using pull >> requests). So I prefer two distrinct teams (list of collaborators). >

Re: [python-tulip] Re: Notes on writing a new official asyncio tutorial

2016-07-22 Thread Luciano Ramalho
Eventually I the stdlib will have an async HTTP library, and then the relevant parts of the tutorial can be adapted and the tutorial incorporated to the official docs. Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/pr

Re: [python-tulip] Motor, the async MongoDB driver, now supports asyncio

2015-12-04 Thread Luciano Ramalho
lov, Nikolay Novik, and others, I've > added asyncio support to Motor: > > http://motor.readthedocs.org/en/stable/changelog.html > > It also supports Python 3.5's "async" and "await", still works with Python > 2.6 and 2.7, and it still works with Tornado. >

[python-tulip] Video: "Plate Spinning", a gentle introduction to asyncio

2015-09-08 Thread Luciano Ramalho
ter, but I am in a hurry now. Despite that Q&A mishap, I think the talk is a pretty good introduction to the way asyncio works. What do you think? Your feedback is most welcome! Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/

Re: [python-tulip] Handling a StreamReader data buffer when calling .read() with no arguments

2015-07-30 Thread Luciano Ramalho
20150730-18:42:07.013\x0110=130\x01 > > I can add some code examples if needed but I think I just need help with > understanding how to read() continuously since the documentation examples > are just reading > single lines or to the EOF. -- Luciano Ramalho | Author of Fluent Pytho

Re: [python-tulip] Is async object creation supported?

2015-05-16 Thread Luciano Ramalho
special methods would be required besides __new__ and __init__. Best, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg

Re: [python-tulip] Is async object creation supported?

2015-05-16 Thread Luciano Ramalho
_(): > yield from some async code > > class Y: > def __init__(): >some sync code > > def init(): > yield from some async code -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/063692

Re: [python-tulip] Tkinter + asyncio?

2015-05-08 Thread Luciano Ramalho
n my Mac (OSX Yosemite, Python 3.5 a couple days > older, Tcl/Tk 8.5). This is working for me on OSX 10.9 with both Python 3.4 and Python 3.5 using the tkinter and the asyncio packages from the Python the respective standard libraries. I hand-tested it again just now (sorry, there are no automated

Re: [python-tulip] Tkinter + asyncio?

2015-05-08 Thread Luciano Ramalho
what this is: > > https://bitbucket.org/ramalho/asyncio_staging/branches/compare/ramalho/asyncio_staging:default%0Dhaypo/asyncio_staging:default#chg-asyncio_tkinter/talksrc/tkevents.py > > though it looks promising. > > Thanks, > > Skip > -- Luciano Ramalho | Auth

[python-tulip] [announce] yield-from and asyncio coverage available in Fluent Python

2015-04-17 Thread Luciano Ramalho
heers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg

Re: [python-tulip] asyncio_tkinter doesn't work

2015-04-05 Thread Luciano Ramalho
On Sun, Apr 5, 2015 at 10:12 AM, Luciano Ramalho wrote: > Alan Cristhian (@AlanCristhian on Github) fixed the hang-on-exit bug > by turning the asyncio event loop thread into a daemon; see > guievents.py, method GuiEventLoop._start_io_event_loop. Ah, yes, my code is in this repo, a fork

Re: [python-tulip] asyncio_tkinter doesn't work

2015-04-05 Thread Luciano Ramalho
nous with coroutines. Thank you Guido and Alan for helping me with this, and Dino for the awesome talk and example! Victor: I made a pull request so you can merge this with the haypo/asyncio_staging repo on Bitbucket. Thanks! Best, Luciano On Sun, Jan 25, 2015 at 10:39 PM, Luciano Ramalho wrote

Re: [python-tulip] asyncio.async versus loop.create_task

2015-03-26 Thread Luciano Ramalho
age to that thread. I even wrote to you in private asking for a "permanent" URL for it, so I can link to it from my book. Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em:

Re: [python-tulip] asyncio.async versus loop.create_task

2015-03-26 Thread Luciano Ramalho
entLoop > subclasses to return a task that behaves better with some other framework > (e.g. Tornado). > > Also note that async() calls create_task(), but only when it decides to > create a new task. > > Maybe the docs need an upgrade, please submit a patch. > > On

Re: [python-tulip] Async iterators

2015-03-24 Thread Luciano Ramalho
needs to go to disk is blocking, and everything that is blocking must have a callback. Just look at the API for their fs module: https://nodejs.org/api/fs.html For convenience, some functions have a non-callback "synchronous" version. Those have a Sync suffix, e.g. fs.stat(path, c

[python-tulip] asyncio.async versus loop.create_task

2015-03-22 Thread Luciano Ramalho
efore asyncio.async is deprecated? The docs seem to imply ever-so-slightly that create_task is better and async should be used "to support also older Python versions". Cheers, Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/prod

Re: [python-tulip] Which is the canonical repo for the tulip/asyncio examples?

2015-03-18 Thread Luciano Ramalho
the AOSA500 book. Looking at aosa.org I could not find the chapter where asyncio is covered. I'd like to link to that too. I will link to the aosabook repo for the code. Cheers, Luciano > > On Wed, Mar 18, 2015 at 10:14 AM, Luciano Ramalho > wrote: >> >> I want to link

Re: [python-tulip] Which is the canonical repo for the tulip/asyncio examples?

2015-03-18 Thread Luciano Ramalho
/product/0636920032519.do >> [2] https://code.google.com/p/tulip/source/browse/examples/crawl.py >> >> Which "permantent" URL should I use? >> >> Thanks! >> >> Luciano >> >> -- >> Luciano Ramalho >> | Author of Fluent Pyth

[python-tulip] Which is the canonical repo for the tulip/asyncio examples?

2015-03-18 Thread Luciano Ramalho
ntent" URL should I use? Thanks! Luciano -- Luciano Ramalho | Author of Fluent Python (O'Reilly, 2015) | http://shop.oreilly.com/product/0636920032519.do | Professor em: http://python.pro.br | Twitter: @ramalhoorg

Re: [python-tulip] Which other futures my come out of asyncio.as_completed?

2015-03-03 Thread Luciano Ramalho
it's possible some day as_completed() may return either things-you-yield-from-to-get-a-Future or actual Futures, i.e. instances of asyncio.Future? Best, Luciano > > --Guido > > On Mon, Mar 2, 2015 at 1:48 AM, Victor Stinner > wrote: >> >> Hi, >> >> 2015-03-01 13:

Re: [python-tulip] Adding datagram-like protocol (zigbee) not over socket (serial port), design advice needed

2015-03-02 Thread Luciano Ramalho
now > with those new devices and, if they could find something that can help them > fast to implement servers, I think (but I'm no specialist) they could enjoy > discovering and using python. > > Thank you for your advices and example (and for those that contribute to > python, your hard work) > > Nicolas -- Luciano Ramalho Twitter: @ramalhoorg Professor em: http://python.pro.br Twitter: @pythonprobr

Re: [python-tulip] Which other futures my come out of asyncio.as_completed?

2015-03-01 Thread Luciano Ramalho
happens, the result/error of the new future will be the same as the original future. """ [1] https://docs.python.org/3/library/asyncio-task.html#asyncio.as_completed Best, Luciano > > On Fri, Feb 27, 2015 at 12:42 PM, Luciano Ramalho > wrote: >> >> Hello, in

Re: [python-tulip] Documenting file I/O in asyncio

2015-03-01 Thread Luciano Ramalho
run_in_executor and maybe separate processes (either > subprocess or a process pool executor)? > * for the examples: > * * an example of serving a small file (read into memory first) using the > default run_in_executor > * * an example of serving a large file using the default run_in_exec

Re: [python-tulip] Which other futures my come out of asyncio.as_completed?

2015-02-27 Thread Luciano Ramalho
> until a result is ready. Excellent, thank you for that! Best, Luciano > > On Fri, Feb 27, 2015 at 12:42 PM, Luciano Ramalho > wrote: >> >> Hello, in the docs for the asyncio.as_completed function [1] there's a >> note that says "The futures f are n

[python-tulip] Which other futures my come out of asyncio.as_completed?

2015-02-27 Thread Luciano Ramalho
y be yielded by as_completed? Thanks! -- Luciano Ramalho Twitter: @ramalhoorg Professor em: http://python.pro.br Twitter: @pythonprobr

Re: [python-tulip]

2015-02-17 Thread Luciano Ramalho
0 and 26,000 SQL INSERT queries per second >> depending on his setup and on the benchmark parameter. Ah yes, there >> are also options to tune the benchmark, but I don't think that you are >> supposed to use them. >> >> I'm trying to reproduce the benchmark to

Re: [python-tulip] Proposal: make coroutines stand out in the asyncio docs.

2015-02-12 Thread Luciano Ramalho
? The asyncio code often uses the inspect module to determine the kind of function, right? Best, Luciano > > -- > Ludovic Gasc > > On Thu, Feb 12, 2015 at 6:24 PM, Luciano Ramalho > wrote: >> >> On Thu, Feb 12, 2015 at 2:35 PM, Ben Darnell wrote: >> &g

Re: [python-tulip] Proposal: make coroutines stand out in the asyncio docs.

2015-02-12 Thread Luciano Ramalho
so it's not as easy > to add a new one (unless I'm missing something), but this seems like a good > addition for the next version of sphinx. You are right, Ben, the best solution seems to be a sphinx extension to generate markup like those classmethod tags. Cheers, Luciano -- L

Re: [python-tulip] Proposal: make coroutines stand out in the asyncio docs.

2015-02-12 Thread Luciano Ramalho
tor Stinner > wrote: >> Hi, >> >> 2015-02-12 12:51 GMT+01:00 Luciano Ramalho : >>> This is more visible than a sentence like "This method is a >>> coroutine." buried somewhere in its description. >> >> We should keep th

[python-tulip] Proposal: make coroutines stand out in the asyncio docs.

2015-02-12 Thread Luciano Ramalho
Let the write buffer of the underlying transport ... If some abbreviated notation like {{coroutine}} is adopted, the phrase "This method is a coroutine." should be kept in the description for clarity. What do you think? I am willing to file a bug and provide a patch if you think

Re: [python-tulip] How to add delay in aiohttp.web request processing

2015-01-29 Thread Luciano Ramalho
;> I need to test timeout option. >> How can I add some delay in aiohttp.web request handler? >> >> Here is my debug server, this is the line where web.Response object is >> returned: https://github.com/lorien/iob/blob/master/test/util/server.py#L26 > > > > --

Re: [python-tulip] Re: Call protocol.connection_lost() when the creation of transport failed?

2015-01-29 Thread Luciano Ramalho
ver is not aware of the connection failure. >> >> I would like to notify the server through the protocol (call >> connection_failed) that an incoming connection failed. Random use >> case: blacklist temporary the client IP. >> >> Victor > > > > > -- > --Guido van Rossum (python.org/~guido) -- Luciano Ramalho Twitter: @ramalhoorg Professor em: http://python.pro.br Twitter: @pythonprobr

Re: [python-tulip] asyncio_tkinter doesn't work

2015-01-25 Thread Luciano Ramalho
previous one: hangs on exit. Best, Luciano On Tue, Jan 20, 2015 at 7:29 PM, Luciano Ramalho wrote: > On Tue, Jan 20, 2015 at 2:38 AM, Guido van Rossum wrote: >> Thank you. I have not found the time to work on this further myself, so I'd >> like to hear how you fare! > > Hell

Re: [python-tulip] asyncio_tkinter doesn't work

2015-01-20 Thread Luciano Ramalho
On Tue, Jan 20, 2015 at 2:38 AM, Guido van Rossum wrote: > Thank you. I have not found the time to work on this further myself, so I'd > like to hear how you fare! Hello, I made the example work: the essential Count Words button works as advertised (as long as you have the holmes.txt file availab

Re: [python-tulip] asyncio_tkinter doesn't work

2015-01-19 Thread Luciano Ramalho
20, 2015 at 1:49 AM, Luciano Ramalho wrote: > Reviving an old thread... > > I just watched the video of Dino's talk at PyCon 2013 [1] and I am > interested in updating their example code to run with asyncio 3.4 instead of > tulip. I am writing to ask if anyone has done further

Re: [python-tulip] asyncio_tkinter doesn't work

2015-01-19 Thread Luciano Ramalho
Reviving an old thread... I just watched the video of Dino's talk at PyCon 2013 [1] and I am interested in updating their example code to run with asyncio 3.4 instead of tulip. I am writing to ask if anyone has done further work on this since may/2014 when Guido last wrote about it. [1] http:/

Re: [python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-19 Thread Luciano Ramalho
On Mon, Jan 19, 2015 at 12:02 PM, Victor Stinner wrote: > 2015-01-19 12:52 GMT+01:00 Luciano Ramalho : >> In a non-trivial program, how do I know mine was the first call to >> get_event_loop? > > It doesn't matter who called it first. You may even call close() more &

Re: [python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-19 Thread Luciano Ramalho
In my previous message the crucial word "NOT" was missing from this sentence: """ Even a trivial program running in iPython Notebook under Qt will get an event loop that already existed, and that it should NOT close. """ Sorry... Best, Luciano On Mon,

Re: [python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-19 Thread Luciano Ramalho
vent loop any more, delegating the decision to actually close() the loop to the same infrastructure level that makes the decision to create a new loop or give me an existing one when I call get_event_loop. What do you think? Best, -- Luciano Ramalho Twitter: @ramalhoorg Professor em: http://python.pro.br Twitter: @pythonprobr

[python-tulip] Re: Best practice for managing loop: don't close it (really!?)

2015-01-18 Thread Luciano Ramalho
Ok, that makes sense, thanks! On Sunday, January 18, 2015, Guido van Rossum wrote: > Yes. It's a bit like memory allocation -- if you don't own it, don't free > it. > > On Sun, Jan 18, 2015 at 3:41 PM, Luciano Ramalho > wrote: > >> Like Victor Stinner in

[python-tulip] Best practice for managing loop: don't close it (really!?)

2015-01-18 Thread Luciano Ramalho
ommendation? Cheers, Luciano -- Luciano Ramalho Twitter: @ramalhoorg Professor em: http://python.pro.br Twitter: @pythonprobr

Re: [python-tulip] Best way to read/write files with AsyncIO

2015-01-13 Thread Luciano Ramalho
Reviving the thread... if I understand correctly, there is no portable way to do disk I/O asynchronously (and the gist [1] provided by the OP is bogus: the read_data function will block the event loop). Is my understanding correct? [1] https://gist.github.com/kunev/f83146d407c81a2d64a6