Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 386, recorded June 4th, 2024.
I am Michael Kennedy.
And I am Brian Okken.
This episode is brought to you by Mailtrap.
I want to tell you more about them later.
And I also want to let you know that you can find us over on Fostadon.
We are Fosstodonians, as we've said before.
If you want to talk to us on Mastodon, the links are in the top of your podcast player show notes.
We're also on X, but do a little bit more stuff on Mastodon.
So check us out there.
Also, you can find us streaming live at exactly this time right now, Brian.
Finally, which is usually 10 a.m. Pacific time on a Tuesday.
So just pythonbytes.fm/live and you can be part of the live show.
If you want, watch the older videos there if you like, or just subscribe in your podcast player.
We really appreciate that.
Finally, interest in our email that you've been writing.
There's a lot of people signing up for it, Brian.
So if you want an artisanal handcrafted digest of the show in written form, just visit pythonbytes.fm.
Click on newsletter right there in the center and enter your email address.
We won't share it, but we will send you an email after every show about what we covered.
So you have it saved if you like.
Yeah.
All right.
You want to kick us off, Brian?
I will.
So this comes as a suggestion from somebody and I am sorry I didn't write the name down.
So thanks.
We do love it.
I love it when people share important news with us and say, hey, you really should cover this because it's important.
Thank you for that.
So what am I talking about today?
I'm talking about NumPy 2.0.
And I don't, I was searching for it.
I thought we'd covered some of the changes in NumPy 2.0, but I don't know if we have.
So NumPy 2.0 has been in the works for a long time.
And the reason why I'm bringing it up right now is because the release date is June 16th.
It's right around the corner and NumPy is both, even you're probably using it.
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.
Anyway, lots of changes to the 2.0.
We're linking to an announcement.
We've got the main page, numpy.org announces it.
You can just go there if you want.
But there's also a news item for the release for the June 16th.
There is some cool migration guide.
So I'm not going to go over some, a lot of the details, but there are some breaking changes with this.
So I'll go over a few things.
First off, went over and looked at the migration guide.
Let's see the release note.
Migration guide.
I thought this was super cool.
So the migration guide is around to help you go through, navigate some of the changes that might be, might be the, the most,
problematic.
But one of the cool things is rough is helping out.
So if you're using rough greater than version 0.2.0, you added a rule for NPY 201.
So, but you can just look at the migration guide and find this.
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.
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.
So that's really cool.
I would probably start there.
Also making sure you have tests around your code to make sure your code is working before and after the migration.
And then the release notes gets down to a lot of the nitty gritty stuff.
There's, there's new string stuff.
There's performance improvements, but there's also hopping down.
There's a lot of breaking changes.
And, and, you know, we need to, we need to allow projects to do this.
So I think this is a good thing that they're, they're moving towards some changes in NumPy.
Yeah.
Quite a big deal for a 2.0 of NumPy.
Yeah.
You know, it's been around a super long time, 15 years or something like that.
So they must take it seriously.
And that was released in 2006.
Yeah.
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,
breaking some backwards compatibility, but for good reasons.
I think it's, yeah, just, just heads up everybody.
So.
Yeah.
Awesome.
Well, that's a good one to cover for sure.
I have another exciting one.
Let's jump over to that.
So if you are a fan of UVicorn, so UVicorn is one of the ways you can run ASGI, ASGI web app.
So things like court, FastAPI, many others.
You can use UVicorn.
And it's definitely sort of the recommended way or the, at least suggested way that you run FastAPI or development.
But then when you go into production, well, you've got challenges.
So for example, you want your web server to look and see if your web app crashes for whatever reason, like something went wrong.
Excuse me.
Something went wrong with it.
Something, maybe it ran out of memory.
I don't know.
All these things.
Right.
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.
Bring it back.
The other thing you need to be able to do is you need to be able to potentially scale out across processes.
So maybe I've, well, not maybe.
At Python Bice, we have an eight CPU server.
If we just create one process, you know, because of the GIL and other things, it might be kind of blocked up.
If it's processing some slow requests, we don't want it to have to just queue up behind it.
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.
Right.
Typically that's done in production by using G unicorn with uv a corn workers, which is like, why am I using two servers?
Like to kind of manage the CEO.
So like G unicorn manages uv a corn running this stuff.
Like what a mess.
Right.
So the news of this item is uv a corn now does all of that stuff itself.
It no longer needs G unicorn.
And this news comes from us from John Hagan.
So thanks for shooting this our way.
So this is filed under the new multi-process manager.
And it says the multi-process manager introduced by this includes a process, keep alive and process on detection.
It also imitates G unicorn and uses a bunch of different types of signals to control the child processes.
And there's even, I haven't opened it up yet, but I will.
There we go.
I'll include a link to how you use this in production.
So it's pretty easy.
You just say uv a corn and then the module name and then the variable name of the app.
So like main colon app, super common.
But then the new thing is --workers.
And you can specify how many workers you want.
The documentation has four.
It says unlike G unicorn, uv a corn does not use pre fork, but uses spawn, which allows UV
and a corn's multi-process manager to work well on windows as well.
The default process manager monitors the status of child processes.
Those are actually the things handling your web requests.
And it automatically restarts child processes that die unexpectedly.
That's a little morbid.
Not only that, it'll also monitor the status of child processes through the pipeline.
And if it gets stuck, it'll be killed off and restarted and so on.
So that's the new thing.
And if you're already using uv a corn, especially if you're using uv a corn workers with G unicorn,
this might be a pretty awesome way to simplify things.
Not only it might be, you kind of need to because the uv a corn workers have been deprecated as well.
Oh, the G unicorn workers, you mean?
Oh, yeah.
Oh, yeah, that's right.
It is deprecated and will be removed in a future release.
So I guess get busy, people.
Yeah.
So exciting news.
Yeah, indeed.
Changes.
Very exciting.
Now, do you know what else is exciting, Brian?
Mailtrap.
Yeah.
Our sponsor.
Yeah.
Let's talk about them for just a second.
This episode is sponsored by Mailtrap, an email delivery platform that developers love.
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.
Try for free at Mailtrap dot IO.
Over to you.
All right.
Next.
We got Pixie.
This is I did write down who suggested this suggested by Vic Gelson.
So thanks, Vic.
Pixie is a package management made easy.
So another package manager thing.
This is a is this something that says Conda package management simplified.
So this is not trying to replace pip, but really trying to and, you know, things like that.
But it's trying to replace Conda or build on Conda.
So I haven't really dug too much into this, but I think it's an interesting project.
This is cross platform written in Rust, but it's also it's also not just about Python.
It's about other other languages as well.
So the highlights are supports multiple languages, including Python C++ are using Conda packages.
And there's there's yeah, some exciting information around it.
It's cargo like I think that it's built thinking, you know, trying to get Conda to kind of look like cargo.
I like I said, I haven't tried this, but it looks looks exciting.
There is a a Pixie tutorial for doing Python development with Pixie.
This walks through creating creating a Pixie pie project, which creates a pie project tunnel.
I found this interesting that it is using using setup tools as a back end.
And then there's some extra Pixie project stuff around Conda forward.
So I think this is a tool.
If you're publishing to the Conda space, this might be a tool worth looking into to try to manage your Conda environments.
So, yeah, definitely.
It's a super cool project.
I feel like there was some collaboration between them and maybe the uv folks.
I can't remember.
But yeah, it's a super cool project.
I actually had Wolf Fulprec and Ruben Arts on last year in October to talk about this on Talk Python.
So if you want to hear them dive into why they built it and all the plans there.
And actually, we talked about some other stuff as well that they're doing.
We talked about like Nix OS and so on.
So, yeah.
Interesting.
Awesome.
Yeah, it's awesome.
You know, there's a thousand flowers blooming in the packaging space right now.
It's very exciting.
Yeah.
So this was mentioned by Vic, but he also gave us a little bit of what his take on it is.
So I'm just going to quote from Vic right now.
He says, Pixie is a project manager written in Rust that allows you to build Python projects without having Python previously installed.
That's interesting.
It's installable via Homebrew.
There's support for supporting VS Code and PyCharm via plugins to deal with this.
By default, Pixie fetches packages from Conda Forge.
So you get the scientific stack in a pretty reliable and performant build.
And if it's not there, it looks on PyPI or if there's a possibility to look on PyPI.
So Vic tried to use it.
He was really impressed and got his Jupyter environment with QPy using NVIDIA GPUs working really quickly.
So at least one person says it's a pretty cool thing to try.
Yeah.
Scroll up on that screen you got there.
Scroll up or the other one.
Other up.
Yeah.
To the top.
Yeah.
2,100 people think it's a pretty good way.
The number of stars there.
Yeah.
Exactly.
All right.
Final one for me is Jupyter.
So we already talked about NumPy, which also is the foundation of so many other data science projects.
So here's maybe looking at it from the other direction of the data science space.
Looking in from the top, from the UI.
So JupyterLab 4.2 and Jupyter Notebook 7.2 are now available.
So it's pretty awesome.
JupyterLab includes three new features.
I'll give you some shout outs on them.
20 enhancements, 33 bug fixes, and 29 maintenance tasks included by 39 contributors, which is pretty awesome, right?
Yeah.
And Jupyter Notebook, I think, carries, you know, take some of these as forward as well.
So also has a bunch of fixes.
All right.
So what are some of the features?
Easier workspace management with the GUI.
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.
Right.
So now there's like a UI for workspaces that you can control, rename them, reset them, delete them, and so on.
That's pretty cool.
You have recently opened and closed files.
So there used to be an extension called JupyterLab-recents to give you access to recent files and recent directories.
And now that just comes built in.
So I guess if you have the extension still installed, you'll really know what recent files you had.
But now it probably disables it or something.
It has full notebook windowing mode by default.
And that's not like a screen layout type thing.
Suppose you have a notebook with a thousand cells and their output.
And those outputs have interactive notebook widgets and Jupyter widgets.
And they've got a bunch of graphs and stuff.
If you open that thing up and it just goes, well, we're going to render all thousand items.
You know, it might take a moment, right?
Yeah.
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.
Improved shortcut editor.
So you can do a bunch of different better things.
In fact, like even change default bindings and stuff.
Dark high contrast theme.
More keyboard shortcuts are putting some of them back.
Like control D has been restored to allow users to delete a line and that type of stuff.
So there you have it.
If you are a notebook person, go forth and get the new one for you, whether JupyterLab or Jupyter Notebook.
That's pretty exciting.
I'm glad to see this is continuing with new releases.
Yeah.
It's a really nice, really nice way to work with Python and data science and all the things.
All the things.
How extra are you feeling today?
I got a few extras.
All right.
Do it.
Okay.
Tell us about them.
Okay.
This was this.
A couple of things came from Hugo von Ken.
I practiced this earlier.
Hugo von Kemenada.
Sorry if I messed this up, Hugo.
But anyway, some encouragement for us to test Python 3.13.
So Python 3.13 is in the betas out.
And we're trying to.
It's got some interesting stuff in it, like the free threaded mode.
So a couple links here to encourage people to help test.
And some blog posts to help you know how to test it.
So help test Python 3.13.
There's an announcement here, strongly encouraging people to test.
And then a specific test around the free threading Python without the GIL.
And a reminder that some people call this no gill, but we don't like to say that anymore.
So the free threading mode.
And how to test that.
And that one's a little tricky because you've got to.
There are some official installers, but you can build it yourself as well.
And it's available as well and get dead snakes.
There's a question mark around GitHub actions.
It'd be great if that works.
Like to hear back from people.
But we really want this to go well with this because it's a cool project.
So help test that.
So that's around the Python 3.13.
That's probably the biggest change.
The biggest change facing people using 3.13 and packages that you might be using that are on 3.13 and all those things.
Because those were not built with this in mind.
Whereas everything else is built, at least with the concept of backwards compatibility.
Right.
But this one.
Right.
But there's.
Trying to break it.
Break out.
I'm sure there's places where they've had to change this.
The normal stuff as well.
Just to keep.
Get that ready for that.
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.
Just to make sure that there are no surprises with your project and report them if there are.
Last thing.
I have been fairly quiet on the Python test podcast recently.
But there is an episode that came out the other day.
How to get pytest to import your code under test.
So 2.21 is out.
These are not going to come out very regularly.
But occasionally they'll drop.
So I'll mention them.
And yeah.
There's a new one.
So those are my extras.
Yeah.
Cool.
What's very excellent about podcast clients is even if something doesn't come out for six weeks,
something that does boom, it just shows up right in your list.
Yeah.
People will know.
Do you have extras?
I do.
I have just one quick bit of follow-up.
So remember, Brian, we talked about the higher order company.
We talked about Bend, a parallel programming language that is Python-like.
It looks like Python, that sort of thing.
I feel like I maybe gave the impression that it is Python.
It's not Python.
It's just Python-like.
So you could look at code and say, yeah, that is Python.
But you might not be able to import a bunch of things.
Or there's certain things you can't do, right?
So it's a big-time subset.
And maybe not exactly even a subset, right?
Anyway, I got some follow-up from Bernat Gabor.
I just wanted to read you so.
Because I think it sounds like he's got more experience than I do for sure.
So it says, Bend looks roughly like Python, but is nowhere there, actually.
For example, it has no for loops.
Instead, you're meant to use the Bend keyword, hence the language name, to expand calculations.
And another keyword to join branches.
So basically, think of something that resembles Python at a high level, but without being compatible with that.
And without any of the standard library or packages that the Python language provides.
That being said, it does an impressive job at parallelization.
But essentially, it's a brand new language with new syntax and paradigms you'll have to learn.
It just shares the first look similarities to Python.
So, yeah.
If you want to check that out, I'm sure it's awesome.
But it's going to be its own kind of thing.
Yeah.
That's not funny.
But you know what is funny?
What's funny?
The wild loops.
They're hilarious.
The wild loops are hilarious.
All right.
Describe what's going on in this picture without maybe the words.
Here for us, Brian.
People dancing at a party with somebody in the corner looking at them?
Yeah.
So there's a couple, there's like a crowd of people dancing, having fun, just footloose, carefree, having a good time.
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.
And the people in the room don't know it.
And the quote says, they don't know today.
I finally ran into a situation that required a do while.
You're just going about it like life is normal.
And here it is, the do while.
Do we have do while in Python?
I was just thinking that.
I think no, but we have while else, which you could probably bend into some weird, I don't know.
I don't really think you ever need a do while.
I don't know why languages have this.
Anyway.
Okay.
Amazing.
But it's a funny joke nonetheless.
Yeah, definitely.
So.
Nice.
Yeah.
Do you know what's not funny?
It's the end of the podcast.
Oh, it is the end of the podcast.
I have to say goodbye, Brian, to everyone.
Until next week.
Yes.
Until next week.
Thank you everyone for listening.
We always appreciate it.
Thanks.
Bye.