- Podcasts
- Python Bytes
- #377 A Dramatic Episode
About this episodeTopics covered in this episode: justpath xz back door LPython dramatic Extras Joke See the full show notes for this episode on the website…
See the full show notes for this episode on the website at pythonbytes.fm/377
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#377 A Dramatic Episode
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 377, recorded April 2nd, 2024, so it's not an April Fool's joke. And I am Brian Okken. I am Michael Kennedy. This episode is sponsored by Scout APM. Please listen to their segment later in the show.
If you want to connect with us, we're at Fosstodon on Mastodon at Adam Kennedy @brianokken and at Python Bytes at fosstodon.org. And if you'd like to join us live for the live show, show up at pythonbytes.fm/live. Actually, you can just go there anytime and it tells you when the next recording is so you can put it on your calendar.
And finally, if you want an artisanal handcrafted digest of every week of show notes in your email, so maybe you don't want to take notes while you're listening or you miss an episode, you can get it right in your email. Just go to the pythonbytes.fm and look for friends of the show and you'll get an email.
Yeah, that's a cool thing we just started doing. So if you want to just, you don't have time to listen or you forget to show up for an episode, it'll just show up. And I love the artisanal part, Brian. Well done on that. Very, it's very craftsman-like. Yeah, anyway. I just want to talk about paths today.
Can we just talk about paths? Yeah, just paths. Nothing else. No, nothing. Just paths. Actually, that's what it's called. Just paths. Okay, so here's a tool that is built in Python and just is just a language. It's 1.2% just. I don't know. This is too meta. Anyway, it's a quick CLI tool built with Python.
And when you hear that, the first thing you should think is, PipX install the thing. Because that's how you install CLI tools for Python, right? It gets managed on its own. It's upgradable through PipX and all the things. They made a little mistake here. Like, I should do a PR and put an X on the PipX install just path.
Wait, I thought it was. Oh, no, wait. That was 3.11, not the 3.12 version of that. All these complicated little weird things that you run into all the time. This is just a CLI tool that you just say, tell me how am I doing? What is my path? What stuff? Like, do I have something in my path that links to a directory, but the directory is no longer there?
So if you have something in your path multiple times, maybe it's earlier and later, and you thought it should be later, so that's also a weird thing going on. Or it'll turn it red if there are some that don't exist. Yeah? So that's pretty cool. You can ask for just the invalids just for the duplicates.
Yeah. This stuff is write only, right? Why would you take stuff out of your path? You just keep adding to it and adding to it. But then, like you say, you uninstall things, stuff changes, et cetera. Yeah. I have added my user's Okken.local slash bin. Apparently, that doesn't exist anymore, and I don't even remember ever using that.
B-O-E-H-S. Not sure how to pronounce that. Anyway. Everything I know about the XZ backdoor. And it's a fairly curated timeline of what the backdoor is. But, well, it's about the timeline of how it happened. But the gist, if you haven't heard about it, this is that there was a backdoor added to, I think it's XZ Utils.
XZ is the compression or like an unzipper, zipper, unzipper sort of thing. And archive tool for Linux and other Unix-like distributions. So it's a weird story that start this multi-year. That's the part that's freaky, is a little utility that's included everywhere that starting in 2021, somebody, well, they went by the name of GIA Tan, but nobody really believes that that's really their name, started contributing to open source, added a patch.
And these patches were added like in long, long times apart. And then ended up becoming a maintainer of XZ and then creating in part of the test code. And there wasn't a vulnerability in GitHub, but there was in the distributed TAR release. I don't know. There's a lot of details that I didn't quite follow all of it.
However, yuck and weird. And so the part that I want to talk about really is one, you should just be aware of this. And we're going to link to a good article. I think it's- Brian, before you go on a little farther, because before we watch this, the real basics of it, basically this vulnerability was intentionally put there as a backdoor to break open SSH connections.
So it got caught by like somebody at Microsoft, Microsoft Postgres team, I think, looking at some of their over like an update of XZ causing or actually a slowdown in some of their, I think it was in their test suite or something. They were running micro benchmarks and they saw like a 600 millisecond slowdown or something like, geez, that's weird.
How about that? Testing for the win, Brian. Yeah. And then also, I guess, Valgrind caught some problems with it as well. So I guess good thing that people were paying attention to that and then tracked it down fairly rapidly to a update of XZ. And then, but then some of the unraveling of this is just, okay, so there was a vulnerability.
It got caught. People are updating. That's good because you really don't want this here. However, some of the ways in which this happened are disturbing. And so that's why I think it's useful to read up on this a little bit, partly because this XZ utility was not, it's mostly maintained by one person over years.
So, and then they're saying mean things like this kind of pressured, then this is way back in 2022, pressuring the person into adding another maintainer, then, Hey, there's another maintainer ready and they're adding garbage to it. So. And they just happened to work for some state sponsored hacker group.
I'm sure they'll do a good job maintaining it for us. Yeah. So maybe. And, and there's, you know, basically, I guess, watch out for this, but also I think. So one of the things I wanted to talk about is how do we, how do we avoid stuff like this? This is, I don't have an answer for it, but there's a lot of people discussing like, what do we do about it?
Including a glyph whose answer may have been just is I'm willing to link to his article called software needs to be more expensive. Essentially. We, we get a lot of free software. Maybe we should start paying the maintainers so that people, I mean, burnout is a real thing, but you pay people, they will work on stuff or somebody else will.
It's, it's a, his idea is just give every software engineer with your company a discretionary budget of like, say, 50 bucks a month or whatever you want to do. And, and they can distribute that money to open source maintainers however they want. Interesting idea. I don't think if, even if that was in place, I don't think that it, which I think is a good idea.
I don't think it would be, have gone to XZ really. Cause I would have thought things like, you know, Django or, you know, it's Python, but, but would I give money to a little zip utility? Probably not. Anyway. So I think this is a good thing to keep up on. And, and I do this idea of like bringing on maintainers.
You know, you say you probably would think that the 50 bucks wouldn't go to XZ, but I really like Glyph's article. First of all, well done Glyph. That was a very nice article you wrote and I enjoyed reading it. It's also a very thoughtful idea. I think his idea is basically instead of trying to get large companies to come on and be sponsors of open source projects.
Usually that's a huge negotiation and there's all sorts of stuff and right. It's just not easy. Just give everybody 50 bucks a year or a month. I can't remember. I think it was maybe a month. Anyway, give people a card and they could just donate it to whichever open source project that they would like.
And I agree if there's a thousand people that did that, Brian, that XZ probably wouldn't make it. But wouldn't it be awesome if there was a world where there were so many people who were just donating to open source that it became super lucrative that second tier projects were even potentially full-time things like rockstar developers, you know, like ballers are rolling up in their Ferrari because they're running FastAPI or, you know, Sebastian is doing that.
I mean, that would be really cool. Think of how much more open source to get created if it was sort of a gold rush as well. So yeah, I think it would be neat. And also even not necessarily a full-time job, but just to be able to say, even if I have to take the time unpaid from my normal job, if I took like a day a week off and just worked on open source, my open source project instead.
So thanks for that. Very cool. Yeah. Yeah. I'm glad you covered this. Well, we would like to thank Scout APM for sponsoring this episode. Thanks, Scout. Let me tell you real quick about Scout APM. They're big supporters of Python Bytes, so we appreciate that very much. So if you are tired of spending hours trying to find the root cause of issues impacting your performance, then you owe it to yourself to check out Scout APM.
They're a leading Python application performance monitoring tool, APM, that helps you identify and solve performance abnormalities faster and easier. Scout APM ties bottlenecks such as memory leaks, slow database queries, background jobs, and the dreaded N plus one queries that you can end up if you do lazy loading in your ORM.
And you'll love it because it's built for developers by developers. It makes it easy to get set up. Seriously, you can do it in less than four minutes. So that's awesome. And the best part is the pricing is straightforward. You only pay for the data that you use with no hidden overage fees or per seat pricing.
And I just learned this, Brian. They also have they provide the pro version for free to all open source projects. So if you're an open source maintainer and you want to have Scout APM for that project, just shoot them a message or something on their pricing page about that. So you can start your free trial and get instant insights today.
Visit by them by set of him slash Scout. The link is in your podcast player show notes as well. And please use that link. Don't just search for them because otherwise they don't think you came from us. And then they'd stop supporting the show. So please use our link by them by set of him slash Scout.
Check them out. It really supports the show indeed. All right. Now, Brian, let's talk about some fast stuff. Okay. L Python. Have you heard of L Python? No. This is news to me. So L Python is a high performance type Python compiler. So basically if you type annotations or type hints on your Python code, it can aggressively optimize and compile your Python code.
Basic math. So it knows about, you know, sized integers, for example, in 32 and so on. It has a just-in-time compilation, which you can get if you don't want to run a compiler itself. You can just put a at lpython decorator onto a function and it'll just compile at a runtime, which is kind of cool because then I guess you probably don't need to distribute binary versions on your packages, your wheels, and so on.
It's interoperable with CPython. So basically, you can call all the CPython functions. And it's also, if it works in CPython, it works here, it'll work in CPython, basically. Is it a subset, I guess, in a sense? And open source. All right, let's play with it for just a second. So if you go to dev.lpython.org, it loads up in the browser.
And you can notice it loaded pretty quickly, although I have gigabit internet. It's still loaded pretty quickly. See this picture here on the screen behind? This is the Mandelbrot set, which I don't know how many people have done fractals, but it's drawing two different copies of the Mandelbrot set in, what is that, a 600 by 600 image, maybe?
Okay. About a black and white one and a color map one. It says it took a little under half a second to compile it and 80 milliseconds to generate those two images. And you can come over here and you can say, like, all right, what I'm going to do is, what is that number? I'm going to make this, let's say, 355 iterations.
It's by L Compilers, is what it says at the bottom. So what is that? Lcompilers.org. Yeah. Good question. It has no public members. Okay. But it is exciting. So yeah, nor does it have a web page. Hopefully it's not an APT crew. Anyway, no, seriously, it looks like a cool project and people can check it out.
Actually, your Python output more dramatic with a, I'm just kind of joking, but it's kind of fun with the name. He's got a tool called Dramatic. And what it does is it slows down the print output, which, you know, why would you want this? I don't know. It might be kind of fun if you're doing a demo or doing a presentation or something, but it does, it's just pretty fun.
So you can turn it off, though. He's got a way to turn it off as well. But you can do speedups and make it. Anyway, I think this is... You want your Python code to look like ChatGPT or something like that, right? Yeah, as it's typing out and stuff. I think it's kind of, especially if you're running, I think it'd be useful.
He gives an example of doing it. Like, for instance, I guess this isn't an example. But if you're doing command line interface interactions with a user, I think it is helpful sometimes to have the output go slowly so that it's visually interesting to have it not just pop up with a mountain of text for people to read.
This is beautiful. Laser beams. Laser beams. I like that one. Yes, let's do it. The binary path kind of looks kind of, what was it, matrix-y sort of a look. Listen, Neil, you can't go down there. There was one that I really liked a lot. The burn is neat. Crumbles. These are all animated GIFs on the GitHub repo that Brian's thinking, too.
Yeah. Yeah. So I think it'd be cool for your... I wouldn't do it all over the place. But for instance, if you had a... Probably not a help, but an about. And that's sort of where it's showing here. Where you show the credits and who's worked on it and some more info and stuff. That'd be fun to do a fancy dramatic output for that.
It'd be great. So anyway, that'd be fun. If you use both this and Textual to turn it into like a Vim clone or something like that with fun effects. Ooh, that's fun. The pour is neat. Yeah. It's almost like the Tetris terminal in a sense. Not quite, but almost. Anyway, I guess that is just a fun wrap up of our topics.
So you can have a little input screen. So you can have kind of like an input dialogue maybe. And it's very visual, but doesn't take over everything. So anyway, kind of fun. Textual and rich, continue to impress. Yeah. How about you? Any extras? I've got a few. Let's see. Let's start with broadcasts straight out of the Philippines.
So my keynote, which was entitled The State of Python in 2024, I give two weeks ago at PyCon Philippines is out. And the production quality is super high on this video. So they did a really great job. It was a fun conference. But if you would have loved to hear me give a presentation on The State of Python in 2024, but you weren't there, then you can still check it out now.
It's awesome. And I really enjoyed it, by the way. Yeah. Yeah. Oh, thanks so much. A bunch of the people whose projects we talk about on this show actually get a shout out there. So all right. That's thing one. Thing two, I just want to encourage people. I've not logged in my GitHub, so I can't unfortunately show it here.
But Brian, do you go to your GitHub and you know there's that feed in the middle that shows all the stuff that's going on and who starred this and who's doing that and stuff. Do you ever use that thing? No. That's the way I'm like, that's the thing's stupid. This is like 80% of the page and it's in the way.
What is this? How do I get past this? I've started paying attention to it and I've found so many cool projects. So I want to inspire people to follow people on GitHub. You can follow Brian and me and see what we're starring. But who's starred what? Who's forked what? I found probably three or four really interesting projects just last week by just kind of skimming that for five minutes a week, you know?
That's pretty cool. Yeah. I was really surprised that it was useful. I guess I need to follow more people. I don't know. Exactly. Because I should as well. Because I hadn't really been following more people because why do you follow them? Well, maybe this is why. On to the thing that continues to perplex me, which is interesting, is that the official way that Python works is through blogspot.com.
But nonetheless, important stuff for you all. If you are living in the past, like when I ran JustPath earlier, it said your Python 310 thing is stupid because that doesn't exist on your computer anymore. But if you have 310, 3.9 or 3.8, there are security updates for the older versions of Python, but not the new one.
They call them boring security releases. I never think of security releases as boring. They either go from slightly interesting to, oh my gosh, you have my full attention, like the XZ thing. Anyway, people can check that out and should probably upgrade if they're running one of those versions, 310, 3.9 or 3.8.
And if you're running 3.7 or older, too bad, so sad, no updates for you. They may be vulnerable. They may be not. I don't know. And that's just the way it works if you're out of support. That's why you should stay on some of the new stuff somewhat. Like the new stuff's really been fairly easy to upgrade to.
I haven't. It has been. In a lot of, most of the, well, maybe it's just my projects, but I haven't run into any issues really. I think if you stay one version behind, it's, it's, there's no effort at all almost to do it. Going from 3.11 to 3.12 was actually the hardest upgrade I've ever done because there was quite a few dependencies I had that use something that was removed as part of the dead batteries thing.
Or something like that. And I can't, and it just wouldn't run. And I'm like, oh my gosh, I got to, I was just waiting until some dependency of a dependency got fixed, but it was slow for some reason. I don't know why. But, you know, that got fixed within a few weeks, right? So if you waited a little bit longer, it should be easy.
Yeah. So one of the questions I got while we're looking at this, how many, I used to run a lot of versions of Python on my, on my Mac. But I got a new Mac recently and I decided to mostly push most, I only run a couple. And then I push, do most of my multi Python version testing in CI instead of locally.
I don't have three 10. I definitely don't have anything else. So three 11 or three 11 or three 12. Those are the ones that I got right now. So I'm with you. I tried to, I did not put too much stuff on there. The only reason I really have older stuff on there is because I haven't gone to the trouble of removing it because there's so a bunch of virtual environments I've created off it that I wanted to deal with.
And then so that, so that talks can find those and I can find those locally, but yeah. Yeah. You know what I might do? I'm not doing it because I don't have a huge set of older pythons I test for. But if I was like you where I did that, maybe I'd have Docker. We have some Docker container, so older ones, you could just do Docker run Python, this command, you know, this file or whatever.
I don't know. Yeah, maybe. Keep it cleaned up. Yeah, but they run side by side pretty well. So. Yeah, they do. Anyway. Just got to keep your path in order. So just path. Just path. Just path. Just Jack. So should we have some fun, something funny? Ah, yes. This one, actually I got it pulled up, but this one is from you.
Thanks again for a wonderful episode. And thank you, everybody, for helping to make Python Bytes a wonderful podcast. And we don't ask this much, but if you find this amusing or helpful, please share with a friend. And you can sign up for one of the great ways to do that is to sign up as a friend of the show.
