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