- Podcasts
- Python Bytes
- #431 Nerd Gas
About this episodeTopics covered in this episode: pirel: Python release cycle in your terminal FastAPI Cloud Python's new t-strings Extras Joke See the full…
See the full show notes for this episode on the website at pythonbytes.fm/431
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#431 Nerd Gas
And if you'd like to connect with us, you can, or suggest topics, please feel free to send us an email or head on over to either Mastodon or BlueSky and the links to both of us and the show are in the show notes. And you can join this episode live or join it live usually Mondays at 10, but sometimes other times.
plus background information. It's a lot of fun. So check that out. Also, I think it'd be cool to have a cool first topic, Michael. What you got? This was a nice, easy one, easy to adopt, easy to appreciate, I think. So you and I, we spend a lot of time talking about, here's the new things for this, and here's the new thing for Python, and here's the new features, the next version, and test the alpha, test the beta.
if it's the system one or if it's a virtual environment one, you can write Pyrelle check and it'll give you a nice summary of what's going on here. You can say you're using Python 3.13, which is actively maintained, and it will be this good for this long. You can say Pyrelle list and it'll give you a list of all of the last 10 or so versions when they came and when they went.
I just can't be bothered. Anyway, that's what this is. What do you think? I think that's pretty fun. Yeah. Also, yeah. Yeah. And it uses the rocket emoji, which will make a reappearance, right? Yeah. I do like the rocket emoji. Indeed. So there's a little bit else you can do with it, though it does not particularly interest me as a tool, nonetheless.
You can also type Pyroguess, and it will do things like give you various trivia about the release history of Python. So, for example, it might ask, when was Python 3.11 released? Or who is the release manager for 3.6? And it gives you a multi-choice select, and you can pick, and it'll tell you if you're right or wrong.
Back to, we're going to go back in time. This is episode 123, which, when was that? That was like in May 26, 2019. We recorded it and it came out on the 29th. Right. And we had no idea. Things were different back then, 2019. 2019, different world. But one of the things that started in that was when we announced, well, we didn't announce it, but we covered it on the show way back in 2019.
Well, today, Sebastian Ramirez, the dude that created FastAPI in the first place, he announced that he is forming FastAPI Labs, a new company, and that they are, the FastAPI Labs is a new company and they're building a fast api cloud so we're going to take a look what does this mean it kind of means that you just get to build your fast if you do this the promise is you build a fast api application and you can just deploy it with um fast api deploy just a single line and and then they'll they'll host it on their um like a subdomain of the fast api cloud.dev so um kind of interesting. I'm intrigued. So I've definitely joined the wait list. There is an announcement blog post of by the same team behind FastAPI. So this is, this is kind of an incredible, he's built FastAPI up and it's not just, not just Sebastian. Now there's other people working on it.
It's built on top of Pydantic and a couple of cool things that I can't remember. But, But the team is, the blog post talks about the problems of deploying to the cloud. Now, there is documentation on the FastAPI. We've often commented that the FastAPI documentation is excellent. They've done a great job with documentation.
But it is not trivial to really deploy anything anymore, aside from maybe a static site. But you have to get concerned with a lot of stuff, especially if you start growing with security. And so they are looking at that security bit. So it's so far, it looks like Patrick Armino, Alejandro Sanchez, Sophie Van Langen, sorry, and Sebastian.
So whatever processes they build up, it won't make it so that you're stuck with FastAPI with their hosting. So essentially this is hosting for FastAPI. So kind of neat. Yeah, congratulations, Sebastian and crew. That's awesome. Yeah. It is a hassle to deploy things. And presumably these folks know the best way to host FastAPI.
FastAPI might be tuned for the infrastructure that they choose over time. You know, I'll have to look more into this. Like how do you host a database and things like that. But presumably you can do things like use a CNAME for your app at fastapicloud.com and you'll get your own domain name and all that sort of stuff.
You would care a whole lot less, right? If it's just an API and it's not like your landing page or whatever. Yeah. Yeah. Anyway. Cool. Cool stuff. Absolutely. Well, what else is cool, Brian? What? NordLayer. Let me tell everyone about our sponsor and NordLayer here. So NordLayer is actually a pretty neat product. And this episode of Python Bytes is brought to you by NordLayer. So it's a toggle ready network security platform for modern businesses and combines VPNs like you would expect, of course, from the parent company, Nord. However, it's also access control, threat protection, visibility into what's happening in case you spot some sort of malware. All of those in one easy use platform. There's no hardware, no complex setup, just secure connections and full control in less than 10 minutes. So it's easy to start with quick deployment, step-by-step onboarding 24-7 support. It's easy to combine. It works with existing setups in all major platforms.
And NordLater is easy to scale. Just add users, features, servers in a few clicks. SSO and provisioning included. If you want zero trust network access, you got it. It provides those network zero trust solutions. It adds threat protection to keep malware, ransomware, and phishing from reaching your endpoints, including servers. How cool is that? Increases your threat intelligence to spot threats before they escalate and helps businesses achieve like HIPAA compliance and stuff. So if you're responsible for security of your software or data science team, you should definitely give NordLayer a look. As Python Bytes listeners, you get an exclusive offer of up to 22% off NordLayer yearly plans plus 10% off the top with a coupon. And that coupon is Python Bytes dash 10. If you visit the link in your show notes, there's a landing page and it gives you the code right there. So Python Bytes dash 10. Try NordLayer risk-free with their 14-day money-back guarantee.
So t-strings are going to come in 3.14 in the Py release. So there is one of the authors, Dave Beck, or Dave Peck, sorry, Dave. wrote an article about the Python's new t-strings. And I'm kind of excited about it because when we talked about it on the show, I'm excited about them, but I also, they're like template strings.
But how are they different than f-strings? When would I use one over the other? And I got all these answers in this blog post. So he talks about what's the big idea of t-strings. And interestingly enough, We've loved f-strings so much that they're used inappropriately. And I didn't really realize that there's security problems.
So there's like comments on using f-strings to take user data, user input, and fill in like maybe a SQL statement. Don't do that. You want to clean your user input first. So people have been using it and or possibly to use it to generate a web page. So you've got a possibility of somebody inserting cross-site scripting or other bad things that you don't expect by just sticking user data into HTML.
So misusing f-strings is one of the reasons why t-strings are kind of a cool thing. So the template strings are a generalization of f-strings, and they keep things separate. So f strings actually create a string, but t strings don't create, when you create a t string, you don't get a t string, you get a, or a string, you get a template object.
And this template object has these two separate things. You've got, it's got a, I'm going to scroll down, it's got a strings section and a values. And so it keeps, they're both tuples of things, of what's inside of it. And you can iterate through them. There's all sorts of cool stuff you can do with templates, these template strings.
It might be other. It might be something else. And the interpolations have all the pieces in place. And you can even dive really deep into it and have things like what's the value of the variable that you passed in, the expression name, the conversion, the format specifier, even if you've got format specifiers on it.
And this is all sorts of nitty gritty detail. But the gist I'm taking away is they're just really kept separate. So you've got like the template and the things you're passing into the template as completely separate things. Why is that great? Well, one of the great things about that is you can, like in the example of SQL or HTML, you can take the user data and check all of that and run things over it.
So if you've got user data and you expected a string, you expected people to not be nefarious about it. You can do like a safe HTML or something, convert like the brackets into something else, strip out SQL statements so that they're not, it's not a, you know, escape things, escaping things and making them cleaner.
One fun example in this, I love this. A fun example is how to create PigLatin using template strings. And so there's like this PigLatin converter that takes a template and returns a string. So you're able to have like a hello world and then you run PigLatin on the template and it converts the template into, we've got these converter functions.
You can convert into actual string. And I kind of, okay, I went down a rabbit hole on this because this example says to convert, I kind of forgot the rules of PigLatin because it's been a while since I've been a kid. But it says essentially if the first character is a vowel, if the words in the word, the first character is a vowel, then you append yay on the end.
But if it's not a vowel, you take the rest of the word and take the first character and put it at the end and say a. And I don't think that's correct. Or I think it might be correct, but I forgot the rules. So I looked it up. And Pig Latin, sorry about this, but Pig Latin, it says that it's not just the first constant, but it's the first constant cluster.
So I don't think this is the correct implementation. Well, it might be one that fits on one screen. Yeah. So Brian would translate into Ian Bray, not Ryan Bay. You know, anyway. Okay. The diversion. But anyway. So there's some great ideas for when we finally have t-strings and we ship Python 3.14, we can do things like possibly having everything more safer and more flexible.
One of the things that's coming up possibly is, oh, where'd it go? 787. So there's a proposal for safer subprocess usage with like Schlex and Subpros, which I love Schlex. But you could use a, if those could be implemented with t-strings, they'd be a lot safer. So there are some security vulnerabilities in these things.
So it could simplify the implementation. You don't want to ampersand, ampersand, do other thing as part of your command, right? Yeah. So this, and then, so having a lot of things that to take user input and create other things, Having them use t-strings might, and having like some quick, safe conversions, instead of having to convert user data ahead of time, you just grab the user data and stick it in a template string.
And this one, I think, is also pretty interesting, especially if you're learning the terminal or you're just like, how do I do that again? Zev. Have you heard of Zev? No. It's a simple CLI tool that helps you remember terminal commands. So if you're sitting here and you're like, you know, I don't really know what I'm doing with this stuff.
I can type Zev and it says, what do you want to do? It says, show all files in this directory with human readable sizes. And it says, okay, great. Here are a couple of things you could do. And it gives you a select list like ls-lh or I think it was find is one of the options. But basically it gives you a bunch of options to do those types of things.
And up it goes. Pretty cool, right? Yeah. Yeah. So this project runs on top of LLM APIs like OpenAI, Google Gemini, or local Olama. So basically it sends that command over and then it looks at all the responses. But it probably does a bunch of work to format it for you. But more importantly, it puts it right there in your terminal where you can just select the answer and hit enter.
You don't have to go to chat, copy it, move it back over, run it. You know, like that sort of round tripping. Yeah. Okay. Yeah, so suggestions that you might use are like show all running Python processes, find all Python files modified in the last 24 hours, show disk usage for the current directory, check if google.com is reachable, etc, etc.
So yeah, pretty neat. It does say everything's generated by LLMs, so careful. Because you know how it goes, right? It could be delete all files like this in this directory, and in this directory part gets forgotten. rm-rf star, okay. Slash star, slash star. Anyway, super simple, but you set up an LLM provider.
I recently wrote a really cool program that I'm, program, utility, simple tool, that I use that I'm thinking of making public somehow, but I also don't need another thing to babysit. But basically, if you're in a Git repository, you can just hit a command and it will look at all the new files, the change files, and then correlate that with a local LLM, coding-based LLM.
Yeah, exactly. You could totally do it. And it improves it in this way. You're like, oh, gosh, I did improve it in that way. Look at this show. Aren't I smart? And before we carry on looping back to your topic, the t-strings, Henry Schreiner writes, I've been wondering if this could be supported in the logging module.
Since it's an actual type, it could be detected. Yeah. That would be cool, right? maybe have a slightly different output with more information about the parts of the string. Yeah. Indeed. All right. Well, we're back to extras. I really should have put up. So one of the things I didn't cover about the t-strings, we'll get to my extra first or second, but in the T-string article, there is a link to a whole bunch of examples of other non-silly examples of t-strings.
So he does Pig Latin in the article, but there's a bunch of others too. And one of them is a treatment of logging with t-strings. So check that out. My extra really is I kind of went – speaking of rabbit holes, found out Monty Python and the Holy Grail turns 50 this year. So 50 years ago, Monty Python.
Oh, we found them. No, you couldn't have found them because, like, they're not native to England. They're tropical. So great discussion about coconuts. And apparently that is nerd gassing. I didn't know the term. So I looked that up. Nerd gassing was coined in 2008 by John Scalzi, a sci-fi author and blogger.
And nerd gassing is the venting nerd, venting, the venting that nerds emit when some often minor detail of a book or movie or TV show, comic book, et cetera, either conflicts with canon or hand waves through some suspect science. And so I was totally nerd gassing in the, in one of our topics when I went off on what the correct rules for pig Latin are.
So, yes, that's, you were. And I do the same thing when people mess up that quote from Captain Picard about may the force be with you. Okay, so let's go on to the next. Nice. Okay. Please write us and tell me that that's wrong. All right. This is it for your extras? Yeah. I would like to also point out for those as a follow-up who don't know, because Python, the community has done a poor job of this.
All the logos for Python are snakes, but the name Python came from Monty Python, which is why it's relevant on this show. yes yes and that's why we have wheels because they're wheels of cheese because they used to the cheese shop for pipey and yeah the cheese skit i mean if you haven't seen the cheese skit from monty python you have to go watch the cheese skit because it's awesome the rabbit part is my favorite by far okay here's a quote this is not the joke this is actually a real thing so it has a picture of firefox and it says you either die a hero or you live long enough to see yourself become a villain. And underneath it, it shows the preferences in Firefox for website advertising.
Allow websites to perform privacy preserving ad measurement. This helps the site understand how their ads perform, et cetera, et cetera. Like this is built into Firefox now. And there was like some terms and use changes about how the stuff you submit in Firefox is now being used and being shared and so on and oh right firefox was like one of the last bastions of privacy like real privacy the antithesis of chrome which is you know tracking and correlating and reselling everything so
both you brian and me we care about these things and for example brian use vivaldi i use vivaldi quite a bit but i also started using zen zen browser that's what's actually on the screen right now. And I love Zen Browser because of it's such a clean, nice little layout. And it's based on Firefox as well. So when this stuff got announced 10 months ago or whenever it was, there was over on the Zen Browser GitHub repo, there was like, so what is Zen going to do about this? And at the time there wasn't a lot of clarity, but now Zen 1.2.1 is out and it's got some features. One of the things it says, if you go read the full release notes, it's got some new But in response to recent privacy concerns, bracket about Firefox, we've significantly strengthened Zen's privacy measures.
Previously, we only disabled telemetry, but other things were being done. Now Firefox telemetry has been completely stripped out of this. Basically, they've, much like Vivaldi de-Google-ifies Chrome, Zen has had to go to the step of actually de-Mozilla-fying. I don't know, whatever, what is the term here?
That's a problem. But they're also doing good things like starting to create like docs alternatives that we've covered before. But, you know, I guess things must be, people must be resold and ads must be put upon people. And that's the way it seems to be. I don't know. I don't agree with it, but that's how it is.
Testandcode.com. Okay. Next, or you go to jail. That was such a fun episode that we did last week. Yeah. But I pulled up this episode, not because I care about that, but I've changed the way that transcripts work. So previously we had transcripts are every word spoken for 30 minutes or however long the show is.
And I thought, well, that should go on its own page. You can go and check it out. But I'd like you to be able to come to the page and hit Command-F and let you know what we said about, I don't know, AI or... We'll just pick the sponsor because it doesn't show up too many times. But now the transcripts show up on the main page just as a section farther down.
You can collapse them if you like. But it lets you click on the time link anywhere and play it back as you go. So if you find something in the transcript and you're like, I just want to hear it, you just click right there and boom, off it goes. Put tons of effort into making these transcripts accurate and good.
They're not perfect. Please, again, don't email me. There is an imperfection. I have discovered you were wrong. But we make a lot of effort to say things like PyPI are spelled correctly. And other words are correct in here so that when you search for them, they show up. It also powers our search engine that you can just search and even add to your browser that we've talked about before.
But transcripts are slightly better. And the pages are slightly more useful. So visit the website. Yeah. And that helps us track every part of your life because we know we don't do that. just we need just one cookie to get it started no just kidding we have no cookies okay that's it for my extras joke yeah this is a this is a re-envisioning a re-envisioning of an old joke i think it's pretty good there's this person running a china shop and there's a big sign that says china shop and then above it my code base and there's a character here holding a giant angry looking bull by a nose ring. And the person holding it says, mind my friend comes in with me and the bull is labeled cursor. Welcome to the error of AI, huh? Just add that one feature.
Okay. Yeah. Something like that. That's, I don't know, somewhere down here in this thread people talk about stuff. I don't know. Anyway, I think it's a pretty appropriate joke. It's pretty good. Yeah. Yeah. It's funny. Good, good, good point. Yeah. Indeed. Indeed. All right. Well, that's what I had for our joke.
