We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode #432 How To Fix Your Computer

#432 How To Fix Your Computer

2025/5/19
logo of podcast Python Bytes

Python Bytes

AI Deep Dive AI Chapters Transcript
People
B
Brian
Python 开发者和播客主持人,专注于测试和软件开发教育。
M
Michael
帮助医生和高收入专业人士管理财务的金融教育者和播客主持人。
Topics
Brian: 我发现使用UV工具安装pre-commit非常方便。传统的pre-commit安装方式可能对非Python开发者不太友好,但UV工具简化了这个过程。通过简单的命令,例如`uv tool install pre-commit`,就可以全局安装pre-commit。此外,结合`pre-commit-uv`,UV还可以创建虚拟环境并安装pre-commit所需的依赖包,从而加快初始安装速度。尤其是在CI系统中,使用Docker镜像时,UV可以显著提升首次pre-commit的运行效率。最重要的是,使用UV安装pre-commit甚至不需要预先安装Python环境,这使得整个流程更加简洁高效。我强烈推荐大家尝试使用UV工具来管理pre-commit,它确实能带来更好的开发体验。

Deep Dive

Chapters
This chapter explores a more efficient way to install pre-commit, leveraging the 'uv' tool. It simplifies the installation process and speeds up initial cache creation, particularly beneficial for CI/CD environments.
  • Using 'uv tool install pre-commit' simplifies pre-commit installation.
  • Employing 'pre-commit-uv' speeds up initial pre-commit cache creation.
  • 'uv' eliminates the need for a pre-existing Python installation.

Shownotes Transcript

Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 432, recorded May 19th, 2025. I am Michael Kennedy. And I am Brian Ocken. And this episode is brought to you by NordLayer, awesome bolt-on security that you can add to all of your dev stations and servers and so on. I'm going to tell you more about that later. If you like social media things, you can stay up on a lot of announcements and follow the show, follow us.

Fostedon, Mastodon, Blue Sky, links at the top of the show notes in your podcast player. Doing this live most days, most days, at 10 a.m. Monday Pacific time, just pythonbytes.fm slash live.

Brian was being a world traveler, so we didn't do it last week, but we're back at it. And our email list is getting better and better. So be sure to sign up as a friend of the show. You'll get cool summaries and extra information to get more out of the episode. Like before, as in pre, not after, Brian. Yeah, as in pre. Like pre-commit.

I'd like to cover an article that from Adam Johnson, pre-commit, install with UV. And it's just a short little tip, but I

I didn't know you could do this. So pre-commit normally-- I've installed it before, but I can't really remember how to. And Adam brings up that the install guide is maybe not the friendliest, particularly for developers who don't use Python. But also, anyway. Hmm. I guess pre-commit's used for other stuff too. Right.

So, but you can use UV. So that's really the article talking about a couple of things. Not only just use UV. So you can use UV by saying UV tool install pre-commit. And now you have pre-commit installed for all of your projects in one place. And then, but...

The recommendation also is to use with pre-commit UV. So this extra thing is this with you is pre-commit UV. It says use UV to create virtual environments and install packages for pre-commit.

and also comments that, why would you do this? Because it speeds up the initial install. And so the initial thing. And so if you've got it loaded on your local computer, apparently the first run of pre-commit with all of your extras,

it'll probably be a little bit slower than later because there's a pre-commit cache that goes on. But for instance, if you're doing like Docker images in your CI system, there might not be a cache there. And I might be just talking smoke because there might be a way to get around it with containers anyway. However, if you really want that first initial one to be a little bit faster anyway, so using UV might be a good answer.

so anyway also so that's not that's actually not why david or david adam recommends this yeah he recommends it just because it's an easier install and it sure is you just say the other thing is you don't even need python installed for that to work that's true yep but uh uv tool uv tool install pre-commit with pre-commit uv and then you've just got pre-commit working um and yeah right you don't even need python

I'm already installed. It'll UV the UV packaging manager and all that stuff and caching will just work. And I kind of love I've been using UV tool for a lot of stuff lately. It's pretty slick. So, yeah, I just tried this out this morning. Worked like a charm. Love it.

Yeah, that's super neat. And yeah, UV all the way. I think they're doing great stuff. I actually have a couple of things tangential or directly related to UV as well for the week. So let's get to it. The next thing that I have is kind of like that, but it's not UV. Hold

Hold on. Hold that thought. Here we go. So this thing is PEP 773 has been accepted by, created by Steve Dower, who does a lot of the Windows plus Python work, core developer, but also works at Microsoft. So it is a Python installation manager for Windows. So it's...

maybe I'm not quite getting it right when I describe it this way, but to me, it feels very much like an official windows based UV like thing, at least for managing the Python side of stuff. Okay. So it's put there as a,

a one manager to rule them all, PyManager. So it goes under the colloquial name of PyManager, but I believe its official name is something like the Python Manager for Windows type of thing, something like that. And the idea is there's right now multiple ways to get

Python onto your computer and they're unrelated and different. So I could go to python.org and download it. That would give me a PY launcher that I can run and do things. Or I could go to the Windows Store and install it that way, which is another thing. Or I could use WinGet or I could use NuGet to install it. It's like, okay, what do I do?

Right? So the idea here is that this is one thing that does all the stuff that those do. You don't have to think about it. You can get it those different ways. So if somebody told you to go to the Windows store and get Python, you would get PyManager as an MSIX, which is the installer. Hmm.

runtime for Windows, like the install. It's like a PKG for Mac. So you would get that there, or you could go to python.org and download it, and you would get the same thing and the other ways you get it. So it's kind of a similar way to get Python that's consistent across all of them. And what's cool about it is it's super easy to use. So if you just type the word Python, it will launch the best, in quotes, the best application

Python runtime that either is already there or like here's where the UV stuff comes in, or it'll auto install the latest version of CPython if it's not there. So at first it's kind of like a shell of Python and they used to have that. And I think it said something like, I don't know if you remember this, Brian, but in Windows in the early days, you used to say, you don't have Python, go install Python. If you type the word Python, you're like, great. Could you help me out or just, okay, I'll just go do that, I guess.

So what this one now does, it says, okay, great. Like UV virtual environment or UV tool, if you don't have Python, it just says, great, we'll get the latest one and we'll run that. So that's pretty cool. I thought there was, for a while, there was like, if you type Python, it'll like open a window to say, hey, do you want to install this? And if you said, okay, it would take you to the store or something like that. Yeah, maybe that's right. It would take you to the store, wouldn't it? Yeah.

Yeah. Sometimes it's... Yeah, I don't know. There were some funky ways. So it has... I believe py is still there, but it's going to have the same subcommands as well and so on. So like install, uninstall, list, run. And one thing that's kind of nice is you can also get Python 3 commands in Windows if you just add something to your path. Because traditionally, I believe it's been a while since I've played with it in real detail, but...

I think it used to be you had to type Python only, like only Python to work. And Python 3 didn't work on Windows, but on Mac and Linux, only Python 3 worked, not Python by default. You know what I mean? It's like, why are they different? And so this also brings a little bit of unifying there. Okay, just in time for nobody to use Python 2. Yes, exactly. Exactly. Yes, okay.

Yeah, maybe they're like, well, at least we should be consistent. But I'm here for it. I'd be fine to cancel Python 3 as a command and just go, you have to say Python 2 if you want Python 2. Don't make the thing you should be doing harder than the thing you shouldn't be doing. Anyway.

This should be mainstream by Python 3.15, and the traditional installers will disappear in 3.16, like 2027. So it's not a huge change right away, but I believe, what does it say? I believe it says the top. This is just a standard, right? It's not one of those things that's in a version of Python. So soon, soon, soon. Yeah. Two years. Be here before you know it. Yes, it absolutely will. Before we move on, yeah.

Yeah, I'd like to thank NordLayer for sponsoring this episode. NordLayer is a toggle-ready network security platform built for modern businesses. It combines VPN, access control, and threat protection in one easy-to-use platform. There's no hardware and no complex setup, just secure connections and full control in less than 10 minutes. It's easy to start.

with quick deploy, step-by-step onboarding, and 24/7 support. It's easy to combine, works with existing setups and all major platforms, and NordLayer is easy to scale, add users, features, or servers in a few clicks.

So if you are responding

responsible for the security of your software or data science team, you should definitely give NordLayer a look. As PythonBytes listeners, you'll get an exclusive offer up to 22% off NordLayer yearly plans plus 10% on top with a coupon. Just use code PythonBytes-10. Try NordLayer risk-free with their 14-day money-back guarantee. Visit PythonBytes.fm slash NordLayer to get started.

Again, that's pythonbytes.fm slash NordLayer. The link is in your podcast player's show notes. Thank you to NordLayer for sponsoring Python Bytes. Indeed, indeed. Now, oh.

I'm up next. So this one, this news broke last week, but like I said, we weren't recording last week, so I'm going to announce it this week. Maybe you've heard it by now, but unfortunately, it's very sad to me to hear this, but unfortunately, Textualize, the company behind Rich and Textual, founded by Will McGugan, is shutting down. So...

It's better to try something and fail than not try at all, right? So some of the quotes from Will's post announcing this is bittersweet news. The business experiment ends, but the code lives on. Obviously it's super popular, right?

And if we go to GitHub somewhere, what are we looking at for stars? Yeah, 28,000 stars, super, super popular. But as a business, it's no longer a thing. So Will says, it began as a hobby project layered on top of rich, but it grew into something that looked impossible to do with

and yet somehow it doesn't. So despite the success, the team couldn't pinpoint a single endpoint big enough to sustain a business model. So the company is winding down probably about now. It said in a couple weeks, but that was a few weeks ago. Projects themselves aren't going anywhere. They're stable, battle-tested, and will continue. So I want to say thank you, Will, and everyone on the team for this. It's a big contribution to the community and to the

Is it here? Let's see. Oh, I don't even see a sponsor. A sponsor option. Will, put a sponsor option for us here so we can recommend people go and sponsor the projects.

Yeah. At a minimum, help them keep it going strong. No, I love what Will has done with Rich and Textual. And we were all rooting for Textualize. And I don't, I mean, yeah, it's not going to stay a company anymore. But I think having it be a company while it was made Textual into something like super cool. They were able to focus on it and make it awesome. So I appreciate everybody's work on that. Yeah, absolutely. 100%.

Over to you, Brian. All right. Well, let's see. I'd like to, I heard about this a few weeks ago, actually, I think also. Here's an article, let's see, updated in April. So yeah, a month ago. It's an article by, I had the name, Matthias Endler, the best programmers I know. And it's an interesting idea for an article. He was just saying, I have met a lot of developers in my life. Lately, I've asked myself, what does it,

it take to be one of the best? What do they all have in common? And I kind of love this and I like the list. There's, I encourage you to go and read this article. Um, we've got a link in the show notes, but I'm going to jump around and, and read some of the topics. So read the reference. If there's one thing that I should, should have done as a young partner, it would have been read the reference and, uh, like the Python standard library. I admit I have not read all of the standard library. Um,

tumble spec, things like that. I would add to this that if you're going to do something new, jump down into beginner mode and just read a beginner reference on something. Like I'm

Even if you're an expert Flask developer and you want to switch to FastAPI, go ahead and read the beginning tutorial and walk through the beginning tutorial for FastAPI. Things like that are helpful. All right, I'll go a little faster. The topics, so read the reference, know your tools really well, read the error message. Getting good at reading error messages is totally a good skill. Breakdown problems, don't be afraid to get your hands dirty.

Always help others, write. Blogging, talks, open source, those help you get better. Never stop learning. Status doesn't matter. Build a reputation. Have patience. Never blame the computer. Don't be afraid to say, "I don't know." Very important. Don't BS to people. That's AI's job. If somebody comes to you, give them what you know. Don't guess. Keep it simple. Simple.

And that's it. But really great commentary on each of these. I love having this all put together as some good advice for software developers.

Yeah, it's easy to forget, right? It's also easy to not really know and wondering, are they so productive? How do they know how that is implemented or how that works internally in Python? Like, well, they read it. You know what I mean? The status one is important, I think. Don't assume that if you're just because you're... I mean, it's...

There's so much complicated stuff in software that it doesn't, it really doesn't take long of focusing on something to become really one of the better people that understand how to use something, especially within your company. So even if you're a junior developer, you might be the expert in tool X or something like that. And if you've got a company that's okay with it, you know, and hopefully you do, that's okay with people getting advice from all layers run with that. So, yeah.

Some great advice. Yeah, definitely. All right. Well, that's it for our main item, Brian. So let's talk about a little bit of security. Okay. So how do you access your server if you're running in the cloud and some sort of hosting, maybe even a home lab that you somehow for some reason have it accessible to the internet, things like that. SSH, right? That's SSH.

almost universally. Sometimes with Windows, you might be doing remote desktop, but probably SSH. Yeah. At least 80% of the stuff out there is managed that way. Yeah. Look at this little quick answer. How many SSH attacks can a public Linux server expect per second? Two. Two attacks per second.

That's crazy. No, sorry. I multiplied it. Every two, every two seconds. So that's like 30,000 attempts to hack your SSH. And the reason, why do I bring this up? This is one of my extras. I've been listening to some security podcasts late and they're like, oh my gosh, here's what, there's like, people are coming up with all these crazy schemes to try to block their SSH. Like,

Well, I know that I have my business and my local house. IP addresses are pretty stable. They're not static, but they're pretty stable. So I'm going to just set up a rule to only allow access from those two. What if the power goes out and the thing resets around? I mean, that's super dangerous.

you might never ever get back to there. Other advice is, well, like go into, I mean, I don't even know how you do it. Go into...

server and just shut it off, but then like use some admin tools, like an admin console, or maybe even go in and just turn off the thing. So anyway, I have a much better suggestion, I think, for folks. Almost everybody's hosting comes with what's called a cloud firewall. You just log in from anywhere in the world using your 2FA and you have access to the dashboard for your cloud setup, right? There's console.aws.com.

There's console.hetzner.com and so on. And so just go in there and put your, you can just restrict access to your SSH to your current IP address. And if for some reason your IP address changes or you're in a coffee shop and you want to get access, just log in real quick and enter that IP address. Chances are, if you go back to that coffee shop again, it's still got the same IP address. You only got to do it once. It's super low effort and your tax go from 30,000 a day to zero.

Because those are coming from all over the world. They're not coming from within the house, right? They're not coming from your machine. It'd be too late, right? It's just to prevent the public stuff. So embrace cloud firewalls, folks. That's all I want to say. Okay. Next. This was last week, right? But caveats where I said Python beta 1 is here. 3.14 beta 1. It is time for some beta pi. Mm-hmm.

Tasty. Python 3.41. Come on. So people can check this out. This is the preview of the first stable version. I guess it really is just the first stable version of Python 3.14, which is cool. So check it out. Can't believe we're already here again. Yeah, I know. Here we are. Also want to say there's a new batch of Python Software Foundation fellows, and they're

I think there's like 10 folks or so in here. Charlie Marsh. Charlie Marsh. Yeah, obviously. He's been doing session. Frank Wiles. Yeah, a lot of cool folks. Ivy Fung and other folks. I don't want to read off everyone's name, but congrats to everyone in there. That's super cool. Nice. Not super cool. Post from Mike Dropbooms. Speaking on behalf or for many, many people here, he is, but it says, I'll just read you a little bit of it, Brian. It's been a tough couple of days. Microsoft support for the faster CPI platform

Python project has been canceled yesterday as of four days ago. My heart goes out to the majority of the team was laid off. I mean, that's a, it's actually a lot of people. You look at the picture, presuming that all those people there are on the faster C Python team. I'm not entirely sure they are, but I know that included, you know, Mike, some other folks. It's, it's not great, right? It's,

I can't remember where I read it. There's some conversations, but someone said, look, it's pretty short-sighted to bet the company on AI as Microsoft is. And at the same time, fire the team making the dominant language for that technology better. You know, you got to maximize shareholder value, Brian, but like, I don't know, 10 people or something. How big of a deal is that on the scale of Microsoft?

So that's that. And then also Brett Cannon says there were layoffs yesterday and three Python core devs from the faster C Python team were caught in them. If you know any jobs, please send them their way to help them keep going strong. You know what I mean? So I linked to that as well. These are some insane people. You really can't find something else for these people to work on. Yeah, exactly. Exactly. All right. Um,

Back to better news. So I just released, as in during this episode, push the go public button for something that was formerly known as Redknot, but is now is known as TY. This is Astral's new type checker, equivalent of MyPy, but also maybe even more important than that is a runtime language server that handles very large code bases and is more lenient than PyLance and others. Oh.

Oh, interesting. Yeah.

other tooling, a lot of the extensions that Microsoft makes aren't available to say Cursor or Windsurf or the 150,000 other free ones. So this might be an even better high-performance replacement of things like the language server for the vibe coding platform as well. Anyway, it's a super cool interview with Karl Mayer and Charlie Marsh, and people should check that out. That's nice. So what's TY? Is that just because it's easy to type or...?

- Type, I think it's for type. - Type. - Yeah. - I think of it as like, thank you. Thank you for doing this. - Yeah, we made a lot of jokes about that during the show.

Everyone says thank you to the Astral folks for making it better every time they run it. Yeah. Yeah. So that episode is literally hot off the presses. Check it out. Cool. Can't wait. And something I've been doing that's pretty fun, Brian, is I've been doing, I'm working on making a bunch of shorts like TikToks and YouTube shorts and stuff from the Talk Python episodes. So I'm going to play a 15 second video. I think people are going to enjoy this. This is not exactly the joke, but it's kind of like the joke. Are you ready? Yeah. Yeah.

Yeah. I guess if you use Postgres, you could just put it in a JSON field as well. Something like that. Oh, yeah. They call that mullet schema, right? It's a business up front and partying back where the last column on the vertical is a JSON field. I've never heard that. That's incredible. It's like, yeah, we look real formal, but don't look back there. Yeah.

Got it in the ponytail today. Yeah. Amazing. Isn't that amazing? Yeah. So people should check out the channel. Obviously I'm doing, doing some fun stuff there. All right. That's it for my extras. Maybe let me check. Yes. That's it for my extras. So I just got the joke left. How about your extras? Any? Just a quick one. I wanted to pull up a screen. Let's see.

picture of Munich. I just wanted to mention the reason why we mentioned this at the beginning of the show, but the reason why we didn't do it last week is I was in Munich, but I had a great time. It was a work trip. I was there to perform a talk or present a talk at an internal conference. And the reason why I'm bringing this up is not just to humble brag that I was in Munich, but it

Yeah, it was fun. Anyway, it was that I think it's just a really cool idea that I was there for an in like an internal company conference and I

I think this is an awesome idea just to allow, we didn't have everybody over there, but everybody could submit talks. And if you got your talk accepted, you go, of course. But there was a, it was like a two, two day, two day event with like three track, three or four tracks. And just like a normal conference with talks and everything. And it was great. Everybody self-selected what they got to go through. And the, the, what I really loved about this was the,

It's difficult to get within a company all the people that care about

something together. And this allowed people to self-select into what they care about. And so I had people coming up to me from, from different divisions that we would have never interacted with before. Working on similar problems allow us to work together. And it's a, I think it's definitely worthwhile for a company to, to actually reduce costs by bringing, by spending a little to bring people together to talk about similar things. Anyway, that's just my plug.

And then the other thing was flying back. I couldn't sleep on the plane, so I had a ton of time to do something. And I got started on a first draft for the second book I'd like to write. I love it how just stepping away just a little bit sometimes will be like, all right, that's it. I'm working on this project or something. It just gives you like that little bit of space from all the day to day. That's cool. Yeah. Anyway, so it was good.

Great. And if you look at that picture, just to the left of that, that castle church thing, I've had a really nice beer brewery, brow house evening one night over there in Munich. It's a fun place. Yeah. Cool. Cool. All right. Are we ready for jokes? We are.

As a person who is known to be good with computers, sometimes you get dragged into tech support, even though I don't know about you, I'm not especially good at tech support and I don't necessarily desire to make that skill better. I present you the quick and handy manual on how to fix your computer. You ready? Yeah. Let's go.

Let's see. I can't do any more than that. Okay. So it gives you three options. Do you have Windows? Do you have a Mac? Or do you have Linux? So option one, it says Windows. Step one, reboot. Did that fix it? No? Well, then proceed to the next step. All right. Next step is format hard drive, reinstall Windows, lose all your files, quietly weep. Okay. Let's see if I can make this bigger. There we go. The Apple one. Step one, take it to the Apple store.

Did that fix it? No. Proceeds to step two. Step two is buy a new Mac, overdraw your account, quietly weep.

Okay, well, Linux is more DYI, so let's see about that one. This is step one. Learn to code in C. Recompile the kernel. Build your own microprocessor out of spare silicon you have laying around. Recompile the kernel again. Switch distros. Recompile the kernel again, but this time using a CPU powered by refracted light from Saturn. Grow a giant beard. Blame some microsystem.

Turn your bedroom into a server closet and spend 10 years falling asleep to the sound of whirring fans. Switch distros again. Abandon all hygiene. Write a regular expression that would make other programmers cry blood. Learn to code in Java. Recompile a kernel again, but this time wearing your lucky socks. Did that fix it? No. Proceed to step two. Revert back to using Windows or Mac and quietly weep.

What do you think? Yeah. Plus it's 10 years later. So the maps max are going to be zipping by then. They definitely will. Well, if you, if anyone needs to do tech support for their family, I present the manual step-by-step guide, step one and step two. Yeah. Yeah. It's funny. Definitely. All right. Well, happy to have you back stateside, even though you had a good trip to Germany and we'll see everyone next week. Huh? Good to be back. Thank you. Yep. Bye.