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


Transcript #354: Python 3.12 is Coming!

Return to episode page view on github
Recorded on Tuesday, Sep 26, 2023.

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

00:06 This is episode 354 recorded September 26th, 2023.

00:12 I'm Michael Kennedy.

00:13 And I'm Brian Okken.

00:14 I am good.

00:16 It's been a busy week and it's only Tuesday.

00:18 I know.

00:19 And it's, it's starting, starting strong.

00:21 If you want to follow the show, stay in touch with us.

00:23 be sure to check out Bastadon over on Mastadon.

00:27 We've got all the links for that in the show notes.

00:29 I was just thinking today, I just booked a couple of episodes through Mastodon for Talk Python.

00:35 I just was working on another video presentation thing on Mastodon.

00:41 How much work gets actually done on Mastodon?

00:43 So people should be there with us, Brian.

00:46 Yeah, I think so.

00:47 Yeah, for sure.

00:47 It's the place where all the cool kids are.

00:50 Indeed, indeed.

00:51 So hopefully you'll connect with us over there as well.

00:54 Very exciting stuff.

00:56 See some people in the audience here.

00:57 you're going to have to give them a shout out later, because some things that we're sharing.

01:02 And so that's going to be very exciting.

01:04 So speaking of exciting, what's the first thing you got for us?

01:07 - I, I'm actually really excited.

01:10 I may be jumping the gun on this, but Log Merger is from Paul McGuire and it's a project he's working on and it's pretty fun.

01:20 It's a, so I don't know, maybe I'm not, I think more people, a lot of people deal with log files but they have to deal with more than one.

01:28 So you have maybe two processes or three that are all timestamping and saving.

01:33 Well, so this is a project that is a textual-based project, but it combines them all and sorts the multiple logs based on timestamp.

01:46 So you've got, maybe you've got a timestamp and then content, and it splits it out and shows you the timestamp on the left and then the different log files in columns.

01:59 The example just shows two, but I think you can pass it more than two.

02:03 I think you can do multiples.

02:05 It's called log merger, but I don't know if it actually merges them, but it makes this combined output thing and it's really fun.

02:14 >> It's more look at them in what a merge view with timestamps would look like rather than actually about trying to unify them or something.

02:22 >> I had some concerns right away, and they were already like, I downloaded it and I'm trying this out.

02:29 The, you can pipe the output to standard output or you can use the textual thing.

02:34 So you can do either one.

02:36 So the output is nice, but sometimes, you know, log files can be huge and you only want to look at a part of it.

02:41 So there's a cool, there's some nice flags that they're included.

02:45 There's a start and end timestamp.

02:47 So where you can say, yeah, start here and then go to here and don't do the rest of it.

02:53 There's an interactive mode, which is I think the default.

02:55 Yeah, that shows you the little TUI and you can do error boxes and stuff.

03:00 You can save them to a CSV.

03:02 I don't, I think that'd be great if you want to throw it in Excel or something like that.

03:06 And then multiple timestamp formats are supported.

03:09 So you've got like, there's a handful that I think this is pretty good.

03:15 This is the standard ones.

03:17 I didn't even pass in a timestamp when I tried it out and it just worked fine.

03:21 So I'm gonna be using this a lot.

03:23 I'm excited about some of the upcoming work.

03:27 So there's possibly, oh, maybe it's not here, but somewhere else.

03:32 There's a possibility of using PCAP files.

03:35 I think that's in working on, those are, I don't even remember what that stands for, but I deal with them for protocol analysis.

03:43 But I maybe jumped the gun because you can't pip install it yet.

03:49 You have to, right now you download the code, but it's totally usable and runnable.

03:55 So I think it's worth checking out, but it's, oh gosh, it's new.

03:58 It's like--

03:59 - You probably could pip install with the git flag.

04:01 - Oh yeah, with the git plus, exactly.

04:04 - Yeah, with the git plus, exactly.

04:06 - I forgot about that.

04:07 So you can do, yeah.

04:08 So I guess, Paul, people are using this, at least I am already.

04:13 So maybe like a little, maybe I'll do a merge request to add the readme to say how to install it for now.

04:19 So cool fun.

04:20 >> Yeah, nice.

04:21 Prior guest on the show, Seth Michael Larson says, "Whoa, packet capture files." Is that the accentuating for it?

04:28 That's awesome. I need to check that out.

04:29 >> Yeah.

04:30 >> Jeff out in the audience says, "Does it support time zones?" It does have a time zone display feature, but I don't know if the sort considers time zones or not.

04:41 >> Well, my thing is going to be that they're going to be a little off anyway, because sometimes the different, I've got log files getting generated by multiple computers that are the timestamps off by a little bit.

04:55 But it's close.

04:56 It's usually close enough to line them up.

04:58 - Yeah, close enough.

05:00 Yeah, I do stuff like this as well, like for all the talk Python web properties.

05:06 You get lots of requests and the Nginx files have like a two week rolling average.

05:12 The most recent one is a straight log file, what the rest are g-zipped by day.

05:18 God.

05:19 Okay.

05:19 So I have a Python script that downloads all of those unzips, the ones that are zipped, put some altogether, then loads all of those files, sorts them by timestamp, and then like creates one super log file, maybe a pending onto a previous one.

05:34 So I have like single log text log files that are the full month, month by month for analytics, because you know, we turned off Google analytics and all the sorts of other things because those are evil.

05:43 Yeah.

05:44 But you still want to know like, well, how many requests were there to this page or to this episode page or like where, you know, stuff like that.

05:52 Right.

05:52 Those, those kinds of things are relevant.

05:54 So yeah, this is, this looks interesting.

05:56 I had to write a bunch of code to do similar stuff.

05:59 Although for 14 log files, you wouldn't try to visualize them.

06:02 You want to, I just want to turn them into one mega log file so that I can run analytics across them.

06:09 It's not on this readme, but I think when I was looking at it, I think there's recent stuff being done.

06:14 And I think that you can pass it gzip files.

06:17 I think it pulls them out.

06:19 - It seems reasonable.

06:20 Those are frequent formats, I suppose.

06:23 - Anyway.

06:23 - All right.

06:24 - Cool.

06:25 - Good find, a very interesting one.

06:26 People in the audience like it as well.

06:27 This next one comes to us from Hugo VK, and not sent in, I just discovered it, I believe.

06:34 It says, "Hello, Python library maintainers.

06:36 "So if you have a PyPI thing, If you twine or what upload those types of things, you probably want to pay attention because I said, because everyone was so good at finding bugs last time in the Python 3.11 release candidate.

06:52 The third and final release candidate is now out.

06:55 Please give it a spin.

06:56 It's your last chance to find, significant problems, right?

07:01 Critical problems.

07:01 And goes on to point out here is a nice article on how to test it, how you can and get the release candidate.

07:08 And basically, how do you test your libraries with this?

07:12 And it goes through, like, how do you set up a GitHub action so that it will use the 3.12 prerelease, right?

07:19 How do you do it from Dead Snakes?

07:20 How do you do it for Travis CI or other CIs and different things in here?

07:24 So that's cool.

07:25 That'll help some people set it up into their CI.

07:28 There's also a big, long discussion here.

07:31 So Thomas Worters points out that release candidate 3 here as a reminder until the final release of 3.12.0, the release 3.12.0 branch is set up so the release manager has to merge the changes.

07:45 Reach out at this point unless something critical comes up, it should really only be documentation.

07:51 Other changes will be pushed to 3.12.1.

07:54 Somewhere in here, there is the intent.

07:58 This is exciting. The intent is for the final release of 3.12.0 scheduled for Monday, October 2nd.

08:05 That is like the coming Monday.

08:07 Yeah.

08:07 Unless you, if you're on top of your Python bytes playlist, don't let that thing fall behind then the coming Monday, October 2nd is going to be when this thing releases.

08:18 So that's pretty excellent.

08:19 I guess bringing back to the first part, this is basically, you have a couple days to make sure that your library will have no hiccups when Python 3.11 ships.

08:29 So, or C312, kind of gets used to saying 312.

08:32 When that ships in a week, you want to make sure that your stuff just works.

08:36 So here's your chance and a few steps on how to do that.

08:39 - Yeah, because you know how nice people are in GitHub.

08:42 You'll get issues right away.

08:43 Hey, your stuff doesn't work on 312.

08:45 (Lyle laughs)

08:47 - You might even get like some hot October amazingness, like, "Hey, you were using the wrong preposition here.

08:53 I changed it." Like, "Well, that was not wrong, but this is not a real commit." Seth is back to say, "Highly recommend the setup Python allow pre-releases feature.

09:02 That lets you set up a forever pre-release testing job if you use Python version 3.x." That's pretty good advice there.

09:11 Yeah, cool.

09:11 >> Neat. I don't think I use that. I'll have to check it out.

09:14 >> Well, now you know you can.

09:16 >> All right.

09:17 >> All right. What else you got that is exciting for us?

09:19 >> Okay.

09:19 >> What other good advice do you have?

09:20 >> What do I got? I got, oh, good advice.

09:26 I think I have questionable advice, but I like this pattern. So I'm linking to James Coffee Blog with the Python dictionary dispatch pattern. And I just like this because I don't know if it's not discussed much in like beginning teaching Python stuff as to, but you know, if you're a C programmer, use jump tables, or maybe you shouldn't use jump tables, but jump tables are fun in C. And you can kind of use them in Python too, but they're a little bit easier to use. You just have dictionaries.

09:58 Dictionaries can store anything and they can include functions. So he has an example of just add, subtract, and multiply, which you wouldn't really use for that, but it's just an example.

10:09 And I kind of forget that you can throw lambdas in because you can assign the lambdas have a value, so you can put a lambda in as a function.

10:18 But you can use a function also.

10:21 And then you can call them later.

10:24 So you could just dereference the--

10:27 or dereference-- we're going to call it like that.

10:29 You look up the element in the dictionary and then actually just call it with parameters.

10:34 And it works.

10:35 So kind of a fun thing to do in Python.

10:38 Here's a little bit of a--

10:39 he said, as part of a VisionScript programming language does that interesting, but I mean, there's, there's a lot, there are times where you just have lots of things that you're switching on. And an easy way to do the switch is just to have a dictionary lookup. So yeah, exactly. That's it is pretty interesting. It's a traditionally it has been a way to do switch statements, which at the time, it was pretty much all you had to work with, right? Since then, we've had the match statement added to the language, right, which is a little bit better. So not switch but match because it's this whole parser mechanism on top of just the switch statement. But people used to traditionally say, okay, well, we'll just make a dictionary and then like your case is the key. And then what you do is the function that gets returned from that. One thing that's really missing from that pattern, that dictionary dispatch pattern is that the default case gets clunky looking, right? Like if, if none of the cases match, then what happens?

11:43 Like you just get none and exception, like none type is not callable or some weird thing like that.

11:48 Right?

11:48 Oh yeah, you do.

11:49 Yes.

11:49 So you could, you could upgrade it.

11:51 You could upgrade it with a default dict where the default dict returns the default case.

11:57 Right.

11:57 I, for a while, I don't remember when I added this, but I added switch Lang, which was fun and switch Lang, uses context managers to simulate a switch with a default case sort of thing.

12:10 Yeah.

12:10 Or Seth is pointing out, if you use get instead of a dictionary lookup, you can give it a default to return.

12:19 >> You can, but you got to give it the default every time you use it, which is you can, but it is a little bit weird.

12:26 That's why the default dict makes it a little clear, because if you're going to use it more than once, I don't know.

12:31 You use it more than once, it gets janky.

12:33 >> I've used this and I don't put a fall through.

12:38 But the reason is because it's all my code.

12:41 It's all, I don't, it isn't something that's coming in from the outside world.

12:46 And I have test cases around all paths.

12:49 So--

12:51 - Right, so you know there's not gonna be a missing case.

12:53 - Yeah. - And if you do, an exception's probably a good idea.

12:55 - It's not something you like, ask a user, which function would you like to call?

12:59 And then, you know, pass it through.

13:02 - Indeed. - Yeah, don't do that.

13:04 Anyway, oh, reason why I wanted to bring it up.

13:07 Not just because I didn't want to bring this up because I wanted more people to use Dictionary Dispatch.

13:13 You don't have to do that.

13:14 What I brought it up for, which is, it's still kind of cool to reference just to let people know you can do it, but this guy's got a blog roll.

13:22 How cool is that?

13:24 When's the last time you've seen a blog roll?

13:25 - Dude, a blog roll.

13:27 Yes.

13:28 - Should we bring blog rolls back?

13:30 I don't know. - Maybe.

13:31 - Maybe. - I don't know.

13:33 - Anyway.

13:35 - That was when your blog was - You're a little home on the internet.

13:37 - Yeah.

13:38 - Yeah, yeah, how interesting.

13:41 - There's no like hit counter though, so you know.

13:44 - Oh, does it have a little dig?

13:46 Like a little digging, this part is under construction, Digger.

13:49 - That'd be cool.

13:50 No, sorry James, if you're listening, we're not dissing you, it's just fun to see.

13:53 - No, no, no, it's awesome, it's nostalgia is what it is.

13:56 It is.

13:58 - So anyway.

13:59 - All right, back to the Seth Michael Larson show.

14:04 - Yeah.

14:04 His article is very timely that he just put out a little couple weeks ago, but I finally got around to featuring it now, given everything that's coming together, called Visualizing the CPython Release Process.

14:18 So it was awesome.

14:20 He's the Python Security Manager, Security Dev, as opposed to Mike Fiedler, who is the PyPI on both of these roles are somewhat new, which are awesome.

14:33 This one is made possible by funding from OpenSSF, Alpha Omega Project, so very, very cool.

14:39 And Seth is pointing out, Security Developer in Residence is the official title.

14:45 Yes, right there.

14:46 And then we also have the Developer in Residence, which is Lukas Schlenker.

14:49 So anyway, they planned out, or he went down and wrote out what it actually looks like to release Python.

14:56 And boy, oh boy, this is more than just some build CI at GitHub to make sure that the wheels or the binaries get built.

15:05 So here's the process.

15:07 See how close I can get this right.

15:08 And also Seth is gonna be on Talk Python on Thursday in terms of live stream.

15:13 And then a little bit later to talk about, we'll talk about this and a bunch of other security things.

15:19 Anyway, so start out, freeze the release branch, and then the CPython upstream repo goes along and the release manager forks the repo, takes that, feeds it into the release tool manually.

15:34 All these things have, there's a bunch of colors in this diagram.

15:36 So each color, there's a legend, like the yellow ones are human tasks, the blue ones are release artifacts.

15:44 Interesting from a security perspective, there's a source of risk is red and so on.

15:51 All right, so the release tool goes along and git commit, git tags things to set the tag to version 3.12.0.

16:00 Also, it creates the source ball, the tarballs from that.

16:04 And where are we going now?

16:05 We go over here to Azure Pipelines for the Windows people.

16:08 The Azure Pipeline, there's a Windows Release Manager.

16:10 The Azure Pipeline over there builds out the Windows embeddable packages, the Windows installers, updates NuGet, Windows Store, maybe even WinGet, I don't know about that.

16:21 There's also an equivalent for the macOS Release Manager who does the Mac build and Mac installer.

16:27 And all of these things come back into testing artifacts and creates the, they all get a GPG signature and then we get everything signed and ready to go.

16:37 That gets dropped on python.org.

16:40 Pretty cool, huh?

16:40 That is wow.

16:42 Yeah.

16:43 It's a lot.

16:43 Last year they live streamed this and all the people involved were on zoom.

16:49 I think it was, I'm not sure it was live streamed to YouTube though.

16:51 And you could actually see step by step.

16:54 So, but I don't know how well people really knew what was happening.

16:57 Or you can be like, all right, we're on step five, everyone.

17:00 Let's go, let's go.

17:01 So I think, you know, if you're going to watch that live stream, if it exists, I'm not sure it does.

17:05 people in the audience, if they know it's going to be live streamed, shoot out a message.

17:10 yeah.

17:11 Okay.

17:11 So too early to, I don't want to slow down the release this year, but maybe next year we can have this graph, but like animated with like little things, what's going on.

17:21 Yeah.

17:21 I have like little, little, video cutouts of people in the different sections and they're talking.

17:27 Yeah.

17:27 That'd be fun.

17:27 Why not?

17:28 Why not?

17:29 No, this is cool.

17:30 And then there's more about, there's like a more of a description below that Seth put together as well as the sources of supply chain risk and examples of that happening outside of Python primarily.

17:41 so pretty cool.

17:43 thanks for the, the visualization, Seth.

17:46 This is great.

17:46 Yeah, this is cool.

17:47 Nice.

17:48 Yep.

17:48 Over to you.

17:49 no, wait, that's it for.

17:51 I'll read for extras.

17:52 We are in extras.

17:53 Do you want to do your extras first or?

17:55 Yeah, sure.

17:56 They're easy.

17:57 I'm going to be at PI bay over in San Francisco, October 8th.

18:01 So all I want to say is if you're around, come say hi.

18:04 Right.

18:04 That's like primarily the reason that I go to conferences.

18:07 I don't go to that many talks or that many other things, but these kind of like get to know people in open spaces and so on.

18:13 So this is all one giant open space, this PI bay thing.

18:18 Yeah.

18:18 I went last year.

18:19 It was fun.

18:19 Maybe we should just bounce back and forth and do every other.

18:21 Yeah, absolutely.

18:22 the HTMX plus Django course is going really well.

18:27 People are loving it.

18:28 So if you want to do HTMX with your Django code, it will make it so much better.

18:33 Like you don't have to do front end frameworks unless you really, really want to.

18:36 so HTMX is awesome.

18:39 This is how I use it with Django.

18:40 Each framework has its kind of own thing.

18:41 The reason I bring this up is we're closing in at the end of the early bird discount.

18:47 So if you think you're going to get it anyway, you've got until September 29th until the price goes up.

18:53 A few more days.

18:54 So check that out.

18:54 Yeah.

18:55 That's it for my extras.

18:56 Nice.

18:56 I'll try to go through mine a little quickly.

19:01 Anyway.

19:01 of course the complete PI test course, I did just updated, part three is started.

19:09 It's, not part three, part two, I've started with chapter seven, testing strategy.

19:14 So that's going along strong.

19:15 I wanted to mention some podcast names.

19:20 So of course, you're here with Python Bytes, that's us.

19:24 My other one, a couple others, Python People, I've got a lot of great interviews coming up.

19:31 Then Test & Code is now Python Test.

19:34 So you get that just here, we have Python Bytes, Python People, and Python Test.

19:38 Then now, Talk Python to Me is the odd man out, so we have to get Michael.

19:42 You got to change your name to Python Talk.

19:44 Python talk.

19:45 Yeah.

19:46 Python talk.

19:46 Anyway, I could do that.

19:49 I could change it.

19:50 I can change whatever I want.

19:51 It's, it's working great.

19:52 Don't change it.

19:53 If it's not broken, don't fix it.

19:55 No, it's going pretty good.

19:57 Speaking of broken, let's talk about the final thing.

20:00 A joke here.

20:01 Okay.

20:02 Maybe this has happened to you.

20:03 Here's a, a woman developer trying to sleep, but her mind is running and she's like, okay, mine stop.

20:11 I need to sleep.

20:11 Leave me alone.

20:12 There's like a little conversation, brain woman in bed, right?

20:16 It says, Hey, are you sleeping?

20:18 Yes.

20:18 Now shut up.

20:19 She says to her brain, the brain says, I know how to fix the bug online.

20:22 255.

20:23 Boom.

20:24 Eyes wide open.

20:25 No more sleep.

20:26 I can't sleep.

20:27 We probably all been there, right?

20:30 You're just like somewhere else.

20:31 You're like, I know what it is.

20:32 I know what it is.

20:33 Yeah.

20:34 So this one, I've got the database index.

20:36 No, it's one of the downsides, but also one of the upsides of working, being, having a setup for working from home so that you can just run in and actually fix it and then go back to sleep.

20:45 Right.

20:46 Or you can sleep at your desk.

20:47 And then when this happens, you just wake back up.

20:48 It's keep typing.

20:49 Okay.

20:52 There we go.

20:52 Awesome.

20:55 Well, I mean, I have a standing desk.

20:57 Why not?

20:58 A like a sleeping desk though?

20:59 Yeah.

21:00 Why?

21:01 You know, it goes, they go from sitting to standing and it could just go one more level and you're like a lazy boy just drops you into like sleeping position.

21:08 Yeah.

21:08 with the lazy boy.

21:09 That'd be awesome.

21:10 Noise kicks in as it gets below a certain height.

21:12 Yeah.

21:13 Monitor goes up to the ceiling.

21:14 Exactly.

21:16 Yeah.

21:16 Be good anyway.

21:17 All right.

21:17 well, awesome podcast again, Michael.

21:20 I think.

21:21 Thank you.

21:21 Thank you as always.

21:22 And thanks everyone for listening and some of you for attending.

Back to show page