Python Bytes - #397 So many PyCon videos

Episode Date: August 20, 2024

Topics covered in this episode: pyawaitable Annotated area charts with plotnine DeltaDB PyCon US 2024 Recap + Videos are up Extras Joke See the full show notes for this episode on the website at... pythonbytes.fm/397

Transcript
Discussion (0)
Starting point is 00:00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 397, recorded August 20th. And I am Brian Ocken. And I am Michael Kennedy. This show, this episode is sponsored by us, so check out our stuff, our courses and training and everything. Links in the show notes, of course. You can connect with us on Mastodon or Frostodon. We're at mkennedy brian akina at python bytes but
Starting point is 00:00:26 you can find all of those in the show notes as well also you can go to pythonbytes.fm live if you want to join us in the studio audience um and uh finally um we have some exciting news about the handcrafted artisanal show notes in email form. Our email friends of the show list has reached a milestone and we've already sent out prizes, which is awesome. Yes. Check your mail. You may be a lucky winner. I know two folks have already redeemed some courses over at TalkPython and over on your platform, right? Yep. You may already be a wiener, so check your email. What do you got for us, Michael?
Starting point is 00:01:08 I've been waiting and waiting to talk about this. So let's talk about PyAwaitable. It was bad, but it had to be done. You know what I mean? So PyAwaitable, this is something I feel like probably not a ton of people are going to be using, but the concurrency models in Python are only increasing. The use of async and await is only increasing and people writing code, people
Starting point is 00:01:33 writing code in a B and rust and other languages to basically create lower, lower level, faster bits is increasing. And so I put this out there to help those of you who are saying, maybe I want to rewrite the section in C or integrate with this other bit of code in C. So this is a project called Py awaitable, which is really for people writing code in C, C extensions for Python. Okay. Okay.
Starting point is 00:02:01 And interestingly, it comes from Peter. Uh, last name is Birma, Peter Birma. And if you check out his website, it's pretty interesting, actually. Hey, I'm Peter, software engineer from the United States. I'm 16 years old. Oh, I've been writing. I've been coding since I was nine. And this is just one of my many projects. So there's a bunch of projects. You can see that like the pointers out pie joke that was going around a while ago. He did that and stuff anyway. So that's kind of interesting and impressive. And so this is a library that lets you create code in C that can accept an async Python function. So if you write async def in Python, right. And create some function that uses async and await and you pass it off to the c layer well that used to be kind of tricky this used to be this was suggested as a pep if you check it out i don't know if it got far enough to have a number but there's like the whole pep write up of what is the value of this? Why does it exist? How do you use it? How should it be added? And from what I gather, what I understand is that since this thing only uses the public
Starting point is 00:03:12 ABI, the public interface of the C API, it doesn't necessarily have to be part of CPython. It could just be a third party library. So here it is. And here's how it goes, Brian. This will connect with you, I think. Hash include PyAwaitable.h. Here we go. Here's a function that takes a Python coroutine function or an async def type of function, uses this library to create something that can be awaited on it, and then it returns it. So then that basically turns the C function into an async, something that can be awaited from Python. Okay, so the C function is the thing
Starting point is 00:03:52 that you're waiting for completion of? Yes. So here's a C extension written with this library that itself is effectively an async def function that you just await as if it was a native python one in event loop and all that kind of stuff and it can uh coordinate with other async things like your own ones or the built-in you know async.io.sleep or whatever that's pretty cool yeah pretty cool so i it's i'm pretty short and sweet and pretty focused so i'm not gonna say much more about it
Starting point is 00:04:21 but check it out it's pretty new but you know it seems not super advanced in terms of what it does. So if you're doing a lot of C and async programming, you can check it out and see what you think of it and use it and contribute. Nice. All right. Well, I want to show you something pretty. So look at this plot. This is amazing. So this is just a coal production since amazing. So this, this, um, it's just a, a coal production since 1900.
Starting point is 00:04:46 So, uh, why am I showing this? Cause it looks like it came out of a magazine or something. You've got like these call outs with, um, uh, it's, it's a, it's a stacked plot, but it's got like the colors are all, um, instead of doing a, like a key, there's, um, they're, they're listed as colored names in in one of the descriptions this is great so anyway i like this plot i want to do something like this and luckily there's an article called annotated area charts with plotline plotline is an open source python library uh and uh and this is just a good walks there's a tutorial that walks you through doing this, this wonderful,
Starting point is 00:05:25 very professional looking plot. And, and it's not something doesn't even look that complicated. Anyway, so going through this looks looks pretty fun to to try to do some some fancy plots like this may maybe make make my job may make me look more professional in my job, you know? So it uses plotline, which I hadn't heard of. And plotline is based on ggplot2. And it says plotline is an implementation of a grammar of graphics. I did not know that gg and ggplot was grammar of graphics. That's cool. I learned that today.
Starting point is 00:06:07 So that's cool. Anyway, I anyway i'm like well wait a second is this open source yeah it's all it's all on um on github so and mit licensed so i feel safe with just talking about licenses a lot lately and it and i am paying more attention to the licenses that i use so uh anyway, just a fairly quick shout out to this wonderful, Oh, who wrote it? It was Nicola Rennie and great looking blog too. But anyway, just how to make really beautiful plots with plotline. That's a nice looking blog and very nice looking presentation. So plotline is new to me. So good to know. Right on to the next one, we have DeltaBase. So Brian, I'm sure you've heard of SQLite, the embedded database that you can just point at a file and run. So DeltaBase is kind of like that, but broader, I guess. It's a lightweight,
Starting point is 00:07:00 comprehensive solution for managing Delta tables built on Polar's and Delta Lake. All right. So some, some definitions for this makes sense. So Polar's is a data frame framework, very much like pandas. I actually had a guy who created on talk Python quite a while ago when it came out. And the idea is one, it's super fast, but two, the way that you work with it is a so-called fluent API. Scrolling for an example, not finding one. A fluent API that has deferred execution. So when you work with Panda, you might say, do this filter and then transform this and
Starting point is 00:07:37 then multiply that thing by something. It just does every one of those steps and then processes it together with pollers. It says, okay, I see what you're doing. And first you told me to multiply and then you told me to filter, but if I filter and then multiply, I'll be multiplying way fewer things potentially. Right. So, uh, that's kind of the big difference anyway, super cool built on rust. So obviously it's got some pizazz behind it, but so are you saying that you can,
Starting point is 00:08:03 you can write it in a fluent way that makes sense to you, but it'll rearrange it if it makes sense to behind it. Wait, so are you saying that you can write it in a fluent way that makes sense to you, but it'll rearrange it if it makes sense to pull it? Yeah, it has like a query optimizer type of deal. It's not quite a query because you're not writing a query, but it has a deferred execution and it takes into consideration, if I remember this correctly, it takes into account all the different steps
Starting point is 00:08:21 because it doesn't actually execute until you give it like the command. And so it's built up all these steps that it can do and so it can make decisions about that oh that's cool okay yeah which is really cool but in other ways it's very similar to pandas not trying to be a copy of it but that's you know it's kind of plays the same space all right so that's one thing the other is delta lake this is an implementation of Delta Lake, I guess. And what would you with a space rather than with a space without a space? Oh, that clears it up. Totally. Oh, yeah. So absolutely. So this is a format actually that allows you to talk with computational engines
Starting point is 00:09:01 such as Spark, Hive, Snowflake, but also things like duck DB and others. And you can just point it at a local file. You don't even have to have a server. Okay. So this is a pretty cool looking library that lets you basically, you know, it's optimized for doing upserts and all sorts of things like that. Efficient versioning and and so on so you just pointed out some path if you want sort of the sqlite experience and then you say here's a table it has a primary key with this name and here is a bunch of data i want you to put into it and notice that there is no here's my sql create statement and my table schema and all of those things, right? Like where is that? Doesn't exist, does it?
Starting point is 00:09:47 So you just say, I'm going to commit this thing. Also, if you go, you can do select statements against it, right? SQL statements against it. You go and look at the docs, which I did. Here we go. Which are a bit of a work in progress here.
Starting point is 00:10:03 However, if you go and check out the docs, it shows you, for example, under connecting, that you can connect to just a path, but you could also connect to an S3 bucket. You can connect to some kind of Azure data lake container or Google Cloud Storage, or as you saw, BigQuery. So this is pretty interesting, right? Just change your connection string, and you get these different data tables neat data lakes rather yeah so that's what
Starting point is 00:10:30 i have for people if uh they're doing this kind of stuff you know this is uh something kind of a wrapper around those things also not super popular but i don't know this week i kind of felt like shining a light on things that were new and and maybe catch on with folks. Yeah. It looks fun. Yes. Also fun videos, I think. So I wanted to highlight a blog post on the PyCon blog at Blogspot, which still just cracks me up. But anyway, it's PyCon US 2024 recap and recording release, which I was confused by.
Starting point is 00:11:07 I would have thought a recording release was something you had to sign to make sure that your video was releasable. But no, we just wanted to say that the videos from PyCon are out. And I'll take a look at those in a second. One of the highlights that they noticed was that there were a lot of a lot of
Starting point is 00:11:26 people showing up. There was a total attendance of 2991. That's 2551 in person and 440 online. So that's pretty cool. Was just curious. I wouldn't lookedael reminded me that if you go to look at pycon on wikipedia it has a list of a list of years of attendees 2003 there were 200 people uh in washington dc it's awesome um it was like in a hotel or something yeah and then uh i was i started going in portland and we were at over 3,000 in Portland. And then Cleveland was over 3,000 as well. And then the pandemic hit and it went down quite a ways. But we're back to better numbers.
Starting point is 00:12:17 2022 was 1,700. 2023 now is over, was 2,100. And now we're up to 2,500-ish uh in person let's say it's going better um i think i'm not i if i'd be totally up for going possibly next year but i'm totally gonna hit long beach in 2026 that sounds great um oh yeah i'm definitely going to long beach yeah bring on some socal let's do it okay so they're they also announced in this announcement that there's uh where is it somewhere in there it has a link to the to the youtube thing so you can find the link there but you can also see it in our show notes so if you go to pike on us at youtube um all the videos are now up and my favorite way to get them is to just hop over to the playlist
Starting point is 00:13:00 you can go to the there's a 2024 thing but underneath it you can see the full playlist and i like that one because i can see all of the names uh of the of the videos so you don't just hit play on the playlist and just binge no no way um but um so if you if you just hit the playlist though if you start it you can pause it but then all the little all the the playlist, though, if you start it, you can pause it. But then all the little, all the playlists is over on the side, but you can't see the titles. Yeah, yeah, yeah. I agree with you the same way as, I do the same way. Anyway, I've already got queued up. And you can search easier with this way as well.
Starting point is 00:13:40 Oh, go away. And so I already queued up. I'll search for test stuff, of course. And I've got queued up PyTest for unit testers by Paul Gansel. And then this one looks pretty good. Testing data pipelines with Amotish Swain. Yeah, that does look cool.
Starting point is 00:13:56 Anyway, lots of stuff to check out. Awesome. Awesome. I think that's all we got for that. That's all we got. Those are all of our main items. Yeah. Got any extras? I do. I have, I have multiple, I have a couple of things I want to talk about actually. One, I just impromptu added here. So I've been, one of the things, one of the things I've been working on, Brian, is trying to do like a little bit less being not distracted by my phone, but just pulled in by my phone and other digital
Starting point is 00:14:27 things. Right. You go, you're like, oh, I got a notification for a text from someone or my music stopped. Why the heck did it stop? Crappy AirPods. I got to go back and like, find it and make it go again. Cause I paused it for three minutes. So it must've killed the app. Like that makes sense. You know what supercomputer in your pocket. Um, so you go and open it up and you're like, oh wait, that has a little dot or that has a little like badge of three on red, what is that? And then you start scrolling and then you're over there and then, you know, it just, there's just this like pressure or this, this sort of gravity. Of, of that thing being around.
Starting point is 00:14:59 So I am taking an attempt and I would love to hear your thoughts on this. I'm making an attempt to make my home screen feel less, less like a black hole that sucks me in and more like a, I've come here for a purpose. Let me do the thing and then go on. I would, I looked at maybe getting an Android phone, like a really option to have like a real dumb interface, like the nothing phone would be really cool or something like that.
Starting point is 00:15:23 But with my Apple watch and all my other things, i should just throw that thing in the trash if i switch to android which is really unfortunate but i'm like all right well stick with my iphone so i'm i started using this thing called dumb phone have you heard of this no so what it does is it uses some weird tricks to take over your home screen on iPhone. And it just has a really, really simple display. Like the phone, instead of being an icon is just the word phone, your messages, instead of being the green thing with the, like the three in red is just the word messages and so on. Okay. And so for example, here's a, I'll link to it, a screenshot of my iPhone 13 mini. It just says web bone messages, maps, weather,
Starting point is 00:16:05 and photos on a gray white text on a gray background. And you can swipe it over. Like the next one I think is videos, podcast news, something like that. You know, and the ones like productivity, like mail and calendar. Okay. If you still want, you still wrote where you're at Mac, you can, you can pull down and you can search or you can even keep swiping until you get past this. Anyway, this, I'm trying this and people, if they want to try to go down this path so far, I'm liking it. I've been messing with my phone. It's been effective.
Starting point is 00:16:33 I've been like stuck in my phone less. I'm not a person like, oh, I can't have my phone with me. You know what? I have it with me all the time, but when I go and like check my messages, I don't end up somewhere else as often. Let's say. So I did, I just like took, I've just got a handful of things like those sorts of things on my home screen, but I just have a few on my, on the first screen and everything else
Starting point is 00:16:54 is on some other page. Yeah, that makes sense. So that I can just see my, and then I have a background picture of my lovely wife there so I can see. Oh yeah. I did have to give it my background. I guess I could put a background, but it wouldn't look right because the way this thing works so also i took off all of the badges um the the the only thing that i the only thing that gets a little number that i still left
Starting point is 00:17:16 was um the phone messages because i i actually don't check that very much so i'd like to see if there's a message um not not actual oh yeah actual messages and you know phone like somebody left a voicemail um like who does that anymore anyway but but at the same time i don't answer my phone so um if if i don't recognize it so the doctor might yeah leave it messages anyway yeah exactly but i'll be curious to see how long you can deal with that um you could also just get a cheap phone but you know maybe you could but that's hard to do now it's super well it's like okay well i also want to have you know a nice gps if i'm somewhere and i want to have carplay in my car because i
Starting point is 00:17:56 have like a big display that's like a beautiful screen while i'm driving and yeah it's like and occasionally you're stuck somewhere and you want to read something or whatever. Yeah, yeah, yeah. I'm not trying to not. I'm just trying to like when I open and I look at it, I don't want it to be a black hole. And right now, oddly, it's like a very dark gray, not black. It's a gray hole. It's a gray hole.
Starting point is 00:18:16 That has no interest to me. Okay. I will see. I'll report back. I'll report back. Either I give up or I do that. And then one more thing. We're coming up on the last time for the Code in a Castle.
Starting point is 00:18:36 So if you want to come to Italy with me and talk about Python and databases and APIs and all sorts of fun stuff, got a couple weeks to sign up. So codeinacastle.com and hope to see you there. Nice. Cool. Um, the extra I've got is I want to say, Hey, I finally got the, uh, the new course done. So hello, pie test is available. It's I gotta figure out how to take this away. It says 16 lessons, but it's not, it's 12 lessons. Uh, some of the, some of the things it's like counting the intro and the, uh, the source code as lessons those aren't really lessons anyway um so uh 16 lessons under 90 minutes i think uh slightly under 90 minutes um including the intro and outro so
Starting point is 00:19:13 there are only a few minutes of video there but um but uh check it out uh you can you can have full full uh the full content table of contents is there at um courses.pythontest.com and yeah loved it loved to hear what people think and i'm gonna just stick it with stem bucks for a while i've had a lot of great feedback that said that's about that's a cool price point so i'm gonna leave it yeah awesome anyway and congratulations that's a big deal thanks and i'm kind of uh if we're we talked about this a little bit i used a camtasia to record this um and i'm gonna i think i'm gonna try to try working with uh obs studio a little bit yeah you definitely should um uh there's there's some stuff i love about camtasia though that
Starting point is 00:19:59 obs doesn't seem like it does um but let's let's talk after yeah let's talk after there's some really neat stuff i know you have a little mini stream deck as well and that's really awesome for like swapping up the views while you're doing recording and stuff so yeah cool well do you have anything funny for us i will let you be the judge i have philosophy for us okay so previously we've talked about the tower programming and i want to come back to the Tao of programming and this is like a parody Ancient philosophy sort of Eastern philosophy sort of thing here. So this one is
Starting point is 00:20:33 4.3 from the Tao Okay Okay A master was explaining the nature of Tao to one of his novices the Tao is embodied in all software regardless of how Insignificant said the master is the Tao in a handheld calculator, asked the novice. It is, came the reply. Is the Tao in a video game, continued the novice. It is even in a video game, said the master.
Starting point is 00:20:55 Is the Tao in the DOS or a personal computer? The master coughed and shifted position slightly. The lesson is over for today, he said. Yeah. Pretty good. Yeah good yeah yeah that's good and you can be okay with uh like joking about dos because it doesn't even exist anymore exactly exactly it's not gonna hurt anybody nobody's except for those three people who are still on their 386 and won't give it up. Word perfect is perfect for me. I love it. Come on.
Starting point is 00:21:28 I remember getting my 386. I'm like, gosh, I don't think I'll need another computer for a really long time. I know. I got a 486. DX 33, not the SX25, Megards. The DX 33, and it had a turbo button, and it was amazing. A turbo button. Like, why would you turn it off?
Starting point is 00:21:46 Because if you wanted to play the games written for the two 86, they went really fast and you couldn't play them at all. It was out of control. So if you hit, if you disabled turbo, it was more of a slow it down button, but they didn't want to call it that. So you could play the ones that just use the frame rate instead of real time or frame like mech warrior and stuff, I think was out of control. It was like those old record players that you that you had uh that speed controls on them like yes exactly for the small
Starting point is 00:22:09 ones of the big ones yeah 45s and whatever nice okay well uh thanks again for a wonderful python bytes and uh we'll see everybody next week see you later thanks everyone

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.