Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


Transcript #283: The sports episode

Return to episode page view on github
Recorded on Tuesday, May 10, 2022.

00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:04 This is episode 283, recorded May 10th, and I am Brian Okken.

00:09 I'm Michael Kennedy.

00:10 And I am Tanya Sims.

00:12 Well, welcome, Tanya. Since we're just meeting also, and some of our people might not know who you are, tell us a little bit about yourself.

00:18 Sure. Well, thank you so much for having me today. I'm very excited to be here.

00:22 So my name is Tanya, and I'm currently a Python developer advocate at a company called DeepGram.

00:28 And so at DeepGram, we do speech-to-text speech recognition technology.

00:33 I would say that my path to technology is a little bit unconventional.

00:36 I come from like an athletics background.

00:38 I started playing basketball when I was five years old.

00:41 I won't tell you how old I am now, but I'm fine.

00:44 So yeah, so I played basketball in college.

00:47 I played professionally in Europe and a little bit in the WNBA.

00:50 And then I got into sales.

00:52 And then from sales, I got into tech.

00:54 So yes, it's been very unconventional.

00:56 That's pretty awesome.

00:57 I wish we could jump in deeper, but yeah.

01:00 Yeah, that is super awesome.

01:01 And as you're telling us that, I'm listening.

01:04 And you think about all the stats and statistics and graphs and visualizations and optimizations of sports, right?

01:11 Like these Python and programming skills are actually pretty relevant.

01:15 Although maybe you were just deep down in the sports side and then got into programming afterwards.

01:20 Yeah.

01:20 So yeah, I think you're totally right.

01:22 I think Python is like the perfect language for doing a lot of stuff with like stats, like sports, statistics, and things like that.

01:28 And like the visualization of it.

01:30 But yeah, I started getting into coding when I was a kid, actually.

01:34 But then I stopped for a long time because, you know, who would have thought this thing called coding or computers would have taken off and be where it is today?

01:42 Yeah, absolutely.

01:43 Yeah.

01:43 Fascinating as that is.

01:45 Let's take a different path, Michael.

01:47 Yes, a different path and indeed a fine transition there, Brian.

01:50 So this one was sent over, recommended to us by one of our listeners, Spencer.

01:55 So thank you, Spencer, for sending this in.

01:57 And we talked about things like FSSpec and other ways in which you could sort of abstract away.

02:03 Just like I'm talking to a file, but oh, hey, that happens to live on Azure Blob Storage or AWS or Google Cloud Storage or something like that.

02:11 So this one is called Pathy, a path interface for local and cloud bucket storage.

02:17 So if you've got data that's stored in, at the moment, AWS or Google Cloud Storage and that AWS one, that's S3.

02:25 So I suspect that means like Linode and any other S3 compatible storage.

02:32 You know, there's many of these places that have object storage for their cloud services that are basically wrapping up the AWS story.

02:39 So this might be much broader than actually just those two clouds.

02:42 Anyway, the idea is that this is a Python package with type annotations, they like to call out, which is great, for working with cloud bucket storage using Pathlib.

02:52 So Pathlib is great, right?

02:53 We can create Pathlib and give it a path and it has things like make directory or the parent of the parent of this thing or does it exist and so on.

03:03 So if you like working with path, the path class from Pathlib, how about turning that loose against cloud storage?

03:10 That's cool, huh?

03:11 Very.

03:11 Yeah.

03:12 Yeah, it's very awesome.

03:13 Yeah.

03:13 Yeah.

03:13 So what's nice about it is you basically give it a URL with some type of scheme, you know, traditional schemes are like HTTP, HTTPS, but like GS for Google Cloud Storage or something in here that I'm not seeing for Azure.

03:28 Not Azure, AWS.

03:30 But you give it just the prefix or you just give it a local file path and it will determine which that is and just start talking to that platform, which I think is actually pretty neat here.

03:40 So, yeah, if basically if you want to work with cloud storage using Pathlib, well, then here you go.

03:47 It also supports caching locally, which is neat because that's one way in which you could get all of your cloud files sort of downloaded and replicated locally as well.

03:58 And then Spencer had a quick comment saying the really cool function is fluid.

04:02 So down here with fluid, you can take any type of local Google Cloud Storage or S3 path string and it'll just give you a path object that lets you interact with it agnostic of the platform.

04:14 So basically, like I was saying, you say S3 colon or GS colon or just a local path and it'll just give you back a Pathlib and you don't care where it is.

04:23 Is it in the cloud?

04:23 Is it local?

04:24 Who cares?

04:24 Because it's just, you know, it's abstracted that way using Pathlib.

04:28 And I don't know about YouTube, but I had been a bit of a holdout on Pathlib.

04:33 It was all import, you know, system.io or import.io, whatever it was, and just use the IO way working with it.

04:41 But I've really come to like Path and Pathlib last year or two.

04:45 Yeah, I really, I love the interface.

04:47 Just it feels, it's easier to program in to me.

04:51 It just feels easier.

04:52 It feels more obvious.

04:53 So.

04:54 Yeah.

04:55 Yeah, this is great.

04:56 I've been wanting to do more with cloud technologies.

04:59 So yeah, I think this would be a really good place to start.

05:01 Yeah.

05:02 And so much of that possibility is just working with static files on S3 or static files in blob storage and other places.

05:09 Sure.

05:10 I'd love to not have to care about that.

05:12 So.

05:13 Yes, if I could just not do Boto3, that would be fantastic because that thing drives me crazy so much.

05:20 Don't give me another rant.

05:21 Brian, talk about your topic.

05:23 Save me from ranting about Boto3.

05:24 Okay.

05:25 Well, let's talk about Robin.

05:27 So Robin, for one, has just an awesome logo.

05:30 It's a bird being hugged by a snake.

05:31 I love it.

05:32 Yeah.

05:32 That's pretty clever.

05:34 So what is Robin?

05:35 Robin is an async web server in runtime written in Rust.

05:43 And so that's pretty cool.

05:45 And actually, it's kind of been taking off in popularity and stuff.

05:48 But the so there's we're going to link to a bunch of stuff.

05:51 One of them is the Hello Robin blog post written by the author.

05:56 And so Robin is a fast, high performance Python web framework with Rust runtime.

06:02 So what does that mean?

06:03 It means that it's kind of like Flask.

06:06 It looks a lot like in one of the examples, it looks a lot like just a little Flask thing.

06:13 You can do app gets and app puts and different things.

06:16 It's decorators.

06:17 It's very new.

06:18 There's not there's a lot of work to be done.

06:20 So there's not a lot of ecosystem around it yet.

06:24 But it's pretty cool.

06:27 And I just kind of like this idea of like, well, let's let's make your code.

06:30 The code you write look like Python.

06:32 It is Python.

06:34 But the the back end stuff.

06:36 Well, maybe you don't care what that's running on.

06:38 And maybe Rust is fine.

06:41 So one of the things that doesn't have an ASCII or or ASGI or WSGI underlying because that's

06:48 a Python thing.

06:48 It is a sync.

06:50 It's very Flask like and the numbers kind of look impressive.

06:54 So and I know that benchmarks, you have to like read those with a grain of salt.

06:58 But still, requests per second, getting.

07:03 So we've got this document showing, Flask with G unicorn at 1800 requests per second.

07:11 But, Robin going at 6400 requests per second.

07:15 And this is, this is kind of insane.

07:17 So definitely worth checking out and trying.

07:20 I think I, or maybe not trying, but just watching to see what this does though.

07:24 Since it's very new though, one of the things I have to say is there's, there needs to

07:29 be some, it's not really newbie friendly then I guess, because there's not a lot

07:34 of docs yet.

07:35 There is a, there is a doc site started, but, but there's a lot of work to do, but still

07:40 getting started with it.

07:41 if you, if you have a really fast thing, it's pretty good.

07:44 So, oh, yeah, go ahead.

07:47 Yeah.

07:48 Well, a couple of notable things that stand out to me.

07:50 One, it supports async and await and it supports multi-threading at the rust layer.

07:56 So combine those two things and you might end up in a really interesting situation, which

08:01 is probably where it's getting a lot of its, its high numbers in that benchmark from.

08:05 Yeah.

08:05 So that's great.

08:06 It looks really simple.

08:07 You know, it's very Flask or FastAPI like, so that's cool.

08:12 One thing that's notably missing that I haven't seen is like, how do I render?

08:17 I'm going to transfer an HTML page from it.

08:19 It shows how to serve static files, which can be an HTML page, but I'm thinking, you know,

08:23 Jinja templates, Chameleon templates, equivalent of Django templates.

08:27 Like, like that's sort of the missing bit of a dynamic interactive website.

08:31 Yeah.

08:32 That also has an API.

08:33 You could, you could just import Jinja and configure it yourself or import Chameleon and configure

08:39 itself.

08:39 And I've done that in some of my like, decorator API or a wrapper things for adding

08:45 that onto API calls.

08:46 But you know, that's just a layer of a thing you've got to learn to use it instead of just

08:51 saying, here's a template or render this template or, or whatever.

08:54 Right.

08:54 So, I would love to see some sort of template support come built in.

08:58 Yeah.

08:59 And I, and I think that's something that definitely could be put in place.

09:03 and then there's.

09:03 Sure.

09:04 No, it's actually not very hard at all.

09:05 It's just, it just doesn't, I just didn't say that's all.

09:08 so target market, maybe just APIs.

09:12 yeah, it's got a lot of examples of, of, JSON type of exchange, right?

09:18 Yeah.

09:19 Anya, what do you think?

09:19 yeah, I was going to ask, what does that come with?

09:21 Like when you pip install it, what other packages does that come with it?

09:25 It doesn't, does it indicate?

09:26 I'm just curious.

09:27 Well, it's, we could look, I don't think there's much else there.

09:32 we've got the, uh.

09:34 There's very little here.

09:35 Okay.

09:36 Yeah.

09:37 yeah.

09:39 If you look at, Brian, open up the, just the requirements.txt file there.

09:43 and you'll get, see it's like, I was the last file there.

09:48 Okay.

09:49 Like, like that's the, that's the super small list.

09:51 Oh, wow.

09:52 Okay.

09:52 Yeah.

09:53 I mean, you have to start somewhere, right?

09:54 So I think it is definitely a good start.

09:56 it does seem like a lot of the, not a lot, maybe the last few frameworks, web frameworks

10:00 that have come out in Python here, you know, they do kind of model after flask.

10:04 yeah, yeah, yeah.

10:05 Yeah.

10:05 I've been doing quite a bit in FastAPI and, and flask as well.

10:08 2.0.

10:09 Yeah.

10:09 Cool.

10:09 Yeah.

10:10 I think flask is, has become very popular in its own right, but it also, its idea of how

10:15 web apps should look in Python has spread to all the other frameworks that are kind of new,

10:20 right?

10:20 Like FastAPI is a variation on that.

10:22 Yeah.

10:22 Yeah.

10:23 And I can't remember where I read it, but there's, there was a, part of this

10:27 Robin documentation that talked about just, it was like almost started out as a,

10:32 I think a college project or something of like, what if I built flask, but async and it, or

10:38 in the target, it ends up being sort of like FastAPI.

10:41 So FastAPI, yes, you can render websites with it, but the original focus wasn't websites.

10:47 it was APIs.

10:48 and, and I think this is, it's even in an earlier stage thing than FastAPI.

10:55 So I think it's definitely worth watching.

10:57 one of the apparent, there is a talk from last fall, that's linked to on, I think the

11:03 main page and then, Henry, Shriner in the audience says Robin had a lightning talk

11:10 at PyCon.

11:11 So check that out too.

11:12 Oh, nice.

11:13 Yeah.

11:13 I will.

11:14 Yeah.

11:14 I shouldn't hear about that, but nice.

11:16 So, yeah, absolutely.

11:18 Brian's crying out, scroll down to just where it says why another framework real quick.

11:21 Just a bit more.

11:22 Yeah.

11:23 So one of the interests, this, this is pretty interesting to me and it could be a sign of

11:27 things to come, or it could be just really great for Robin.

11:30 It says one of the things they're trying to get around is the execution.

11:35 Traditionally, a lot of these frameworks has been with Python.

11:39 So Python has the gill, which is rough on, parallelization and so on.

11:45 It says this is using the rust runtime and server, which attempts to work around the GIL in order

11:51 to improve performance.

11:52 So if you could set yourself free from the gill, I don't know, maybe it hosts like multiple

11:57 little pythons per thread or something.

12:00 That's pretty cool.

12:01 That's one of the things I'm wondering is if, if the runtime's in rust, how is it launching

12:05 your code, for the callbacks?

12:08 But I don't know.

12:09 There is a, the documentation does have a, architecture docs.

12:13 So if you're actually, it's very well documented architecture wise, it's not well documented

12:16 for how to use it wise, but yeah.

12:19 Yeah.

12:19 Yeah.

12:19 Indeed.

12:20 All right.

12:21 Well, good.

12:21 Fine.

12:21 That one's, that one's great.

12:22 All right.

12:22 Tonya off, off to your item next.

12:24 All right.

12:26 this is, this is sports apply.

12:29 so, so somebody told, I mean, okay.

12:33 So for those of you who don't know, I'm really big into sports, right?

12:35 Like I'm a huge, NBA, NFL, baseball, hockey, football fan.

12:41 so I'm doing a lot now with, you know, writing some web application, sports web

12:48 application.

12:48 So this is a library that somebody sent me, called sports apply to free sports API

12:55 to written for Python.

12:55 And, what it does, it actually pulls stats from, sports reference.com.

13:02 I believe it's sports dash reference.com.

13:05 And that site, it's a great website.

13:07 That site is for getting sports, statistics for like professional sports, like the NBA, NFL,

13:13 NHL, major league baseball and college basketball and football.

13:16 And it's funny because yeah, it is really cool.

13:19 And that site, it looks like a sports reference.com looks kind of looks like a, you know, like

13:23 an HTML site from like the nineties.

13:25 It does look like the dream of the nineties is alive.

13:28 Doesn't it?

13:28 Doesn't it?

13:29 Oh my goodness.

13:30 Yeah, it really does.

13:31 So I think it's also great for, you know, if you want to like learn or do some like web

13:35 scraping, but of course, you know, email the site owners first.

13:37 I believe that is a lot on that site.

13:38 But anyway, so back to the API of sports apply.

13:42 You can get like a lot of API queries for like all the, you know, mainly like the North American

13:48 sports that was saying like the NBA, NFL, National Hockey League, Major League Baseball.

13:53 You can get like the list of teams for that sport, the date and time of games, the total

14:00 number of wins for a team during the season and much more.

14:03 You can also get stats from players and from box scores.

14:07 So, you know, you can build some cool stuff around sports and how teams or players perform

14:12 during a game or during a season or do even do something even better with it.

14:16 This is super cool.

14:18 It's got a kind of a nice object oriented model.

14:22 So like, you know, from sports apply dot NFL dot teams, import teams, and then you can create

14:27 a like a Detroit team or yeah, or whatever.

14:30 And then or Purdue and get their schedule even has integration with pandas.

14:36 So you get like a data frame out.

14:37 This is neat.

14:38 Yeah, I haven't used this one yet.

14:40 I just had another one that we'll talk about later this afternoon.

14:44 But yeah, I want to try this out as well, because like I was saying, I'm always on sports

14:49 reference dot com.

14:49 Just check out the stats from the games.

14:52 People ask me a lot of times for API so they can build interesting examples or play around

14:58 and stuff.

14:58 And it's so much of this tied into either college or professional sports.

15:03 That information is really wrapped up and hard to get.

15:06 Right.

15:06 It is.

15:07 Yes.

15:08 Yeah.

15:08 It has been for a long time.

15:10 I think it's becoming a little, I mean, I don't know, a little easier, but it's for

15:14 some reason.

15:15 I remember like five, seven years ago that I wanted to do stuff with sports, like build

15:18 applications with sports, but I couldn't find an API that had no sports data.

15:23 Everything was kind of locked down.

15:25 Yeah.

15:25 Yeah.

15:25 Well, I can start with this five year old CSV file.

15:28 I guess that's what I'm going to feel.

15:30 It's not so inspiring, but this looks really good.

15:32 Yeah.

15:32 Cool.

15:33 Great.

15:33 Cool.

15:34 Great.

15:35 All right.

15:35 Now, before we move on, Brian, let me tell you about our sponsor for this week.

15:41 Okay.

15:41 Okay.

15:42 So this episode is brought to you by compiler from a podcast from Red Hat.

15:48 So just like you all out there listening, Brian and I are fans of podcasts.

15:52 I'm happy to share a new one from Red Hat compiler and open an original podcast from Red

16:00 Hat.

16:00 So with more and more of us working from home, it's important to keep human connections

16:05 and not just be stuck in our work from home setup.

16:08 And compiler unravels industry topics and trends and things you always want to know through interviews

16:13 with people who know it best and telling the stories of technology, not just the hows of it.

16:19 So on compiler, you can hear a chorus of perspectives from diverse communities behind the code.

16:24 These conversations include answering big questions like what is technical debt?

16:28 What are tech hiring managers actually looking for?

16:31 And do you have to know how to code to get started in open source?

16:34 I actually was a guest on Red Hat's previous podcast, Command Line Heroes for their Python

16:39 episode.

16:40 And it was super well done, really polished and compiler follows along in that excellent tradition.

16:47 So I checked out episode 12 of compiler, how we should handle failure, you know, really

16:51 creating a space for people to grow technically and not get fired just for one mistake.

16:58 But how do you create an environment where people are willing to grow and try things like, well,

17:02 let's try out Robin and try that.

17:03 And if it doesn't work, well, we gave it a good try.

17:05 You know, you've learned something.

17:06 So learn more about them at pythonbytes.fm/compiler.

17:10 The link is in your podcast player show notes.

17:12 I know you all out there listening, you can just go to your podcast app and type compiler,

17:16 but please visit pythonbytes.fm/compiler and just click the link for your podcast player.

17:20 There's like tons of them here.

17:22 That way they know it came from us.

17:24 So thank you, Red Hat and compiler for supporting our show.

17:27 All right, Brian, you ready for the next one?

17:29 I am.

17:30 Give us a shot of terminals.

17:32 A shot of terminals.

17:33 I seem to have messed up my tabs though.

17:35 So let me just open that back up here.

17:37 Here we go.

17:38 So this one comes to me, I believe from Jay Miller.

17:41 I'm pretty sure he's the one who told me about it.

17:43 So thank you, Jay.

17:44 And the idea is really simple.

17:46 I want to create a screenshot of something I'm doing for a demo code.

17:51 You know, I create a lot of courses and presentations.

17:54 So it's super helpful for that.

17:55 Tanya's doing DevRel and she's, I'm sure, doing lots of presentations where there's like,

17:59 I need a screenshot of this thing and Brian for books and so on.

18:02 Yeah, I could totally use it.

18:03 So this might, yeah, this thing might turn out to be super useful.

18:06 So what it is it's a thing you brew install it and then, or there's different ways in which

18:14 you can install it.

18:15 It's a little bit like carbon.now.sh or if people have seen that.

18:18 And you can capture some kind of output in your terminal exactly like it looks directly to an

18:25 image.

18:25 And you can even, you know, specify, I would like to pipe that directly to whatever

18:29 app you edit screenshots in.

18:32 So for example, I use Pixelmator Pro.

18:34 So I might just say, take this, run this command, take the screenshot and then open it in Pixelmator

18:40 Pro go and stuff like that.

18:42 So really, really nice.

18:43 The way you run it, it's a little bit like time or watch or perf.

18:46 So you just say term shot and then like Python, some file or whatever it is you're trying

18:52 to do.

18:52 Here's an example of one that I did on.

18:55 This is a program using Colorama to make interesting colors on the screen, doing async and await examples

19:03 of like doing a bunch of requests against Talk Python and then pulling back the titles using Beautiful

19:09 Soup.

19:09 And I just said term shot, Python, program, boom, and out it comes with this really nice

19:15 looking picture.

19:15 Exactly the right size.

19:17 So however long the scroll back is, like that's the size of the screenshot.

19:21 You don't have to like, you know, take a picture, scroll down some, take another picture, try to fit it

19:26 back together, all that kind of weirdness.

19:28 So yeah, really neat.

19:30 Yeah.

19:30 And then the final thing is, if for some reason it's more complicated than one line of just

19:37 Python this, but you're like, I want to run three commands.

19:40 So maybe what I want to do is I want to show that I'm SSHing into a server, then I'm running

19:44 this command and then I'm open, you know, I'm seeing the result of that or something like

19:49 that through like LS.

19:50 So if, if all else fails, you just type term shot and you give it some shell, like you could

19:56 say slash bin slash Z shell, ZSH or slash bin slash bash.

20:01 You do your work.

20:02 And once you exit the shell, it'll just take a screenshot of like whatever you did while you

20:06 were in there.

20:07 So that's also pretty good.

20:09 That takes less thinking.

20:11 I like that.

20:11 Yeah, it does.

20:12 Exactly.

20:13 So.

20:14 Yeah.

20:15 It's so interesting.

20:15 You're, you're mentioning a color ammo, Michael.

20:18 I learned about color ammo from you.

20:19 Actually.

20:19 I took your, your async, asynchronous programming course.

20:24 Oh, you did.

20:24 Oh, yeah, I did.

20:25 Yeah.

20:25 On.

20:26 Yeah.

20:26 Thank you.

20:27 Yeah.

20:27 You're awesome.

20:27 Yeah.

20:27 Of course.

20:28 Yeah.

20:28 That example was from that, that course for sure.

20:30 Okay.

20:30 Yeah.

20:31 Yeah.

20:31 I look familiar.

20:32 Nice.

20:32 Cool.

20:33 Yeah.

20:33 What I thought was neat about it is it like, even with just non-standard print output and

20:37 stuff, it still captures it, you know, reliably, which is, which is nice.

20:40 So when you run that command, it, it takes a screenshot and it saves it to, I don't know,

20:44 your desktop or, so now like with carbon, you can, you, you know, you can like click

20:49 a button and it'll save it, you know, or to save it.

20:52 And then you can just paste it into wherever you want.

20:54 Yeah, exactly.

20:55 I don't think it goes to your, I think it goes to whatever working directory you happen to

20:59 be in.

20:59 Okay.

21:00 Just wherever you ran the command in that directory, there's an out dot PNG.

21:03 Okay.

21:04 There's probably ways to specify it or whatever, but by default, it just drops that PNG file

21:09 there.

21:09 Yeah.

21:09 It's super handy for presentations, I think.

21:12 Yeah.

21:12 All right.

21:13 Over to you, Ryan.

21:13 Well, I want to talk about the GIL.

21:17 we talked about it a little bit earlier, but, so it, our Turner, wrote an article called, when, when Python can't thread a deep dive into the gills

21:29 impact.

21:30 And what I really like about this article is just that the, the focus of it is to try to

21:36 build, not, not the specifics of everything around the gill, but as a user of Python, what's

21:42 the mental model that you need to, to be able to utilize threading and multiprocessing

21:49 and, and different extensions correctly to try to figure this out so that you just have

21:55 a gut feel for how things work so that you can work through it and everything.

21:58 there's a, a little bit, it's kind of in the middle of the article.

22:01 There's, mental model that he presents and I'm, I'd like to talk about a little bit,

22:07 some of the other cool aspects of the article, but first the mental model he's going for is

22:12 a thread must hold the GIL to call a CPython API.

22:17 and, the, the, so anything that any Python code that's using, API like built

22:24 in Python calls is, is going to block because it's going to grab the GIL.

22:30 other threads can't run if the GIL is there, but if you're doing pure Python stuff,

22:35 your stuff gets interrupted every five milliseconds automatically.

22:40 I didn't know this, but that's kind of cool.

22:42 long running things.

22:44 So if you have a sleep or some other extra process that takes a long time, not Python

22:51 code going through, but, but like a sleep or something, or, you know, probably don't have

22:56 a long sleep, but maybe you're reading a file or something, something that talking

23:00 into a database, something like that.

23:01 Yeah.

23:01 It doesn't automatically interrupt every five milliseconds.

23:04 So the five milliseconds isn't guaranteed.

23:06 So there's blocking prop possibilities.

23:08 and then, Python extensions written in C, or rust or something can explicitly

23:17 release the GIL to allow.

23:19 So you can get around this with extensions and stuff.

23:22 So this is this, that's the mental model, but to really sync at home, he's got a

23:28 whole bunch of these profiling graphs that are great.

23:30 So here's an example of a little, program that starts, there's like two functions.

23:35 There's a, it's really a main and a go.

23:38 And essentially you end up with two threads.

23:40 Like the thread starts this go thing.

23:43 And then you run go within the main thread also.

23:46 So what this has done is just doing like some summing of a whole bunch of numbers, but the

23:51 example is just to keep busy for a while.

23:53 And, and, and then look at what happens.

23:56 And what happens is you've get, you get these, these shifts of like one of them is spinning

24:02 around, but the other one's just, you know, this toggling back and forth that happens

24:07 kind of cool.

24:08 There's, the, the, all the different models that can happen.

24:13 And like, here's one where you're, let's see, what are we doing here?

24:18 it's sleeping for a while.

24:20 So it's completely blocked.

24:22 So you've got one thread that's just completely blocked for a long time.

24:26 And, and the visuals of the profile are great to, to visualize what's going on.

24:31 So anyway, at the end of the article, he talks about how to get around it and when,

24:36 when and where and how to use different models like async and extensions and things like that.

24:41 So, anybody that's really caring about this sort of stuff, I think this is a great

24:45 article.

24:46 The visualizations are quite neat.

24:49 you know, instead of just saying you're spending this much time in a particular function,

24:54 it says, and you're waiting or you're doing CPU work.

24:58 Right.

24:58 And you can actually see those side by side and see like the CPUs here because normal profilers

25:04 will just tell you, well, you're spending time, you know, here, what are you doing?

25:07 Yeah, exactly.

25:08 Right.

25:09 Yeah.

25:09 It's really helpful.

25:10 The visual, I don't know.

25:12 I learned visually.

25:12 I'm like three, you know, large visual learner.

25:16 yeah.

25:17 Like the gills is something that's always kind of like, I don't know, it just was really confusing

25:21 to me.

25:21 You know, when I was first starting out and, getting into like more intermediate stuff,

25:25 but I took this, it was like a Python deep dive course where the instructor really

25:30 kind of like talk about things behind the language, you know?

25:34 so it really kind of helped me grasp and wrap my head around it more, but yeah, this

25:38 is great.

25:38 I love this.

25:39 Yeah.

25:39 Nice work at tomorrow.

25:40 This is a definitely a good one.

25:42 I like the pictures as well.

25:43 All right.

25:45 On.

25:46 You want to take a satan?

25:47 I apologize.

25:47 I believe I switched the order of your two topics.

25:50 That's okay.

25:51 No worries.

25:51 I hope I didn't throw you off there.

25:53 That's okay.

25:54 So this is the, yeah.

25:55 Okay.

25:55 So this one is the NBA API.

25:57 So this one is just strictly for the NBA, the National Basketball Association.

26:02 This is really close to home for you, right?

26:04 This is like.

26:04 Yeah.

26:05 It's very close to home.

26:06 Yes.

26:06 It brings back memories.

26:07 So, and right now with, you know, NBA playoffs happening, I think this is pretty

26:12 exciting.

26:12 so this package is maintained by a gentleman named Suara Kertal.

26:17 I mean, does a very great job of maintaining it.

26:19 it's very up to date.

26:20 this API pulls data from the, NBA.com, right?

26:27 That's the official website of the National Basketball Association.

26:30 with this, package, you get like more accessible endpoints.

26:35 the documentation is really, really good.

26:37 I think it's probably, you know, it's a really well-documented API.

26:40 let me see what else here.

26:43 the, the NBA.com API isn't as well-documented because you know, a lot of things change, you know, things change frequently, right?

26:52 Like players are traded, players get injured, players retire.

26:55 You have to take into account all the stats as well, like points per game, rebounds per

27:00 game, and that type of thing.

27:01 so this package, the NBA package has tons of features.

27:04 like you can get information on players, teams, like, you know, more static data as well

27:11 as like data that changes as well.

27:13 Like, you know, their stats.

27:14 I think, their stats per game, per season, like their player game law, there's tons and tons

27:21 of endpoints.

27:21 So I would, if you want to work with this API, I recommend looking up the API endpoints.

27:26 there's probably like over 40 of them.

27:29 Wow.

27:30 Maybe around 40 actually.

27:31 yeah, it's just really cool.

27:33 I'm actually working with this right now and I'm writing a, doing a, sports,

27:38 NBA ranking website right now.

27:41 I'm using this, package.

27:42 Fun.

27:43 One of the things that's cool is it has a lot of search functionalities and not just direct

27:48 by, you know, find me the team from this city or this name, but like, find teams

27:53 by state or something.

27:55 Yeah.

27:55 Yeah.

27:56 Yeah.

27:56 It's definitely very clever.

27:57 and it, I would say between like the first thing we looked at is sports reference

28:03 dot com.

28:03 I don't know where they're pulling.

28:04 I think I'm not sure where they're pulling their data.

28:06 Sports reference, maybe from each individual site of the, you know, the sports associations,

28:12 I'm guessing.

28:13 Right.

28:13 Okay.

28:14 but well, I mean, like for example, if the data from NBA has got to be more centralized

28:21 than like all of the college ball stuff, right?

28:24 Yeah.

28:25 Yeah.

28:25 This is cool.

28:26 Even as important for live data here, like NBA dot live and points for scoreboard and all

28:32 kinds of stuff.

28:33 That looks, that looks pretty neat.

28:35 Wow.

28:35 This is some, there's a lot of data here.

28:37 Yeah.

28:38 You check out the notebooks, right?

28:40 The notebooks seem to have some cool examples.

28:42 Yeah.

28:42 Yeah.

28:42 I just have a notebooks and a new better notebooks they have.

28:43 Yeah.

28:44 Yeah.

28:44 There's a lot of data.

28:45 It's a very good.

28:46 Yeah.

28:46 It's pretty, pretty awesome.

28:48 There's a lot that you can do.

28:49 A lot of fun stuff.

28:49 Cool.

28:50 I know so many people want to build examples with sports and I think having some live data

28:56 would be really, really neat.

28:58 So, you know, like during, like you say, like right now during the playoffs or something,

29:02 you could, you could do some fun things indeed.

29:05 Yep.

29:05 All right.

29:06 Brian, is that our six items?

29:08 It is.

29:09 So do you have any, anything extra to share with us?

29:12 I have, I think just a real quick, quick one here for us from Pablo.

29:18 We have Python 3.11 beta one is here.

29:22 So hurrah.

29:24 This marks feature freeze, which means there'll be no new features or APIs, only bug fixes.

29:30 So please, they say, if you maintain a Python package, help us test that everything works

29:36 as expected.

29:36 But this is pretty neat.

29:38 Nice.

29:38 Yeah.

29:39 That's it for me.

29:41 On that, I'm going to grab this just a second.

29:44 We'll link to this as well.

29:47 Simon Willison has a little blurb on like if you're using GitHub actions to test your packages,

29:54 Simon has a code snippet for exactly how to do that.

30:00 Essentially, the Python thing you want is Python 3.11-dev and make sure it's in quotes and just

30:08 add that to your Python versions matrix.

30:10 All right.

30:11 Fantastic.

30:12 Cool.

30:12 So how about you, Tanya?

30:14 Do you have any extras?

30:15 That's pretty much it.

30:17 Well, I do see some people in the chat that I've met at PyCon last week.

30:21 Mario.

30:21 Hey, Mario.

30:22 I'm not sure if you're still here, but hello.

30:23 Cool.

30:24 Fantastic.

30:25 Yeah.

30:25 You just came back from PyCon and Brian and I were not there.

30:28 You want to give us a quick report from being on scene?

30:33 Yeah, it was amazing.

30:34 It was my first Python.

30:35 And actually, one of my first tech conferences, actually.

30:39 It was great.

30:41 I spent most of the time working on booths for DeepGram because we were helping to sponsor

30:44 the event.

30:45 I did catch a few talks and met so many amazing people and also just connected with people that

30:54 I have been communicating with over the last several years via internet and chat and stuff

31:01 like that.

31:01 So it was just really fun.

31:02 It was a good time.

31:03 I love PyCon.

31:04 I consider it my geek holiday.

31:05 Yeah.

31:06 I love to go there and meet so many of the people.

31:09 Everyone's so accessible.

31:10 And I spend most of my time just walking around looking to say hi to folks and whatnot.

31:16 Yeah.

31:16 So I have an idea, Michael.

31:17 Maybe next year we should go.

31:19 Yeah.

31:19 Yeah.

31:20 Maybe next year we should go.

31:21 Yeah, definitely.

31:23 I'm looking forward to getting back there.

31:24 Well, do you have anything funny for us?

31:25 Are you looking forward to a joke?

31:26 Yeah.

31:27 I do.

31:27 Well, I have something for you.

31:29 I'll let you know.

31:30 You'll be the judge if it's funny.

31:31 All right.

31:32 So here's what I got.

31:33 Brian, just maybe give us a quick description of what this picture is about here.

31:37 I don't know.

31:39 There's a guy who looks really stressed out holding his hand in front of his face.

31:43 I think he's crying.

31:44 I think he's crying, yeah.

31:46 He's pretty sad.

31:47 I mean, red eyes almost, just crying.

31:49 Yeah.

31:50 And so, you know, we all come to these websites and it's, you know, prove you're human and

31:54 all these recapture things.

31:55 And sometimes you're lucky and you're going to slide the puzzle over until like the dog

31:59 fits in his house or something rather than find all, you know, highlight all the stoplights.

32:05 Or anyways.

32:05 So the joke is, with a very sad guy here asking, it says, when a computer asks, are you a robot?

32:12 Maybe it's just wanting to find its family.

32:15 Poor thing.

32:18 Maybe it does.

32:19 Maybe we're not.

32:20 We should just be helping more.

32:21 And, you know, every time we prove a recapture, it's just like, no, that's not my family.

32:26 It's so funny.

32:27 One of the funniest find this memes that I saw recently was just like a picture of space.

32:34 And it said, click all the squares that have a Klingon bird of prey inside.

32:39 Because they cloak, they're invisible.

32:43 That's right, yes.

32:44 Of course.

32:45 Very good.

32:47 Very good.

32:48 Thanks again for having a great podcast.

32:49 Thanks, Tanya, for showing up and doing this with us.

32:52 Yeah.

32:53 Thanks for having me.

32:54 It was fun.

32:55 Yeah, great to have you on here, Tanya.

Back to show page