Async Techniques and Examples in Python Transcripts
Chapter: Built on asyncio
Lecture: Introducing unsync

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Unsync is the first library that we're going to look at that adds additional behaviors unification, or simplification to async and await in Python.
0:09 Unsync is created by Alex Sherman and on the project page, it talks about why he created it and what he's tryna do.
0:17 And I highlighted a lot of those already. So, he talks about how it's inspired by C#'s implementation of async and await
0:24 using the task parallel library which actually is much nicer than Python's. Lot of stuff about Python is nicer than C#.
0:30 C#'s async and await is actually better. So, the way that we're going to use Unsync is we're going to just use a decorator
0:37 on top of a standard async method. Then we can work with it using simplified techniques that Unsync makes available for us.
0:44 So, for example we can do fire and forget or we can do blocking calls that unify thing between asyncio future and concurrent future.
0:53 Things like that. So, really, really nice. And they also introduce this concept of a different type of future for that unification called an unfuture.
1:02 We're going to look at this through demos mostly. I'm not going to go anymore through their page or their documentation stuff
1:08 but I do want to show you one thing. So, let's go over to their GitHub page. GitHub project. Two take aways here.
1:14 One, great it's on GitHub so you can work with it and it's also on PyPI so you can pip install it.
1:20 However, there's not that much traction around it right now. There's only 41 stars at the time in this recording anyway.
1:26 In general if you have a project that doesn't have that much attention that is not that popular it's probably a warning sign.
1:34 You'll probably say, mmm, nice but I'm not ready. You know, get back to me when it has 500 or 1000 stars. I sort of have that feeling as well and
1:41 I'm not sure how much I would depend on Unsync. But, think I would. Depends what I'm building but I'm pretty sure I would and here's why.
1:48 If you actually did look at what Unsync is. If you go, here's the entire implementation of it. It is only a 126 lines long.
1:57 It's only doing a tiny bit of work but what you'll see is that slight reframing of the API in this 126 lines of Python makes it much nicer.
2:08 I mean, it's just delightful. So, to me I would just say maybe make sure you fork this and just so you have it just in case
2:15 but I think it's worth it. I'll show you the API. You can decide but it really is pretty special.


Talk Python's Mastodon Michael Kennedy's Mastodon