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


Transcript #307: Your Python just got faster (3.11 is out!)

Return to episode page view on github
Recorded on Wednesday, Oct 26, 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 307, recorded October 26th, and I am Brian Okken.

00:10 Hey, I'm Michael Kennedy.

00:11 Yay. Well, it's pretty exciting here in Python world this week.

00:17 Oh, it's a big deal this week, absolutely.

00:20 It's a big deal. So tell us why it's a big deal.

00:23 We've talked about Python being faster and new features coming along.

00:29 But primarily, I would say there's like two ends of the spectrum that people have been really looking forward to.

00:36 One is, wouldn't it be great if you did nothing and your code ran 50% faster?

00:41 Brian, you and I are of similar age, and I remember it was just like, well, wait till next year till I get a new computer.

00:48 And that program that's a little sluggish is going to be zooming along, right?

00:52 And just like computers would just double in speed all the time.

00:55 And we don't get so much of that anymore.

00:57 But with Python, we kind of do this time around.

01:00 Yeah, I remember like also like adding more memory and trying to detect whether I could tell a difference for the $100 I spent.

01:07 Yes, exactly. Exactly. Or optimizing your low MIM versus high MIM.

01:12 I mean, that's going back always.

01:14 But the big news is Python 3.11 is out.

01:18 Woo!

01:19 Yay!

01:20 Yeah, that's...

01:21 We should have had like champagne or something.

01:23 Yeah.

01:23 Yeah, pop some corks.

01:26 So very big news.

01:28 I'm super excited about it.

01:29 I told you there's this end of the spectrum.

01:31 The other end of things that people seem to be psyched about across the board is better error messages.

01:36 Yeah.

01:37 I mean, it's very important for debugging and also for teaching people and learning Python.

01:43 Yeah, absolutely. Absolutely.

01:45 I got to pull this one up just for nostalgia's sake.

01:47 Dave in the audience says, back when we had turbo buttons, our computers, they literally had a button that said turbo.

01:53 I remember when I got my Pentium 90, it had a turbo button.

01:56 And I'm like, yes.

01:57 What it really meant is if it was off, it would run in like some weird retro slow modes.

02:01 I would like play MechWarrior.

02:03 And stuff would like zoom around insanely fast.

02:06 But if you took off turbo, you could play some of the older games because they weren't based on time.

02:10 They were based on frame rate.

02:11 Anyway, crazy, crazy memories.

02:14 So we're kind of getting that cool like doubling of speed thing here.

02:18 So there's a ton of stuff to talk about in terms of what's available here.

02:21 Before I get into the details, I want to point out on YouTube, which I'm linking to, Python Discord, Lemon over there, hosted a live stream of the release.

02:32 So this is not a party celebrating the release, but this is live broadcasting of the actions and the steps as it's being released.

02:41 Like, okay, the final one is built.

02:43 Okay, we pushed it to the Microsoft Store for Windows Store install.

02:48 Now we pushed it to, you know, Python.org.

02:52 Now it's over here.

02:54 And like, right, like the actual pushing of the deployment.

02:57 And there's a bunch of interesting things that happen there.

03:00 And along the way, they talk about some of the features.

03:02 I'm going to have a subset of the people that were there in apparently 46 hours on Friday on Talk Python to make an episode out of it there as well.

03:11 That's pretty cool.

03:12 It's neat that they do that.

03:14 Yeah.

03:14 So people can just watch the process.

03:16 Yeah, it is cool that they do that.

03:18 And I certainly, I saw a pop up and like, these guys are going live.

03:22 I'm like, oh, that's playing on the background while I'm working today.

03:25 You know, I'm going to be apparently at 80% capacity of like getting stuff done, but I'm going to enjoy it a lot.

03:30 Also, we have a logo, which is not the official Python logo, but a Python 311 logo.

03:38 And it has like little, it's like two snakes, but they're not the Python, you know, cartoon, dramatic, like sort of stylized snakes.

03:48 They just look like snakes.

03:49 And it says faster Python exception groups and accept star typing improvements.

03:54 And like literally the logo basically is the release notes.

03:57 But, and it has a lightning bolt in the middle.

04:00 I guess that means fast.

04:01 I think so.

04:02 I think so.

04:02 All right.

04:03 So let's see.

04:03 Major new changes.

04:05 We've got fine grained error locations and tracebacks.

04:09 Let me see if I can get it to show us some interesting example here.

04:13 Yeah, this is super cool.

04:14 So check, there's a line.

04:17 If you just follow the PEP there, there's an example of, you know, suppose you're calling like a complicated JSON API and you get this data back and you start in a variable X.

04:26 And you've got to go to some field in the JSON document, then further down, then further down, and further down, and like either get or set a value.

04:33 So here it has X bracket of A, bracket of B, bracket of C, bracket of D.

04:39 So you're like diving from like level A, B, C, D in the JSON document.

04:43 If you get the error, none type is, or, you know, object is not subscriptable.

04:48 You know, something there was none.

04:51 Yeah, but you're four levels deep.

04:52 Which one was it?

04:53 Right.

04:54 It could have been B wasn't subscriptable, or it could have been C, or it could have been like, you don't know where.

04:58 And so what a hassle, right?

05:00 And you do print statements, and that's when you do debugging statements.

05:04 That's when you maybe make that four different lines so you see which line crashes.

05:08 Well, in 3.11 now it just says tilde, tilde, tilde, carat, carat, carat.

05:13 Look, it's, you had X of A of B of C.

05:16 It's C that was the none thing.

05:19 That's where the problem was.

05:20 Actually, I suspect that, yeah, I guess it's probably C.

05:24 We tried to get D out of none, and C was none is probably where the error was.

05:28 Yeah.

05:29 But it points like right where these problems are throughout there.

05:33 Yeah.

05:34 Really neat.

05:35 Plus a whole bunch of others.

05:37 Yeah, there's a bunch of other ways that they're highlighting where the problem is.

05:41 Yeah, if you go through, there's a bunch of cool examples here.

05:44 But basically, you end up with within complex expressions.

05:49 You know, multiple things happening on one line and so on.

05:52 You get nice details there.

05:54 Pretty cool.

05:55 So that's just one of them.

05:57 But I would say if you don't care about performance, that's probably what you might consider the highlight.

06:03 If you're an asyncio, async and await type person, async exception groups, PEP 564 and accept star are pretty interesting.

06:12 Because if I start three tasks and I wait on them and two of them have errors, well, which exception do I get?

06:19 Do I get the one from the first one or do I get the one from the second one?

06:24 So it would be great to be able to say two of the three things failed.

06:27 Here are their problems.

06:28 Right.

06:29 So you can kind of get a holistic view of what's happening.

06:31 That's great.

06:32 Yeah.

06:33 I'm actually, I'm actually, I still haven't got my head around this completely, but I'm curious to see how that this will change sort of Python style.

06:43 Because this changes how you can write exception handling.

06:46 Indeed.

06:50 Some of the higher level async frameworks like Trio and AnyIO have this concept of starting and managing a series of tasks together as a group.

07:01 So if I'm going to save and entry to the database, I'm going to call an API and I'm going to create a file.

07:09 And those are all the, all a result of like, I want to create a new user.

07:13 I want to do whatever.

07:14 Right.

07:14 You might want to be able to say, I want to start all those and wait for them to finish.

07:19 Or if I start a couple of them to decide I want to bail out, cancel all of them or if one fails and so on.

07:24 So we've got this concept of a task group in AsyncIO and changes to the task cancellation semantics.

07:33 And it's interesting.

07:34 We've got, you know, PEP 657 was the traceback enhancements.

07:40 654 was the exception groups.

07:43 But the task groups is GH 90908.

07:47 Interesting.

07:48 You know what GH stands for?

07:49 GitHub.

07:49 Okay.

07:50 Weird.

07:51 So it's news to me that this, these features get added through just a GitHub issue rather than a proper, you know, PEP.

08:01 But anyway, yeah.

08:04 Pretty neat.

08:05 Maybe you're pronouncing GH as P.

08:07 Yeah.

08:08 Like it.

08:08 Exactly.

08:12 Let's see.

08:13 Henry has some cool comments following up out there.

08:16 Henry Schreiner.

08:17 Thanks.

08:17 Catters is already using exception groups via backport exception group.

08:21 It is fantastic and really does change Python exceptions.

08:25 Cool.

08:26 Cool.

08:26 Cool.

08:27 Extra information there.

08:28 All right.

08:29 Let's keep going.

08:29 You've already talked about TomlLib being built in.

08:32 Like now that we have pyproject.toml.

08:34 Should we really have external libraries in order to understand them?

08:37 Yay.

08:37 Now we, now we get to do the, the if block.

08:41 If, if, if import TomlLib or, you know, the try except around it.

08:47 Because.

08:47 Exactly.

08:48 How fun.

08:49 Yeah.

08:50 Yeah.

08:51 It is a good thing though.

08:52 I'm glad for that.

08:54 Yep.

08:54 There's changes to regular expressions.

08:56 If you care, you know.

08:58 All right.

08:59 And then we've got basically a general statement saying the faster CPython project is already

09:06 yielding some exciting results.

09:08 That is Mark Shannon, Gita Van Rossum, and a bunch of other folks, Grant and others, all

09:17 working on this.

09:17 And it says already yielding some exciting results.

09:19 Python 3.11 is up 10 to 60% faster than just 3.10.

09:24 That is just from last year.

09:26 Right?

09:27 Right?

09:27 Hence the turbo button.

09:29 On average, we measured a 1.22 or otherwise known as 22% feed up on the benchmarks for Python

09:40 tests.

09:41 So, or Python benchmarks.

09:43 That's awesome.

09:44 You can see faster Python for details, right?

09:46 There's already some of those we're making to 3.10.

09:48 3.11 is getting more.

09:49 3.12 is getting more.

09:50 And it's, yeah, it's just a first down payment, I guess.

09:54 But it's really great to see that happening.

09:56 Yeah.

09:56 Pretty exciting.

09:57 A bunch of stuff around typing.

09:59 Those are a lot of the other highlights there.

10:01 Two things that are worth calling out here, I would say.

10:04 One is self.

10:05 It's good to be self-aware, right, Brian?

10:08 Yeah.

10:08 It is.

10:11 And so, Python classes can now understand that they too have a self, even though they

10:17 say self all over the place.

10:18 Like, no, their language, right?

10:19 Like, this in C++ and C# is a thing you can, but not must use, or you've got to say

10:24 self.

10:25 So, ironically, the typing system now also understands self.

10:28 And you can say, well, the problem was before, if I'm in a class and I have a method of that

10:34 class that returns an instance of that class, the class is not yet defined as far as Python's

10:39 concerned until you're to the end.

10:40 So, I can't say the return type is the name of the class, because until you're done, the

10:46 class is not defined, right?

10:48 It's like this weird error.

10:49 So, what you can say is it returns self.

10:50 And whatever self is, that's what it returns.

10:53 And one of the changes and difficulties was to make this work with inheritance.

10:58 Yeah.

10:59 I mean, like in C or in C++, you have to pre-declare the type ahead of time.

11:04 But then, yeah, anyway.

11:07 We don't have declarations in Python, so.

11:10 We don't.

11:11 I wonder why we don't have a two-pass compiler that like scans for types and then expands

11:16 out the details.

11:17 Do you know what variadic generics are?

11:19 Putting you on the spot.

11:22 Sorry.

11:23 You are putting me on the spot.

11:24 Let's see.

11:27 I just want to use that word more often.

11:29 I know.

11:29 I know.

11:29 It sounds like.

11:30 Yes, I do have a PhD in computer science.

11:33 It enables the creation of generics parametrized with a single type.

11:41 So this is something I don't do much of in Python types.

11:45 You can create a type variable that then defines the type of a thing and then use that variable.

11:50 It's kind of like templates a little bit.

11:53 And so this has to do with that.

11:54 Okay.

11:55 I don't think I'm smart enough to use this.

11:57 If you look at the example, you say I created an axis one is like a type.

12:01 And then I can say I have an array, which is of type, you know, of generic, of axis one,

12:07 axis one, right?

12:08 Like, I don't know.

12:09 I kind of left that kind of stuff behind in C++, like the multiple template.

12:14 Oh, good.

12:14 Somebody's helping us out.

12:16 Dean is saying, when I learned about generic, I thought maybe we've gone too far with typing.

12:23 Thanks, dude.

12:25 You know, one thing that's nice about Python is often you don't have to know or care or consume certain parts.

12:33 You know what?

12:34 That doesn't apply to me yet.

12:35 Maybe someday.

12:36 Not right now.

12:36 There's other stuff, of course.

12:38 The last one I think is noteworthy has to do with limiting the spread of little Bobby tables, let's say.

12:47 And these are arbitrary literal string types.

12:50 So the idea is if you've got, say, like a SQL query, it would be great to somehow define,

12:58 here's a string that I want to put into code, but I don't want to, it's kind of like a static string in a sense.

13:06 Like it can't be modified or added against non-literal strings.

13:11 So the example says, look, I've got select star from data where user ID equals F string curly user ID.

13:17 And if you say user 123, good.

13:18 Good.

13:19 But you also might say user 123, semicolon, drop table, data, semicolon.

13:24 Or you could do, you want to get all the records, you say user 123 or one equals one.

13:29 Right?

13:30 Like these are bad.

13:31 So what you can do with these now is you can come up with literal strings and they, in order to make the query work, you have to use database parameters.

13:42 You just put like a placeholder in the string that never changes.

13:45 And that way, basically your string in a sense is safe from injection.

13:49 Okay.

13:50 Yeah.

13:51 But you can still, you still can pass parameters in, but you just have to do it a different way.

13:55 Right.

13:56 And so in this example, they have select, select user.name, user.age from data where user ID is question mark.

14:01 That's the indicator of a SQL parameter.

14:04 And then you say connection execute given that string.

14:07 And then you pass the parameter, which has the value of the user ID.

14:10 And then the database engine knows like that can't like truncate a statement.

14:15 Right.

14:15 It can't sort of modify the command you send.

14:18 What's notable though, is you can also add on things and you can change it and combine it with other literal strings, but not with non-literal strings.

14:28 Okay.

14:28 Interesting.

14:29 Yeah.

14:31 That's what this literal string type is here.

14:35 And yeah.

14:38 Anyway, so people can check that out.

14:40 I think that's, you know, that's going to be useful in a lot of situations where you're trying to be safe with user input, basically.

14:47 Yeah.

14:48 All right.

14:50 Is that it?

14:50 I think that might be all the highlights.

14:52 Yeah.

14:52 There's a go, go get your version.

14:55 I've already brew installed my 3.11, which is cool.

14:59 You brew installed.

15:00 Okay.

15:01 I did.

15:02 Now, if you just say brew install Python 3, you'll get 3.10, 7, I think, or 8.

15:09 You won't get 3.11.

15:11 But you can brew install Python.

15:13 I think it's at 3.11 or at 3.11.

15:17 You'll have to look.

15:18 I don't remember the exact command.

15:20 But there's a way to say, no, I want the cutting edge version.

15:23 And I was already, final thought on this.

15:24 I was already given a small cut by it.

15:28 You were.

15:29 You were.

15:29 I was.

15:30 I was.

15:30 So, you know, I was.

15:31 The Python bytes.

15:32 Python bytes website is based on Beanie, the MongoDB, Pydantic combo of glory.

15:39 Because it's all async.

15:41 It's based on motor.

15:42 The async driver for Python and MongoDB from the MongoDB folks.

15:48 They built that thing in the super early days before async and await was a thing based on

15:53 tornado.

15:53 So, they don't use async def for their async functions.

15:57 They put at async.io.coroutine as a decorator onto all their async functions.

16:02 Well, that was awesome until 3.11 where that was removed from the runtime.

16:07 So, that doesn't work anymore.

16:11 And it doesn't run so well either.

16:12 So, the motor people had to rush out 3.11 yesterday after much conversation of like,

16:19 you guys realize you should have tested on 3.11 beta or RC1 or RC2 or any other release

16:26 at some point because clearly this code was never going to run and you should have known

16:31 straight away.

16:31 But at least they fixed it quickly.

16:33 Okay.

16:34 So, Henry wants to know, how did you find it?

16:36 Apparently, it's on unmerged PR.

16:39 Perhaps.

16:41 I just did brew update, brew outdated.

16:43 And it said new recipe or new whatever they call it.

16:47 Whatever it calls those things.

16:49 It said new recipe, Python 3.11.

16:51 I said, oh, cool.

16:51 Then I'll install Python 3.11.

16:52 Okay.

16:53 Yeah, that's how I know.

16:54 So, I want to stick with this install thing a little bit.

16:58 Yeah.

16:59 Because I would think that you're probably a power user.

17:02 I mean, kind of.

17:04 You know Python pretty much and you're doing, trying to be cutting edge and everything.

17:07 I think that a lot of Python bloggers and social media people that are famous in Python

17:16 are probably the power user kind of people.

17:18 And they tell people weird things, I think.

17:21 Like brew install Python 3.11.

17:22 Just brew install.

17:23 And I don't think it's a good idea.

17:25 Yeah.

17:26 I'm going to get on the soapbox a little bit and say, I wrote an article on how to install Python.

17:32 And it's installing Python 3.11 on Mac or Windows.

17:36 And we'll get to Linux in a bit.

17:39 So, the gist is, you go to python.org, you hover over downloads, and you click download.

17:46 And then the thing that gets installed, you install it.

17:50 Now you're done.

17:51 Okay.

17:53 So, why did this deserve an entire article?

17:56 Well, because I think a lot of people are teaching people to do, like saying, just brew install it.

18:01 Or do PyInv.

18:05 And PyInv, anyway, we'll get to there.

18:09 But so, I just want to tell people how long does it take?

18:13 It takes about a minute.

18:15 I timed it on both my Mac and did it on a Windows machine.

18:20 And just installing everything takes, yeah, it took about a minute.

18:26 A minute and 13 seconds on my Mac.

18:28 And this is including me having to hit stuff.

18:31 So, it's also my delay.

18:33 And then also did it, on Windows, it took like twice as long.

18:38 But I was tunneled through a VPN and firewalls and stuff.

18:42 So, it's probably all that.

18:45 It's pretty fast.

18:46 You can have, and it doesn't uninstall anything.

18:49 So, you can have multiple versions.

18:51 So, it will, like if you use that sort of download link for like the latest, like 310.8, it'll go over the top of 310.7, I think.

19:00 At least on Mac, it does that.

19:02 But that's okay.

19:03 It's kind of what I want.

19:04 I've got 310.

19:06 You can have multiple.

19:07 I've got 310, 3.7, 3.11 all on my machine just with those links.

19:11 And the 3.11 just is the default.

19:14 I think it's the newest one and the oldest.

19:19 Anyway, it modifies the Z profile, your .Z profile.

19:23 And it shows up as the latest one.

19:25 Now, if I had 310 before, what if I go back and install the update my 310?

19:31 Will it make 310 the default?

19:34 No, it doesn't.

19:35 It leaves it alone because it was already in there.

19:37 It leaves it be.

19:38 But you should check anyway if you're going to go back and install old versions.

19:41 And Tox works just great with it.

19:44 So why am I kind of ranting on this is because a lot of people try to say homebrew.

19:50 And if you're a homebrew user, you're not going to look for this blog anyway.

19:54 You're just going to try to do it with homebrew.

19:56 Great.

19:56 Go for it.

19:57 You're perfect.

19:58 And PyEnv, I think there's some places for it.

20:02 But PyEnv is about managing different versions and having multiple live at the same time and

20:06 different projects use different ones.

20:08 It's not just an easy installer.

20:11 And since it does all that other stuff, I don't think people should recommend it for newbies.

20:16 It's not the right tool for somebody new to Python.

20:20 I think it's just going to confuse the heck out of people.

20:24 So that said, I walked through the whole thing in this article.

20:28 But I also admit that it's Mac focused.

20:32 But on the Windows, I did a little blurb on Windows too.

20:37 The thing I want to tell people that I sometimes forget on the Windows install is go slow when

20:42 you're clicking through everything so that you can select the advanced features.

20:45 And you probably want add Python to environmental variables.

20:50 That makes it so that just shows up in your path.

20:53 Because you can add that to your path manually or you can let the installer do it.

20:57 And I like to have the installer do it.

20:59 So that's my rant.

21:01 I think that for most people, just use the default installer.

21:06 Yeah, I think that's totally good advice.

21:08 Let's see here real quick.

21:10 I also did that the other day before it came out in Peru.

21:14 I'm like, let me just put it over here and see.

21:16 I wanted to test some things.

21:17 And I had 3.11.

21:19 And they were both totally content next to each other from those installers.

21:23 I just decided to take 3.9 out because I didn't really need that.

21:27 I've got it from homebrew as well already.

21:30 But they do coexist.

21:32 It's fine.

21:34 And here's what the brew statement is.

21:37 It's new formulae.

21:40 And it's Python at 3.11 is what you can expect.

21:43 Okay.

21:43 Nice.

21:45 Yeah.

21:46 And as for Linux people, I think it's sort of funny that people try to tell

21:51 how to install Python articles, talk about Linux stuff.

21:55 Linux people already know how to install their stuff, don't they?

21:57 I mean.

21:58 Yes.

21:59 But although it's more complicated because Python's broken into a bunch of pieces.

22:03 You want Python?

22:04 Or do you want the Python dev bit?

22:06 Or do you need the build essentials?

22:07 Or like there's a lot of like, do you need Python 3-V and V?

22:13 Because you want to create a, like, the virtual environments don't come with Python

22:17 when you apt install it, which is like, what?

22:19 Okay.

22:20 But they do on Mac and Windows.

22:21 Yes, exactly.

22:22 At least the error message is, you don't have this.

22:25 Should you apt install Python 3-V and V?

22:29 Yes, I should.

22:29 Let me copy and paste.

22:30 Hold on.

22:30 Yeah.

22:31 Okay.

22:32 All right.

22:32 I see Roman out in the audience there.

22:35 Roman, I've got some shout outs for you in a little bit.

22:38 And in the past, if you weren't here.

22:39 But before we get to those, I want to tell you about this week's sponsor,

22:44 Microsoft Founders Hub.

22:46 Microsoft for Startups Founders Hub.

22:49 Has, they have been recently big supporters of the show.

22:52 We really appreciate it.

22:53 And if you're out there either starting a business or want to start a business,

22:57 got to know that it's, it's not easy, right?

23:00 Within the first year, 90% of startups go out of business.

23:04 That's not amazing.

23:05 So the folks over at Microsoft for Startups set out to understand what are the problems

23:10 that people are running into and how could they help?

23:13 So they came up with Microsoft for Startups Founders Hub.

23:17 And the idea is that you get at any stage of your startup free resources to grow and thrive.

23:24 So you get thousands of dollars of cloud credits for things like Azure and GitHub and DeepMind.

23:33 So look, OpenAI, sorry.

23:38 For those types of things.

23:39 And as your startup grows and progresses, you get many, many more of those.

23:45 But you also get support in the form of mentorship and connections.

23:49 Brian, you're not in Silicon Valley, are you?

23:52 No.

23:53 Neither am I.

23:55 By choice, by the way.

23:57 And most people out there listening are not either.

23:59 But having the connections of like, hey, let's meet up with so-and-so for coffee and talk

24:05 about this new project and see if there's a connection there, right?

24:08 Like those, those kinds of things are incredibly powerful.

24:11 And they've given people in locations like that huge advantages.

24:15 So the other thing you get with this is access to a mentorship network, the ability to book

24:21 one-on-ones with meetings, one-on-one meetings with mentors, many of whom are founders themselves.

24:27 You can talk about things like marketing or fundraising or whatever you need.

24:30 So if you want to get started, make your dream, your company a reality today with the critical

24:36 support you get from Microsoft for Startups Founders Hub.

24:38 You don't have to be third-party validated.

24:42 You don't have to be venture-backed or part of some kind of accelerator.

24:45 Just go and apply for free.

24:47 PythonBuy.fm slash Founders Hub 2022.

24:50 Link is in your show notes.

24:51 Check them out.

24:52 Very cool program.

24:54 Very cool.

24:55 Indeed.

24:56 All right.

24:58 Ready for some awards?

25:00 Got the red carpet out.

25:02 The champagne.

25:03 More champagne.

25:03 There's some kind of theme with that here.

25:05 Celebration.

25:06 Yes.

25:07 Let's talk about the Bossies.

25:08 So the Bossies, this is InfoWorld's 2022 Bossie Awards.

25:14 Celebrate the most important and innovative solution for application developments, DevOps, analytics,

25:20 and what year.

25:21 So let's go.

25:22 These are open source.

25:24 Best open source software.

25:26 I was like, where does Boss come from?

25:28 Okay.

25:28 Exactly.

25:29 There's a bunch that are interesting, but we'll go through.

25:32 You can't go through very fast.

25:34 There's like a delay.

25:35 Yeah, I guess.

25:36 So you pay attention and you actually take it in.

25:39 So maybe really quick, just because it's the first one, is there's Alma Linux, which is a free Linux OS for the community, by the community, that is like an enterprise Linux distribution focused on stability.

25:51 So that might be cool checking out.

25:53 I know a lot of people do things there.

25:55 You have to bear with me as I make my way through this thing, is it won't let me go any faster.

25:59 Well, let's do the first one.

26:02 There's a lot of Java in here, actually, which we'll get back to in a joke later.

26:06 That'll be fun.

26:07 Like Jhipster.

26:09 I mean, greetings, Java hipster.

26:11 That's a pretty awesome project.

26:14 Java hipster.

26:15 That seems sort of anachronistic.

26:19 You know, you got to, this is part of that self-talk thing where you like try to talk yourself up a little.

26:25 All right.

26:26 Maybe number one that I want to give a shout out to, number one, as in number 10 in the list, is WASM time.

26:32 A fast and secure runtime for WebAssembly outside of the browser.

26:37 So if you think about what Node.js did for JavaScript, like JavaScript used to be this thing you did on web front ends.

26:43 And then somebody said, if we rip that engine out, it could be a server-side technology or a client-side technology that is not in a browser at all.

26:51 But just, it becomes a programming language, as long as we have a runtime that everyone likes and works with.

26:56 Well, this is like that, but for WebAssembly, right?

26:59 And so what's interesting is if you want to go and run a Python code and you don't want to worry about making sure Python is set up and all those things, you could just get, say, something like PyScript and ship it to run on top of WASM time.

27:18 And there you go.

27:19 So you just say WASM time and then some WASM output, which could be, you know, your code.

27:26 And let's see if they have over here on PyPI, we have WASM time 2.0, which is the Python embedding of WASM time.

27:33 So there you go.

27:34 Take your Python code and off it goes.

27:36 That's pretty cool.

27:38 So, Michael, what time is it?

27:39 It's WASM time.

27:40 It's WASM.

27:41 I'm like, wait, what?

27:43 It's WASM time.

27:44 It is.

27:46 Oh, awesome.

27:47 Yeah, so you just write your code in Python and then you could go and run it, which would be pretty excellent.

27:53 Also, something interesting about WASM is it allows for interoperability.

27:58 So if I wanted to do C, .NET, Python, and Rust, have those all talk together because, I don't know, I couldn't decide or I don't know, whatever reason, right?

28:10 You could have them all converted to WASM and then integrate there as well.

28:14 So there's some pretty interesting runtime and deployment things here.

28:18 Anyway, so that was one of the winners.

28:20 Right behind it, one of the biggest winners in our world has got to be PyScript, right?

28:25 Yeah.

28:25 Let's go look at it on the list.

28:27 Yeah, it is.

28:29 There's a bunch of stuff here that I don't care about.

28:30 But number 14, Sentry.

28:32 Nice.

28:33 Error monitoring.

28:34 I was just using this to track down some errors that I introduced with trying to run Python 3.11 and Beanie before it was time.

28:46 But it told me exactly what was going on and I figured, okay, that's a motor problem.

28:49 I was able to track that down, which is pretty excellent.

28:51 Let's see a few more here that are fun.

28:57 In BDEV, if you're doing notebook stuff and you want to be able to test your notebooks or clean them up before you check them in, or you want to turn notebooks into a Python package where certain actions in a cell become functions in your Python package and deploy it to PyBI.

29:15 All those crazy things in BDEV.

29:17 So those are pretty interesting.

29:19 Accelerate.

29:21 I think this is from Hugging Face, but I can't quite tell.

29:24 Yeah, it is Hugging Face.

29:26 That's what it is.

29:28 It's a way to build, train, and deploy state-of-the-art models powered by open source.

29:35 Yeah.

29:36 So anyway, it looks interesting if you're into that.

29:39 Stable diffusion.

29:40 Do you need to have a bear that has just landed on the moon?

29:44 Well, go in there.

29:45 You can create those funky AI art things.

29:50 Anyway, there's a bunch of fun projects in this 2022 Bossies Award list.

29:56 Yeah, that's pretty great.

29:57 Yep.

29:57 All right.

29:59 Yeah.

30:00 Well, Scott, it's wasm time.

30:03 It's wasm time.

30:04 Yeah.

30:06 We talk about Will McCoogan a lot and textural and stuff.

30:11 And Will's in the audience.

30:12 Hey, Will.

30:13 So one of the things that if you follow Will on Twitter, he shows a whole bunch of cool

30:16 examples of stuff he's working on, but you haven't been able to play with it because he's

30:22 been sneaky about it.

30:24 And it's been on a, well, it's not sneaky, but it's been on a CSS branch, different branch

30:28 of their code base on textualize or textual.

30:33 So now we can play with it because as of what, October 22nd, textual 0.2.0.

30:43 Wow.

30:43 Big jump in numbers there, guys.

30:45 But it released and it has all of the CSS branch stuff merged in.

30:51 So all the really cool, fun things that you can do that looked like web development and,

30:55 but they're in a CLI.

30:58 Now I can start playing with them because they merged in.

31:02 One of the things that I'm glad that they waited a little while for because they were looking

31:08 for API stability, but also they wanted to finalize the documentation at the same time

31:14 before they released it to everybody officially.

31:17 So they've got a tutorial written, which is really kind of nice.

31:21 It's a little stopwatch application that kind of walks through and it walks through all the

31:26 different pieces of, of how you, how you use textualize and with their CSS.

31:32 And it's got going through writing through the CSS, the dynamicness of it, reactive attributes.

31:39 This, this really looks great.

31:42 I haven't gone through it yet, but it looks awesome.

31:44 And then, and then they went through and updated the textualize guide, which has, you know, it goes,

31:51 goes through all the different examples.

31:53 And I've got my screen shrink up too far, so it doesn't show everything.

31:57 But anyway, really great stuff in this, in this, this manual.

32:01 Good job guys.

32:03 Yeah, that looks awesome.

32:04 So I can't wait to play with it.

32:06 Yeah.

32:07 Who knew that we could treat, treat terminals as high refresh rate, general rendering engines.

32:14 It's, I feel like the stuff that Will and crew are highlighting here is a little bit like

32:21 what you could do with JavaScript canvases, right?

32:23 You're like, oh, guess what you could actually do, which is, you know, like our software here, StreamYard, that we're using to live stream this, right?

32:30 It's like, who would have ever thought you could have done this with just a web browser

32:33 without plugins, right?

32:34 And here we are.

32:35 And I also just heard Will talking about this on ChangeLog just recently.

32:42 One of the more recent ChangeLogs was talking about this release, which is pretty cool.

32:46 Although, Will, I got to say I'm a little disappointed.

32:50 Because they asked how you became rich and textual have gained so much popularity so quickly.

32:59 And you didn't even mention us.

33:00 Just come on.

33:02 Anyway.

33:02 Cool.

33:09 Anyway, that's it for our items.

33:13 And since I've been kind of under the weather, I don't have any extras.

33:16 Do you have any extras for us?

33:18 You know that I do.

33:19 I've got a bunch of things.

33:20 I'll go quick through them.

33:21 So I recently did a fun video.

33:24 I know that guy.

33:25 Yeah.

33:26 I did a video where I added, I did the live coding on Talk Python Training, actually adding

33:34 the feature for the search over here.

33:36 So I rewrote the search.

33:37 You pointed out that pytest is a fun thing to type in there, right?

33:42 pytest is good.

33:44 You might search for Postman, Ingrok, and you get your search results there.

33:50 Got this cool hierarchy thing.

33:52 But when I first wrote that, it was super slow.

33:55 And the techniques that I used to debug that, figure out what's going on, make it faster.

34:00 The video says 17, but in an extreme case, it was actually 80 times faster.

34:04 There's just some really cool techniques of walking through like, oh, how could you like

34:07 use logging in the database to figure out what's happening?

34:10 How could you use the profiling?

34:12 How do we use dictionaries so that we can convert like 100 database calls into one, even though

34:16 there's like a, not a natural join story going on.

34:20 So if people want to follow, go check out that video.

34:23 That's lots of fun in the show notes.

34:25 From, let me get the name right here.

34:28 Also from Ryan Scheftel.

34:30 If you're into stock markets and so on and you want to use Pandas, here's a project called

34:40 Pandas Market Calendars.

34:42 It's the market calendars used with Pandas for trading applications.

34:45 So it has things like, when are the markets opening and closing?

34:49 Is there a holiday?

34:50 Is there some other weird event that's changing the start to close time?

34:54 Right.

34:55 So just a cool little library to bring that into your Pandas code.

34:58 And I believe Pandas came out of New York and the whole trading industry over there.

35:03 So that's good.

35:04 Shout out for Roman Wright, who is out in the audience.

35:08 Hey, Roman.

35:09 We recently, so when Beanie came out, Beanie's fantastic.

35:12 MongoDB library, you know, what FastAPI did for APIs, Beanie does for MongoDB, right?

35:18 It takes Pydantic and turns it into a really cool API that then you use instead of creating

35:24 just classes or whatever, right?

35:26 So all the benefits of having Pydantic plus MongoDB.

35:29 And when it came out, it was only async, which is awesome when you're doing async stuff,

35:33 right?

35:34 Without it, you can't do all the really high scale, high concurrency things.

35:38 But there's plenty of times where you're like, I don't want that.

35:41 I just want to call this function.

35:43 And I'm in the middle of a script that has no business being async, but you gave me an

35:47 async only function.

35:48 So now I got to figure out how to like spin up a loop and run this thing and wait for it

35:53 when I just want to call the function.

35:55 So in addition to the standard async model, Roman added a Beanie.sync submodule where you

36:03 can get async document and you get a, you can initialize a synchronous database,

36:08 connection.

36:09 And then all of your queries and everything become just straight up synchronous calls,

36:15 like on more traditional database engines or database ORMs, ODMs.

36:19 Okay.

36:20 Yeah.

36:20 So excellent work out there.

36:22 It's a good job keeping up on that.

36:25 It's a cool product.

36:26 Yeah.

36:27 It's super cool.

36:28 Yeah.

36:28 I love it.

36:28 DuckDuckGo has released a web browser.

36:33 Just when you thought Chrome has taken over everything, DuckDuckGo says no, or they quacked

36:38 no, or whatever DuckDuck does when they communicate.

36:41 And right now it's Mac only, but it's coming out for Windows pretty soon as well.

36:46 And it's a privacy focused database.

36:49 Web browser.

36:51 Yeah.

36:52 Yes.

36:52 Sorry.

36:53 I said database.

36:53 Yeah.

36:53 Web browser.

36:54 But let me, let me show you.

36:57 I can even show you real quick.

36:58 Here it is.

36:59 But did you install it?

37:00 Oh, of course I did.

37:02 Why wouldn't I do that?

37:03 Here it is.

37:05 So we go over here.

37:06 We can go to pythonbytes.fm.

37:09 And if you pull this up, why not?

37:12 Didn't add to stream.

37:13 There we go.

37:13 But come over here to Python Bytes.

37:15 And you can click on this.

37:17 It'll show you where all the tracking is.

37:18 Like notice, no Google Analytics, no other tracking.

37:21 But where shall we go?

37:24 We have somewhere super egregious.

37:26 We could go to CNN.com.

37:28 And remember, this is using already NextDNS and other blocking.

37:33 So a lot of the blocking happens before it gets here.

37:35 But if you pull it up, it'll still say, look at all these different things we blocked.

37:39 And here's the tracking.

37:41 Here's the advertising.

37:42 Again, many of these are already blocked before it gets to the network.

37:47 So it'd be 30 or 40 easy.

37:51 So that's pretty cool.

37:53 But I don't know.

37:56 I'm not switching over to it yet.

37:59 Hopefully they can do better.

38:00 You can't do things like set your DNS servers for, say, DNS over HTTPS.

38:05 So you can have more control over that.

38:07 There's a lot of things that are not there.

38:10 It has a really cool way to play YouTube videos in a private window.

38:13 So if you go over to YouTube and you hit play, it'll, would you like to play this in a non-tracking,

38:18 non-algorithmic feeding sort of way?

38:21 Which is great.

38:22 But you know what you have over on YouTube?

38:23 Hotkeys.

38:24 I can type F for full screen or T to like go wide theater mode or I for mini player.

38:29 It doesn't have any of those types of things.

38:31 Right.

38:31 And so it's like super, super early.

38:33 But in that regard, I'm not really liked or recommending it.

38:37 But it's awesome that they're trying.

38:39 I like DuckDuckGo.

38:40 I'd like to see them make progress here.

38:42 And they have the fire button, which you can just clear all the stuff up and get a cool animation.

38:47 What does that do?

38:49 Just close it up?

38:50 It erases like all history and closes all tabs and everything.

38:54 Oh, cool.

38:55 Yeah.

38:55 Anyway, there you go.

38:57 I think I've got one more thing to share, but I've got to share my screen back because of that.

39:03 Nabbed it.

39:04 Yeah.

39:06 Last one here before we get to a joke.

39:08 So I want to give credit here.

39:11 This one comes from Will Shanks.

39:12 Remember when we talked about int, like I-N-T parentheses, some string, like quote, one, two, three, close quote.

39:20 Okay.

39:20 That had a security patch in Python 3.10.7 because if you send it right, malicious, huge number string, it can get into like some denial of service where it like works for an insane amount of time trying to figure out what that number is by parsing it.

39:36 Not just a big number, but like a specifically bad big number, I think was the problem.

39:40 So in 3.10.7, they said, you know what?

39:44 We're going to limit the size of int to, I don't know, like 94 with 100 zeros or something after it, right?

39:52 At the time, you and I spoke about, remember when we did C and C++ and C# and we had to think about shorts and, you know, 32-bit integers and 64-bit integers?

40:04 And would it be bigger or smaller than 32,000?

40:07 Do we need to worry?

40:08 And like that number is so huge, like we probably don't think about it.

40:11 Well, some people do, in particular, the scientific folks.

40:15 So over on CondoForge, there's a big conversation about what to do here.

40:19 Like, should we adopt this?

40:21 Should we say this is like too much of a problem?

40:23 I mean, I don't really know how they're going to avoid eventually adopting it.

40:27 Because like every version of Python going forward is going to have this in it, right?

40:32 They don't want to eventually like permanently be held back.

40:35 But on the other side, the, what's it, Ubuntu?

40:39 Let me look.

40:40 Yeah, Ubuntu has decided to patch out that int limit.

40:44 So basically unravel that security fix and preserve the behavior, previous behavior, thinking that the risk is low of getting an integer like that.

40:54 And it's not worth breaking compatibility for.

40:56 Okay.

40:56 So apparently, int, open parenthesis, string, close parenthesis is still controversial.

41:02 Who knew?

41:03 Who knew?

41:04 Not me.

41:04 Yeah.

41:04 Not me.

41:05 Yeah.

41:05 All right.

41:07 Let's see.

41:08 Robert Robertson asks, in Python Bytes episode 311, is that going to be a special episode covering Python 311?

41:18 I don't know, but we got five weeks to figure it out and it's a great idea, Robert.

41:22 Thank you.

41:22 Sure.

41:23 Good idea.

41:24 I didn't see that coming.

41:25 Yeah, we should have coordinated with the Python folks.

41:27 We could have just released like five really short episodes.

41:30 Like, still waiting.

41:31 No, skip to the next one.

41:33 All right.

41:34 Well, that's all I got.

41:35 That's all I got for extras.

41:37 Well, one of the things I want to extra from the audience.

41:40 is Dean Langs.

41:43 I did a T-L-V.

41:45 Tel Aviv.

41:46 Tel Aviv.

41:47 It's on December 13th.

41:49 And they have tickets.

41:50 They have tickets up for sale.

41:51 And there's a code.

41:52 So if you use discount code BYTES, you get a discount, I guess.

41:59 So that's nice.

41:59 Awesome.

42:00 Awesome.

42:00 Yeah.

42:01 Good luck with the conference there, Dean.

42:02 And how about-

42:04 Lovely city to visit if you get a chance to.

42:05 Okay.

42:06 Cool.

42:06 How about something funny?

42:09 Yes.

42:10 All right.

42:11 Besides my voice.

42:15 Here we go.

42:16 See if I can open the image.

42:17 It's own glorious.

42:19 So, Brian, I was thinking about getting a new monitor.

42:21 I have a fine monitor.

42:22 It's like a 32-inch 4K monitor.

42:24 But I want something kind of widescreen.

42:26 There was this cool, like, horizontal resolution equivalent in 4K.

42:31 But it was 40.

42:32 It was either 40 or 49 inches wide.

42:34 It was epic.

42:35 But I didn't get it.

42:36 So I didn't get it because I thought the curved monitor might be like parabolic echoes

42:43 for all the work that we do here.

42:45 And I also didn't get it because, well, it's expensive.

42:48 And I don't know if I can get it into the resolutions I want for recordings and things like that.

42:52 But here's somebody who posted a picture.

42:56 It says, develop in Java, be like.

42:58 And it's got, I think, that's a 49-inch curved widescreen monitor.

43:02 Small font.

43:04 And it's edge to edge code.

43:07 There's no PEP 8 ideas on this, right?

43:09 Look at that.

43:10 Is that nuts?

43:11 That is nuts.

43:12 Yeah.

43:13 Yeah.

43:13 Yeah.

43:14 And the subtitles be like, I heard you like getters.

43:17 Which apparently, you know, no properties and all that.

43:21 Yeah.

43:22 But anyway, I just thought you all might enjoy just checking out this picture of an insane

43:27 bit of code.

43:28 Like, something's gone wrong.

43:29 When you need, you actually need the full width of a 49-inch monitor.

43:34 I was thinking of putting a couple windows side by side.

43:36 I don't know.

43:37 Call me crazy.

43:38 I didn't have measured mine.

43:40 I think mine's like, I'll have to measure it.

43:43 I think it's like 30-something.

43:44 I don't know.

43:45 But it's got a bit of a curve.

43:48 Nice.

43:49 I have to.

43:50 I have to.

43:50 I, it's painful to watch that.

43:52 And I'm not going to throw rocks at this glass house because I'm a C++ developer.

43:57 And we've got a few pieces of gnarly code that have big long lines.

44:02 Yeah.

44:03 For the multiple inheritance, multiple template.

44:08 Oh, yeah.

44:10 And also just bad naming sometimes.

44:13 And that happens in Java too.

44:15 You've got big long names.

44:16 Well, the problem is you've got to get a name something.

44:19 And then you've got to have a factory something.

44:22 And you've got to have an iFactory interface of that something.

44:25 And you've got to mock it out.

44:27 Anyway, it gets complicated and the names get long.

44:29 I understand.

44:30 And you have to get a mock factory and a name factory and a factory factory.

44:34 That's right.

44:35 If it's not, the audience has identified the coding style here as a PEP infinity instead of PEP 8.

44:44 That's PEP infinity code.

44:46 PEP infinity.

44:47 Yeah.

44:47 Well, this was infinitely fun.

44:49 Thank you, Brian.

44:50 And thanks, everyone, for being here.

44:51 Thank you.

44:52 I'll talk to you later.

Back to show page