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


Transcript #386: Major releases abound

Return to episode page view on github
Recorded on Tuesday, Jun 4, 2024.

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

00:05 This is episode 386, recorded June 4th, 2024.

00:11 I am Michael Kennedy.

00:12 And I am Brian Ockin.

00:14 This episode is brought to you by Mailtrap.

00:18 I want to tell you more about them later.

00:20 And I also want to let you know that you can find us over on Fostadon.

00:24 We are Fosstodonians, as we've said before.

00:27 If you want to talk to us on Mastodon, the links are in the top of your podcast player show notes.

00:32 We're also on X, but do a little bit more stuff on Mastodon.

00:36 So check us out there.

00:37 Also, you can find us streaming live at exactly this time right now, Brian.

00:43 Finally, which is usually 10 a.m. Pacific time on a Tuesday.

00:49 So just pythonbytes.fm/live and you can be part of the live show.

00:52 If you want, watch the older videos there if you like, or just subscribe in your podcast player.

00:56 We really appreciate that.

00:57 Finally, interest in our email that you've been writing.

01:00 There's a lot of people signing up for it, Brian.

01:02 So if you want an artisanal handcrafted digest of the show in written form, just visit pythonbytes.fm.

01:08 Click on newsletter right there in the center and enter your email address.

01:13 We won't share it, but we will send you an email after every show about what we covered.

01:18 So you have it saved if you like.

01:19 Yeah.

01:20 Yeah.

01:20 All right.

01:20 You want to kick us off, Brian?

01:21 I will.

01:22 So this comes as a suggestion from somebody and I am sorry I didn't write the name down.

01:28 So thanks.

01:29 We do love it.

01:30 I love it when people share important news with us and say, hey, you really should cover this because it's important.

01:37 Thank you for that.

01:38 So what am I talking about today?

01:39 I'm talking about NumPy 2.0.

01:41 And I don't, I was searching for it.

01:44 I thought we'd covered some of the changes in NumPy 2.0, but I don't know if we have.

01:48 So NumPy 2.0 has been in the works for a long time.

01:52 And the reason why I'm bringing it up right now is because the release date is June 16th.

01:56 It's right around the corner and NumPy is both, even you're probably using it.

02:02 I guess I'll just say that you're, if, even if you're using any data science or any, any machine learning or something, you're probably using it, even if you don't use it directly, but you probably are using it directly.

02:15 Anyway, lots of changes to the 2.0.

02:18 We're linking to an announcement.

02:20 We've got the main page, numpy.org announces it.

02:24 You can just go there if you want.

02:25 But there's also a news item for the release for the June 16th.

02:29 There is some cool migration guide.

02:31 So I'm not going to go over some, a lot of the details, but there are some breaking changes with this.

02:37 So I'll go over a few things.

02:40 First off, went over and looked at the migration guide.

02:43 Let's see the release note.

02:44 Migration guide.

02:45 I thought this was super cool.

02:46 So the migration guide is around to help you go through, navigate some of the changes that might be, might be the, the most,

02:55 problematic.

02:56 But one of the cool things is rough is helping out.

03:00 So if you're using rough greater than version 0.2.0, you added a rule for NPY 201.

03:11 So, but you can just look at the migration guide and find this.

03:14 And you select this rule and run rough and it will, and they can just run check or you can just run rough to correct.

03:24 Rough is around to help you with a lot of the stuff in this migration guide to try to change, modify your code from older NumPy to the NumPy 2.0.

03:34 So that's really cool.

03:37 I would probably start there.

03:38 Also making sure you have tests around your code to make sure your code is working before and after the migration.

03:44 And then the release notes gets down to a lot of the nitty gritty stuff.

03:49 There's, there's new string stuff.

03:51 There's performance improvements, but there's also hopping down.

03:55 There's a lot of breaking changes.

03:57 And, and, you know, we need to, we need to allow projects to do this.

04:02 So I think this is a good thing that they're, they're moving towards some changes in NumPy.

04:07 Yeah.

04:07 Quite a big deal for a 2.0 of NumPy.

04:10 Yeah.

04:11 You know, it's been around a super long time, 15 years or something like that.

04:15 So they must take it seriously.

04:17 And that was released in 2006.

04:19 Yeah.

04:20 And like I said, this 2.0 migration to make sure that they were making, doing the right deprecations and omissions and changes necessary for the breaking,

04:32 breaking some backwards compatibility, but for good reasons.

04:36 I think it's, yeah, just, just heads up everybody.

04:40 So.

04:42 Yeah.

04:43 Awesome.

04:43 Well, that's a good one to cover for sure.

04:45 I have another exciting one.

04:46 Let's jump over to that.

04:48 So if you are a fan of UVicorn, so UVicorn is one of the ways you can run ASGI, ASGI web app.

04:59 So things like court, FastAPI, many others.

05:04 You can use UVicorn.

05:06 And it's definitely sort of the recommended way or the, at least suggested way that you run FastAPI or development.

05:14 But then when you go into production, well, you've got challenges.

05:18 So for example, you want your web server to look and see if your web app crashes for whatever reason, like something went wrong.

05:27 Excuse me.

05:28 Something went wrong with it.

05:29 Something, maybe it ran out of memory.

05:32 I don't know.

05:33 All these things.

05:34 Right.

05:34 You need the app to sort of look at that and say, well, we're going to restart it because it looks like it's hung up or it looks like it crashed.

05:42 Bring it back.

05:43 The other thing you need to be able to do is you need to be able to potentially scale out across processes.

05:49 So maybe I've, well, not maybe.

05:51 At Python Bice, we have an eight CPU server.

05:54 If we just create one process, you know, because of the GIL and other things, it might be kind of blocked up.

06:01 If it's processing some slow requests, we don't want it to have to just queue up behind it.

06:06 You want to be able to say, well, this one is busy, but there's three other processes that are clones of this thing running and handed off to one of them.

06:14 Right.

06:14 Typically that's done in production by using G unicorn with UV a corn workers, which is like, why am I using two servers?

06:22 Like to kind of manage the CEO.

06:23 So like G unicorn manages UV a corn running this stuff.

06:26 Like what a mess.

06:27 Right.

06:28 So the news of this item is UV a corn now does all of that stuff itself.

06:34 It no longer needs G unicorn.

06:36 And this news comes from us from John Hagan.

06:39 So thanks for shooting this our way.

06:40 So this is filed under the new multi-process manager.

06:45 And it says the multi-process manager introduced by this includes a process, keep alive and process on detection.

06:53 It also imitates G unicorn and uses a bunch of different types of signals to control the child processes.

07:00 And there's even, I haven't opened it up yet, but I will.

07:04 There we go.

07:04 I'll include a link to how you use this in production.

07:08 So it's pretty easy.

07:10 You just say UV a corn and then the module name and then the variable name of the app.

07:16 So like main colon app, super common.

07:18 But then the new thing is --workers.

07:21 And you can specify how many workers you want.

07:23 The documentation has four.

07:25 It says unlike G unicorn, UV a corn does not use pre fork, but uses spawn, which allows UV

07:31 and a corn's multi-process manager to work well on windows as well.

07:35 The default process manager monitors the status of child processes.

07:39 Those are actually the things handling your web requests.

07:42 And it automatically restarts child processes that die unexpectedly.

07:46 That's a little morbid.

07:47 Not only that, it'll also monitor the status of child processes through the pipeline.

07:53 And if it gets stuck, it'll be killed off and restarted and so on.

07:58 So that's the new thing.

08:00 And if you're already using UV a corn, especially if you're using UV a corn workers with G unicorn,

08:05 this might be a pretty awesome way to simplify things.

08:08 Not only it might be, you kind of need to because the UV a corn workers have been deprecated as well.

08:16 Oh, the G unicorn workers, you mean?

08:18 Oh, yeah.

08:19 Oh, yeah, that's right.

08:20 It is deprecated and will be removed in a future release.

08:24 So I guess get busy, people.

08:26 Yeah.

08:29 So exciting news.

08:31 Yeah, indeed.

08:32 Changes.

08:32 Very exciting.

08:33 Now, do you know what else is exciting, Brian?

08:36 Mailtrap.

08:37 Yeah.

08:37 Our sponsor.

08:38 Yeah.

08:38 Let's talk about them for just a second.

08:40 This episode is sponsored by Mailtrap, an email delivery platform that developers love.

08:45 An email sending solution with industry best analytics, SMTP and email API, as well as SDKs for major programming languages and 24 seven human support.

08:57 Try for free at Mailtrap dot IO.

09:00 Over to you.

09:01 All right.

09:01 Next.

09:02 We got Pixie.

09:04 This is I did write down who suggested this suggested by Vic Gelson.

09:08 So thanks, Vic.

09:09 Pixie is a package management made easy.

09:13 So another package manager thing.

09:15 This is a is this something that says Conda package management simplified.

09:21 So this is not trying to replace PIP, but really trying to and, you know, things like that.

09:27 But it's trying to replace Conda or build on Conda.

09:29 So I haven't really dug too much into this, but I think it's an interesting project.

09:33 This is cross platform written in Rust, but it's also it's also not just about Python.

09:41 It's about other other languages as well.

09:44 So the highlights are supports multiple languages, including Python C++ are using Conda packages.

09:52 And there's there's yeah, some exciting information around it.

09:58 It's cargo like I think that it's built thinking, you know, trying to get Conda to kind of look like cargo.

10:04 I like I said, I haven't tried this, but it looks looks exciting.

10:10 There is a a Pixie tutorial for doing Python development with Pixie.

10:17 This walks through creating creating a Pixie pie project, which creates a pie project tunnel.

10:24 I found this interesting that it is using using setup tools as a back end.

10:30 And then there's some extra Pixie project stuff around Conda forward.

10:34 So I think this is a tool.

10:37 If you're publishing to the Conda space, this might be a tool worth looking into to try to manage your Conda environments.

10:45 So, yeah, definitely.

10:47 It's a super cool project.

10:49 I feel like there was some collaboration between them and maybe the UV folks.

10:56 I can't remember.

10:57 But yeah, it's a super cool project.

10:59 I actually had Wolf Fulprec and Ruben Arts on last year in October to talk about this on Talk Python.

11:06 So if you want to hear them dive into why they built it and all the plans there.

11:10 And actually, we talked about some other stuff as well that they're doing.

11:13 We talked about like Nix OS and so on.

11:16 So, yeah.

11:16 Interesting.

11:17 Awesome.

11:17 Yeah, it's awesome.

11:18 You know, there's a thousand flowers blooming in the packaging space right now.

11:22 It's very exciting.

11:22 Yeah.

11:23 So this was mentioned by Vic, but he also gave us a little bit of what his take on it is.

11:30 So I'm just going to quote from Vic right now.

11:34 He says, Pixie is a project manager written in Rust that allows you to build Python projects without having Python previously installed.

11:42 That's interesting.

11:43 It's installable via Homebrew.

11:45 There's support for supporting VS Code and PyCharm via plugins to deal with this.

11:51 By default, Pixie fetches packages from Conda Forge.

11:55 So you get the scientific stack in a pretty reliable and performant build.

11:59 And if it's not there, it looks on PyPI or if there's a possibility to look on PyPI.

12:07 So Vic tried to use it.

12:10 He was really impressed and got his Jupyter environment with QPy using NVIDIA GPUs working really quickly.

12:18 So at least one person says it's a pretty cool thing to try.

12:21 Yeah.

12:23 Scroll up on that screen you got there.

12:25 Scroll up or the other one.

12:27 Other up.

12:27 Yeah.

12:28 To the top.

12:28 Yeah.

12:28 2,100 people think it's a pretty good way.

12:31 The number of stars there.

12:33 Yeah.

12:33 Yeah.

12:33 Exactly.

12:34 All right.

12:35 Final one for me is Jupyter.

12:39 So we already talked about NumPy, which also is the foundation of so many other data science projects.

12:46 So here's maybe looking at it from the other direction of the data science space.

12:50 Looking in from the top, from the UI.

12:52 So JupyterLab 4.2 and Jupyter Notebook 7.2 are now available.

12:59 So it's pretty awesome.

13:00 JupyterLab includes three new features.

13:04 I'll give you some shout outs on them.

13:05 20 enhancements, 33 bug fixes, and 29 maintenance tasks included by 39 contributors, which is pretty awesome, right?

13:15 Yeah.

13:16 And Jupyter Notebook, I think, carries, you know, take some of these as forward as well.

13:21 So also has a bunch of fixes.

13:23 All right.

13:23 So what are some of the features?

13:25 Easier workspace management with the GUI.

13:28 So you can, instead of using the CLI or just grabbing a URL, for example, if you want to have it open up a particular notebook when you launch it or something, you could create a workspace with that open, I believe, instead of just pointing to a URL to that particular notebook.

13:43 Right.

13:44 So now there's like a UI for workspaces that you can control, rename them, reset them, delete them, and so on.

13:51 That's pretty cool.

13:52 You have recently opened and closed files.

13:55 So there used to be an extension called JupyterLab-recents to give you access to recent files and recent directories.

14:02 And now that just comes built in.

14:04 So I guess if you have the extension still installed, you'll really know what recent files you had.

14:08 But now it probably disables it or something.

14:10 It has full notebook windowing mode by default.

14:15 And that's not like a screen layout type thing.

14:17 Suppose you have a notebook with a thousand cells and their output.

14:22 And those outputs have interactive notebook widgets and Jupyter widgets.

14:26 And they've got a bunch of graphs and stuff.

14:29 If you open that thing up and it just goes, well, we're going to render all thousand items.

14:33 You know, it might take a moment, right?

14:35 Yeah.

14:36 So instead what it does is it basically renders only the cells visible on the window, which should be for as it gets larger and larger, should be more important for performance.

14:46 Improved shortcut editor.

14:49 So you can do a bunch of different better things.

14:51 In fact, like even change default bindings and stuff.

14:54 Dark high contrast theme.

14:57 More keyboard shortcuts are putting some of them back.

15:00 Like control D has been restored to allow users to delete a line and that type of stuff.

15:05 So there you have it.

15:06 If you are a notebook person, go forth and get the new one for you, whether JupyterLab or Jupyter Notebook.

15:13 That's pretty exciting.

15:14 I'm glad to see this is continuing with new releases.

15:18 Yeah.

15:19 It's a really nice, really nice way to work with Python and data science and all the things.

15:23 All the things.

15:24 How extra are you feeling today?

15:26 I got a few extras.

15:27 All right.

15:28 Do it.

15:28 Okay.

15:29 Tell us about them.

15:29 Okay.

15:30 This was this.

15:30 A couple of things came from Hugo von Ken.

15:34 I practiced this earlier.

15:36 Hugo von Kemenada.

15:39 Sorry if I messed this up, Hugo.

15:41 But anyway, some encouragement for us to test Python 3.13.

15:46 So Python 3.13 is in the betas out.

15:51 And we're trying to.

15:52 It's got some interesting stuff in it, like the free threaded mode.

15:57 So a couple links here to encourage people to help test.

16:01 And some blog posts to help you know how to test it.

16:06 So help test Python 3.13.

16:08 There's an announcement here, strongly encouraging people to test.

16:13 And then a specific test around the free threading Python without the GIL.

16:18 And a reminder that some people call this no gill, but we don't like to say that anymore.

16:23 So the free threading mode.

16:25 And how to test that.

16:27 And that one's a little tricky because you've got to.

16:30 There are some official installers, but you can build it yourself as well.

16:34 And it's available as well and get dead snakes.

16:37 There's a question mark around GitHub actions.

16:40 It'd be great if that works.

16:42 Like to hear back from people.

16:44 But we really want this to go well with this because it's a cool project.

16:49 So help test that.

16:51 So that's around the Python 3.13.

16:53 That's probably the biggest change.

16:55 The biggest change facing people using 3.13 and packages that you might be using that are on 3.13 and all those things.

17:03 Because those were not built with this in mind.

17:05 Whereas everything else is built, at least with the concept of backwards compatibility.

17:09 Right.

17:09 But this one.

17:10 Right.

17:11 But there's.

17:11 Trying to break it.

17:12 Break out.

17:12 I'm sure there's places where they've had to change this.

17:15 The normal stuff as well.

17:17 Just to keep.

17:17 Get that ready for that.

17:19 So I encourage people, even if you're not planning on testing any part of the GIL versus with free threading, to test 3.13 anyway.

17:28 Just to make sure that there are no surprises with your project and report them if there are.

17:32 Last thing.

17:33 I have been fairly quiet on the Python test podcast recently.

17:38 But there is an episode that came out the other day.

17:41 How to get pytest to import your code under test.

17:43 So 2.21 is out.

17:45 These are not going to come out very regularly.

17:47 But occasionally they'll drop.

17:49 So I'll mention them.

17:50 And yeah.

17:52 There's a new one.

17:53 So those are my extras.

17:54 Yeah.

17:55 Cool.

17:55 What's very excellent about podcast clients is even if something doesn't come out for six weeks,

18:02 something that does boom, it just shows up right in your list.

18:04 Yeah.

18:04 People will know.

18:06 Do you have extras?

18:07 I do.

18:08 I have just one quick bit of follow-up.

18:11 So remember, Brian, we talked about the higher order company.

18:14 We talked about Bend, a parallel programming language that is Python-like.

18:20 It looks like Python, that sort of thing.

18:23 I feel like I maybe gave the impression that it is Python.

18:27 It's not Python.

18:28 It's just Python-like.

18:30 So you could look at code and say, yeah, that is Python.

18:33 But you might not be able to import a bunch of things.

18:35 Or there's certain things you can't do, right?

18:37 So it's a big-time subset.

18:39 And maybe not exactly even a subset, right?

18:42 Anyway, I got some follow-up from Bernat Gabor.

18:46 I just wanted to read you so.

18:47 Because I think it sounds like he's got more experience than I do for sure.

18:51 So it says, Bend looks roughly like Python, but is nowhere there, actually.

18:57 For example, it has no for loops.

18:59 Instead, you're meant to use the Bend keyword, hence the language name, to expand calculations.

19:04 And another keyword to join branches.

19:06 So basically, think of something that resembles Python at a high level, but without being compatible with that.

19:12 And without any of the standard library or packages that the Python language provides.

19:16 That being said, it does an impressive job at parallelization.

19:20 But essentially, it's a brand new language with new syntax and paradigms you'll have to learn.

19:24 It just shares the first look similarities to Python.

19:26 So, yeah.

19:27 If you want to check that out, I'm sure it's awesome.

19:30 But it's going to be its own kind of thing.

19:32 Yeah.

19:32 Yeah.

19:33 That's not funny.

19:34 But you know what is funny?

19:35 What's funny?

19:37 The wild loops.

19:37 They're hilarious.

19:38 The wild loops are hilarious.

19:40 All right.

19:41 Describe what's going on in this picture without maybe the words.

19:43 Here for us, Brian.

19:45 People dancing at a party with somebody in the corner looking at them?

19:48 Yeah.

19:49 So there's a couple, there's like a crowd of people dancing, having fun, just footloose, carefree, having a good time.

19:57 And there's someone in the corner with a party hat and a drink, but the most serious look on their face as if the world is about to end.

20:03 And the people in the room don't know it.

20:05 And the quote says, they don't know today.

20:07 I finally ran into a situation that required a do while.

20:11 You're just going about it like life is normal.

20:16 And here it is, the do while.

20:18 Do we have do while in Python?

20:21 I was just thinking that.

20:22 I think no, but we have while else, which you could probably bend into some weird, I don't know.

20:28 I don't really think you ever need a do while.

20:30 I don't know why languages have this.

20:32 Anyway.

20:34 Okay.

20:34 Amazing.

20:35 But it's a funny joke nonetheless.

20:37 Yeah, definitely.

20:39 So.

20:40 Nice.

20:42 Yeah.

20:43 Do you know what's not funny?

20:44 It's the end of the podcast.

20:46 Oh, it is the end of the podcast.

20:48 I have to say goodbye, Brian, to everyone.

20:51 Until next week.

20:52 Yes.

20:53 Until next week.

20:53 Thank you everyone for listening.

20:55 We always appreciate it.

20:57 Thanks.

20:58 Bye.

Back to show page