- Podcasts
- Python Bytes
- #355 Python 3.12 is Out!
About this episodeTopics covered in this episode: 3.12 is out ! Trouble with virtualenv caching, a tale of 3.12 update Python Developers Survey 2022 Results…
- 3.12 is out !
- Trouble with virtualenv caching, a tale of 3.12 update
- Python Developers Survey 2022 Results
- Scientific Python Library Development Guide
- Extras
- Joke
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#355 Python 3.12 is Out!
But I had it off. Anyway, welcome everybody. It's good to have the show. Thank you, everyone, for supporting us through purchasing courses at Talk Python Training or purchasing the pytest course, of course, or supporting us on Patreon. We love Patreon supporters. And if you want to reach us, reach us through Fosstodon on Mastodon at Michael Kennedy, @brianokken, and at Python Bytes.
If you look at the change log, Brian, if you look at the, what's new and you scroll this, I threw this into omnivore.app. And it said it's 48 minutes of reading to read the, what's in this release. Wow. That's a lot. That's a lot of stuff. That's a lot of good things. I think it's, I don't even know how much it's called out in the, what's new, because it's a little tricky to put in the, not new, it's just more.
But the faster CPython initiative, I think, you know, is going strong for 312 as it was for 11 and it will be for 13. So not even covered in the, what's new, I think is Python 312 should just be faster. That's really cool. Yeah. But if you look at the, you know, they kind of, it's really nice, even though it's 48 minutes of reading, they do put the headline items at the front here.
So there's new type parameter syntax and PEP 695. So Brian, how do you like your generics? I haven't thought about it actually. Or your templates, if you're a C++ guy, they don't call them generics. Like C# and Java, they call them generics. But C++ calls them templates. So, but Python calls them generics.
We have that, we had it before actually. So this is not new, new. Like there were ways if I scroll down somewhere in this big long list, there was like a, here's how you do it before. And here's how you do it now. Honestly, meh. I mean, no disrespect to people working on it, but it's just not like a thing that, that I'm going to be focusing.
It's just not a huge deal to me. Right. It's not something I feel like I'm going to do a lot of. Maybe. I feel like most of the places that I would have wanted to use it, it's kind of like the self parameter sort of takes care of that for me. But anyway, very exciting for people who do need to use this.
Yeah. f-strings are all grown up now. Oh boy. They can do all the Python. So f-strings. I don't know if people know, but f-strings have their own separate implementation, separate to like regular strings and stuff. And a lot of it was done in C. They're really wild. Because of that, they're somewhat limited in what you can put inside the curly braces.
Or you couldn't put the same quotes that you had on the outside. Yeah. I'd always be like, okay, this one's getting single quotes because the string is a double quote or vice versa. You have to kind of think it out. So now it's like a little more free form what can go in there. I don't know that's necessarily a recommendation of writing your app inside the F string, but, you know, it gives you more flexibility.
So there it is. I am super psyched about 648, which is a unique per interpreter Gil, Eric Snow. Man, you've been on this for a while. Congratulations on that. This is out. So this has mega possibilities to unlocking multi-threaded performance in Python. Don't know that it's actually has anything to do with threads yet.
In a sense, but without a new process. Okay. Right. Yeah. So. Why not? You can't, I don't believe you can share. Maybe you can share data directly. I don't, I don't think, I don't think you can share it directly because it would have to share the Gil. So I think you've got to like serialize the data over, but you can get better performance if you don't have to start a bunch of processes.
Yeah. Potentially. And do some message passing. But you know, here on my M2 pro mini, I have 10 cores and all the Python I want to write. I'm only going to ever be able to do one cores worth of work for computational things. Unless I go crazy with like the no Gil Cython or write some C code or, you know, things like that.
Right. So this, this has the possibility to take advantage of, of, you know, modern hardware, right? Very exciting. Low impact monitoring. So if you want to like hook into events, for like profiling, debugging type of stuff, you can do that with less. Heisen bug effects. And also one of the big things that came in 3.11 was, did you mean type of recommendations for, we couldn't import request.
Did you mean requests plural? Things like that. Right. And so that's further improved. There's a buffer protocol, which allows direct access to memory of things like byte arrays and other low level items that you don't have to like go through the Python level. You just go, give me the direct access to the memory.
So, you know, you can do like Python dash M HTTP server or something along those lines. You can do that for SQLite now as well, which is kind of neat. Yeah, this is exciting. Async IO has some improvements with benchmarks showing up to a 75% speed improvement in certain areas. I'm sure not generally, but yeah.
Bunch of other things. There's also some security updates, some API. There's performance improvements with comprehension inlining. And there's a Linux performance profiler. Yeah. Bunch of different things. And that's pretty much the highlights. I mean, there's some binning, some culling of the standard library.
And that's your new Python. Awesome. Are you excited? How long till you switch to it? I'm working on it right now, man. Are you? Yeah. So, yeah. Wait a sec. I'm going to tell you a story. Okay. Okay. Okay. So yesterday, so I have been, I've been slowly becoming one of the, one of the maintainers for a plugin called pytest Repeat.
It was on Travis before. So I moved it to GitHub Actions. And so 3.12 is out. I wanted to, to update the test to 3.12, right? So this is using Tox. And so I just went through and updated the Tox Any file to add 3.12. I installed it on my machine. What's the problem? Ran it and created a new virtual environment, installed Tox, whatever, and ran it and it blew up.
They've surely have come up with this. I dug through a long, I was researching a ton on this. and, basically I thought there's something weird going on between pip and Tox and Python 3.12. Cause I knew that the imp, imp, imp, importer thing was deprecated. I don't know what it is, but I knew it was deprecated and it was taken out in 3.12, I think.
the, the fix I came up with was there was a, in, in, talks in a, you can say download equals true. So when it creates a virtual environment, it creates the, it updates to the latest Pip. So what was happening was, but without that I was using an older Pip, but I don't know. I didn't know why, why was it using an older Pip?
And virtual end has some cool features. One of the things it does is it keeps a, a little cache of, third party packages to, to store, to load up. And it doesn't update them all the time. It does it like, I don't know, every 14 days or something like that. It, it, it's a kind of a slow update thing and it makes things run faster because you don't have to keep downloading all the time.
But I had an old pip cached. So the real fix was, I went through and I probably didn't have to do the reset, but I called virtual end with reset app data. and then did an upgrade. And I probably could have just done the upgrade upgrade embed wheels. And it updated my pip cat cached pip to the latest.
Anyway. So I'm going to, I wrote this article about how I patched it. I'm going to update it today to say, the real fix is to clean out your, your virtual end pip cash or virtual end of cash. So yes, I'm working on updating to three 12. So nice. Also. Yeah, that's cool. Have to shout out to, Juergen.
The, the Python developers survey results are out. It's slightly confusing in that it says the Python developer survey, 2022 results. Like, wait a minute. It's September, 2023. Is this last year's one or the, no, this is the one that just came out on the PSF blog. They just on PyFound, they just announced like, these are finally put together, analyze a report from the 20, the end of 2022 is now out.
So very exciting. And also new. I did a video on YouTube actually, where I had a first reaction to it. So this is an 18 and a half minute video. I'll link to it. You can check it out if you want to go deep. And because this video exists, we'll just kind of skim it, Brian. We won't go over too much of it, but I basically didn't open up or read the survey results until I hit record for this video.
And then I just dove into it. So that's fun. People can, can check that out if they want, but let's see. We can hit some of the highlights. general Python usage, 85% of the people who Python, Python primarily that way. So it's not like a second language, you know, but it's mainly what they do, which is pretty cool.
There's a lot of these that add to over a hundred. So, take it for what it is. There's also like a little gray, like a light gray and a dark gray, I don't know word or legend. And that will, they often overlay these things to show them side by side. So for example, it says Python usage with what other language, like if you're not, if you're going to use another language, what do you also use?
In addition to Python, primarily being Python being the main language. And it has like, this one is the prior year and this year again, with the offset by one a little bit. So guess what the top three are? JavaScript, HTML and CSS. Are those languages? No, no. Can you make it? Here's a rule for what is a language in my mind?
Probably. Can I make a thing that runs on its own from that set of syntax? JavaScript. Yes. C++. Yes. Java. Yes. Type script. Yes. CSS. No. But nonetheless, the reason I make that distinction is it's like, it's a, it's, I feel like it's a trade off of like, I do Java or I do Python or I could choose one or the other, but they're not.
If it's not interchangeable, I'm not sure. I don't know. It's somewhat interesting, but. I'm, I'm on the fence. It's, they've got, they're both complicated enough that I think it takes training to learn it. So when, I mean, I wouldn't think, I wouldn't think of like any files as a language, but so they're a lot, they're a lot more complex than any file or something.
True. All right. So I think I go on that every year. So the top, top three languages used along with Python, three of the four, cause there's a combo. I don't know. I would really call it separate language, but anyway, JavaScript, HTML, CSS combined and SQL. And those basically that block tells you, guess what people build web apps with Python, right?
That's what it says here. And web apps are often five, six, seven different languages, which is partly why the web is hard. Right. But there's that. And then a bash and shell. I mean, that kind of speaks to the DevOps automation side of things. And then CC++ Brian, you're kind of down in that realm.
Right. Yeah. That's most of the half my time. And that's interesting that that's that large still. So that's cool. Yeah. I think another thing you would want to consider here, if you like, look at this is a TypeScript and JavaScript. Those should be the same. If you say HTML slash JS, HTML slash CSS, you should say JavaScript slash TypeScript, which bumps that up even higher.
I think it's interesting. This one here. What do you use Python for the most? Web development. Number one, data analysis and machine learning, which is kind of like the data science block. And then other whole bunch of other. And I think I kind of think of Python as having a one third, one third, one third kind of partitioning where the web development, API development stuff, service functions, all those things live in one third, and then data science lives in another third.
And then there's like the catch all block of everything else. So this kind of says that maybe the web development side is a little smaller, but the random section is a little bit bigger. But roughly, I think that's a good rule of thumb. Yeah. Yeah. And I think finally, legacy Python has been vanquished.
It's been vanquished for three years now. Python three versus Python two. Basically, it's Python three. That's like 94, 95%. Ironically, it went down a little bit. Python two made a bit of a comeback this year. Just barely. That's interesting. It's probably within the variability of the number of people and the type of people that responded to the survey more than it is a real trend.
You don't touch it. Like that kind of thing, right? Well, yeah. And I know some people that have frameworks built up on top with an embedded Python interpreter that it has Python two inside of it. And you'd have to completely change the whole architecture to rip it out and put three in there, which I say just throw the whole thing away and start over.
But anyway, I know that. I'm going to do the big rewrite. I'm going to do the big rewrite. That's actually an incredible joke. It's not a joke. It's a parody video. It's like a music video song. I'm going to do the big rewrite. Maybe I'll put it in the show notes. It's not the joke for this week, but boy, it should be.
So, yeah, 51% by test. Yay! Coming in second, 35% none. This is a problem, people. Yeah. The second most popular framework. Is none. The third is unit test. Is to not ask the question. And I think unit test is largely there because you don't want dependencies, right? If you've got a whole bit of code that's only standard library, and you want to have a couple tests for it, that makes a lot of sense to just not add a dependency potentially.
Okay. Okay. So what's next? I'm just- There's some interesting comments out in the live chat here about like- Oh, yeah. We'll not be in a build system. Tox is not a unit testing framework. Yeah. Yeah. Yeah. Yeah. Does Turing complete make CSS a language? Is CSS Turing complete? If it is, then yeah, totally.
The next is brought to us by Henry Schreiner, who is in the audience. Hey, Henry. Thanks for putting this together and also letting us know about it. So, we've got the scientific Python development guide. This is a, this is a big guy. So this is really cool, actually. So this is, I'm, we're going to post both the announcement post and a link to the guide, but it's both the same place, blog scientific python.org.
it touches on a whole bunch of stuff. some, at first it's just talking about how to use package, how to use Python packages, but then it, it's got a packaging guide, where, there's two forms of packaging. You've got simple packaging and I'm glad they split this up because they, if you just have a bunch of Python stuff, you're sharing, you just need simple packaging goes through hatchling, flit core PDM backend, which I haven't played with, but set up tools.
I've used, three of the four so far. and, and I like that it highlighted that, really, if you click through all of the project table stuff just stays the same. and mostly what changes is you just change the build system, settings. Pretty awesome. and then, but for scientific, you kind of have some complicated stuff too.
And then it even, it talks about classic packaging, but don't do that. Stick with the compiled packaging or simple packaging. That's, that's what you want. this is a great writeup. So thanks Henry. And probably lots of other people, working in this too. But if you wrote it, if you wrote it all yourself, I'm pretty impressed.
But anyway, pretty cool. Yeah, that's a good one. Then this time. Learning how to package up these, your packages is really cool. Also, you know, doing things like entry points. So you basically, once you pipX install something, it becomes a command line. Oh yeah. Capability is really awesome as well.
There's a lot of neat things about packaging that I think not everyone is like, well, I don't want to put it into PyPI and have it open source. Oh, maybe there's other interesting aspects still sharing it internally. Nice. I hadn't checked out. this is kind of daring to do it on live, but I checked out the test, section and yay.
do you want me to cover mine while I'm already up? Yeah, go for it. just to just, I was going to like do this extra attribute thing as an extra, but decided to just run with it. the, quick extra is, I'm continuing to work on the course. Chapter eight is up configuration files. It's a short one, but please don't skip it.
but it's, it's, it's, it's, they're good things. And you're making good progress on this. I am. And it's a blast. And I'm getting great feedback from people. Some, some people from, PyBytes, are, reviewing it and giving me feedback. Some people from JetBrains. it's been, it's been a really good, good community there.
So cool. How about extras from you? Well, I have some Mastodon extras and I came across Mona M O N A app, which is a really cool, um, really cool client for Mastodon. I believe this is Mac only. optimized for voiced over optimized for Mac native design, iPhone, iPad, and Mac. So sorry for people not on that one, but if you're on these, this is really, really nice.
So people can check that out. I think I'm going to move to that. Another thing that we talked about the other day, Brian is, why are these like weird domains so expensive, right? Like we have Python bytes.fm and to renew Python bytes out of is $170 a year. I'm like, why, why don't we just go with.com?
And the biggest winner of these is the.ai, right? There's so many.ai domains these days, right? With all the AI startups. And it turns out that the island of in Anguilla is a tiny British territory with around 16,000 inhabitants, but its domain name is.ai. And so the software developer who manages the domain told Bloomberg, it could generate $30 million for this 10% of the GDP of this tiny island because of the.ai domain.
It got a lot faster on the desktop recently, which is super cool. So now it's super, super fast. Not the kind of thing you can demonstrate well over screen sharing. Cause the latency of the screen sharing outweighs the. Yeah. That, but it has not been on iOS. And now finally, finally, finally it is out on iOS.
This is really just web kit wrapped in a Vivaldi shell. And yes, I know. I know. Thank you for letting me know again. I know that. Is it? However, it's still really nice that if I open up Vivaldi, I could say, carry on where I was on my other machine. Show me the history from my Mac or from my windows machine or from my other, right?
So you can say, I want the easy list and I want ads from, allow action partners. You can uncheck that if you want. You want the ABP anti circum, circumvention list and a whole bunch of others. And you can even add, if you run like a pie hole, you can even add your own blocking list or ads and stuff.
So like super, super cool sync plus ad blocking. I know it's web kid. I wish it weren't, but you know, it's better than not. So there it is. Yeah. but I mean, it isn't really, I'm, I'm not, I don't really care what the, maybe I should, but I don't really care what the rendering engine is and all that stuff.
It's the who's, who's taking the data and sharing it with who is the part that I really care about. Yeah. I, of course. And this, this checks that box, right? Yeah. I do hate when you go to a place and goes, you need to have Chrome to have the best experience. You're like, there's no way I can have Chrome on this device.
You know what I mean? I, I have a, I, brought in a guy to interview once because I was intrigued that his website said, his personal website said best if viewed with Netscape Navigator. And that's awesome. Oh, I love it. so I love that little, and it even had like the animated little globe thing that was going on.
Oh yeah. The little, like the little, like a ship's Jane. Well, I remember that. Yeah. Oh my God. Those were good. Yeah. It was great. Yeah. David out in the audience says federated States of Micronesia. Apparently that's what. FM is. Yes, exactly. Nice. Thanks, David. I love having guests here helping us out.
I know it's awesome. Our audience is excellent. All right. You ready for a joke? Those are all my extras. I am ready for a joke. All right. Let me set the stage. So there was the JFK speech, right? About going to the moon in the early sixties. And it was like, you know, Sir Edmund Hillary was asked, why did he climb Everest?
He said it because it was there and the moon is there and the stars are there. We're going to climb it. Not because it is easy, but because it is hard. Right? Like that. Something like that. Yeah. Yeah. I'll do that again. That was fun. No. We do these. We choose to do these things and the others, not because they're easy, but because they're hard.
No, the joke is, this is the software one. We do this not because it is easy, but because we thought it would be easy. Exactly. Dang it. Why is it still three months and we're rewriting this section? It was supposed to take a week. What a bad idea. Do this not because it's easy, but because we thought it'd be easy.
Yeah. Okay. So David shares with us, there's the old school.am domain for Armenia.am instead of FM. Should we get, should we retire the FM and go like talk radio AM? We could put like a phonography type of filter on our voices and make it sound like staticky and tinny. Would it be great is to, yeah, do a filter and have like both, have the AM and FM versions and have it sound like it's going through any speaker.
simulate going through a tunnel and have it get like real staticky and then come back just periodically. Right. Why not? Yeah. It filter the high end and low end. So there's just like the mid range and that's it. Mm-hmm. So. I love it. I love it. Because with the AM, you have to have the bad car speakers also.
