We're sunsetting PodQuest on 2025-07-28. Thank you for your support!
Export Podcast Subscriptions
cover of episode #433 Dev in the Arena

#433 Dev in the Arena

2025/5/26
logo of podcast Python Bytes

Python Bytes

AI Deep Dive AI Chapters Transcript
People
B
Brian Ocken
M
Michael Kennedy
Topics
Michael Kennedy: Git Flight Rules就像是宇航员在太空任务中遇到问题时的操作手册,现在程序员在使用Git时遇到问题也可以参考它。这个指南涵盖了各种常见Git操作,例如创建和克隆仓库、撤销更改、变基和合并等。它能帮助开发者在遇到Git问题时快速找到解决方案,避免不必要的麻烦。我个人觉得这个指南对于那些经常与Git打交道,但又不是Git专家的开发者来说,绝对是一个福音。

Deep Dive

Chapters
This chapter introduces the concept of "Git Flight Rules," a guide for programmers facing Git-related issues. It highlights the resource's practical approach to resolving common Git problems, offering step-by-step solutions for various scenarios.
  • Git Flight Rules is a guide for resolving Git issues.
  • It provides step-by-step solutions for common Git operations.
  • Covers scenarios like merge conflicts, pushing to different origins, and handling submodules.

Shownotes Transcript

Translations:
中文

Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 433, recorded May 26th, 2025. I am Brian Ocken. And I'm Michael Kennedy. And this episode is sponsored by us. So please check out offerings at the courses at TalkPythonTraining and at PythonTest.com, of course, to learn your PyTest goodies. And

Also, thank you to the Patreon supporters. You rock. If you'd like to connect with us, of course, check out the links in the show notes for both Michael, myself, and the show at Blue Sky and at Mastodon on Fostodon.

And if you'd like to listen to the show, if you listen to the show, thank you. If you'd like to watch it also live, check out pythonbytes.fm slash live, usually Monday at 10 a.m., even when we forget that it's a holiday today. But yeah.

Also, if you'd like to get, if you're listening to this and you kind of want to check out some of the stuff that we're talking about, but you can't remember the link, sign up for our newsletter on at pythonbytes.fm. Really easy to find the link there. And you'll get an email every week with all of the links and everything we talked about, plus extra goodies to help you get up to speed if you want to. So, yeah.

That's wonderful. What do we have to start with, Michael? Let's start with a throwback, okay? Okay. So, did you ever watch the movie Fight Club? Brad Pitt, Edward Norton. Yeah. It was a cult classic, right? It was definitely a... First rule of Fight Club. Don't talk about Fight Club. First rule of Fight Club. Don't talk about Fight Club. Second rule of Fight Club. You do not talk about Fight Club. Okay.

So what are we doing? What are we talking about? Why am I talking? Because up next are get free.

Flight rules. Fight rules. I want to call them fight. So what are flight rules? They're a guide for astronauts or programmers who use Git who now do things when stuff goes wrong with Git. So they're hard-earned. They're not fight club rules. They're hard-earned body of knowledge recorded in manuals that like, if this goes on, what do you do? If you stir the tanks and there's an explosion, you're going to get a hit.

and a lot of the oxygen shoots out of the spaceship, what do you do? And so on. Okay. All right. So this is actually pretty cool. I think this is going to be super helpful for a lot of people. So it

it's talks about, well, what do you do with get when things go wrong? Basically. I mean, source control is awesome until you're like, it says there's a merge conflict and I don't know how to merge it, or I don't know how to do that correctly, or I've created the repo here, but I want to push to a different origin there. And how do I do that? So this is like, Oh, okay. So,

It's grouped by sort of category or something, I guess. So repositories. I want to start a local repository. I want to clone a remote one. These are pretty standard, right? But as you go down, you'll see. I set the wrong remote repository. Like, like...

I want to push to a different origin and so on. There's edit rules, there's staging, and they're pretty interesting. Like there's discarding changes. Like, um, I want to discard specific unstaged changes, or I want to discard all of my untracked files, but not the tracked ones and so on. Or maybe if I am staging, um,

Let's see. I staged too many edits and I want to break them into a separate commit. What do I do? I want to unstage my edits and unstage my staged edit, right? So all these things have sort of, here's the scenario, rebase emerging. I need to update the parent commit in my branch when I'm rebasing or whatever. There's a bunch here. Like I even called out a few in the show notes.

I got to check out the rebasing stuff because that always stresses me out. I know, me too. One is like, what did I just commit? I want to restore a deleted file. I want to discard a specific unstaged changes. Not all of them, just one of them and so on. Isn't this cool? Yeah, this is great. Yeah, well, thanks for letting me stretch the fight rules a bit, but I had to. It was fun.

But I think this will be super helpful. It's sort of how to deal with stuff when, how to deal with Git when Git stuff goes wrong. And submodules, man. Oh boy. That's a whole nother. That's a whole nother. No, it's good. So.

Okay, so let's talk about T strings a little bit. We've already covered T strings on the show before, I believe they came in with PEP 750. But they're, they're, they're, they're very new. So they're to play with them. I think it's just 3.14 point zero beta one has them. I don't know if anything before.

So I was just playing with them this morning a little bit. But I'm really happy with this article from Brett Cannon, Unraveling T-Strings. And what I really like about it is because I really kind of wanted to play with T-Strings or just understand them more. But I didn't want to actually require, you know, it'd be great if you didn't have to have the latest 3.14 beta 1 T-Strings.

And so that's really with this article. So even though T-strings come in with the 3.14, this article talks about going through all the details of kind of how T-strings work without actually using T-strings. So Brett starts out with this idea of like, let's say you've got this little converter thing of converting this function called FYEA that takes

takes a T string, but here it says T string, but it's just a variable name.

uh, take something and, uh, returns something. And right off the bat, it's just a identity. Um, and what we want and what he's showing is like with F strings, uh, you F strings do a lot of things like they can replace variables. They can do, um, what are those formatting stuff? They can do format specs, specifiers, and then there's conversions. Like this is a raw string conversion thing. Um, and, uh,

And so he walks with that with an example of just, you know, once you pass the SF string into the function, what do you get out? But then he talks about, like, basically, it starts out simple, but then he goes into, well, what if we wanted to pass in the parts, all the different parts, right?

passing into our function and then he passes in uses like the representation or conversions and format specifiers to walk through those so basically we've walked through so far evaluating python expressions applying specified conversions and then format specifiers and then goes into to

like just dives into it further of like, let's keep track of all this stuff. And then let's, let's, you know, let's make, we've got a lot of stuff we're keeping track of. So let's put some of the things that were like the, all of the conversion stuff. We'll put that into a, an interpolation class and,

And I was a bit lost here, so I actually walked through all of this. And it was really helpful to actually run the code, copy it into there and walk through it. And then a template class and basically walking through all the different parts. And then at the end, he shows you-- says, basically, we've just built up something that would be like T-strings, even though we don't have T-strings yet.

And then gave an example of what it would look like, what it looks like 3.14. The example in the PEP 750 is right there. You can run that too. All really good. So if you really want to get a handle, get your brain around what T-strings are, this is a great article. But I was a little frustrated that it was all in, like just files.

So I went ahead and rewrote all of his examples as PyTest tests. So you can just have one file and run them all. Also get to show off near the end because the last example you actually have to have

Python version, Python beta 1, 3.14 beta 1. So I'll show people how to use skip if to skip that if you don't have that Python version installed. Yeah, that's cool. I really had fun walking through all of this article from Brett. So thanks, Brett, for putting it together. Yeah, very cool.

real-time follow-up. This was not what I was expecting to talk about, but I just had Paul Everett, Jim Baker, and Dave Peck all on TalkPython just a little bit ago talk about T-strings. So if you want to dive into the internals with some of the folks that worked on that as well, keep on listening. Yeah, that's not my next topic. My next topic is like a hacker version, cyberspace version of HTOP, NeoHTOP, HTOP, Matrix version? No, NeoHTOP. I

a blazing fast system for monitoring your desktop, which I think is super cool. And I'm pretty sure it's cross-platform, a modern cross-platform system monitor built on top of whatever doesn't matter. But Rust is in there somewhere.

So we look at the features, it has real-time process monitoring, CPU and memory usage tracking. This is a GUI, by the way. Modern UI with dark and light themes. Cool filtering, you can pin processes, you can kill processes. Very nice. So I actually have it running. Let me pull it up here. You can see whatever's happening on my computer right now. Apparently, guess what? The Vivaldi helper for StreamYard is...

grinding away using 50% CPU. But there's all sorts of cool stuff. You can hit these little informational things here. No, that's the pin. Hit the informational things, and it actually shows you stuff like how much CPU and memory is that process using exactly, what is its ID, but also what is its parent ID, has like graphs for the memory, and also what command was used to launch it. I think this is super cool. Oh, that's neat. So if you see, oh, here's a, there's this,

Why is this process running? You know, it's a sub-process, but what is it doing? It actually shows you. And then if you go to the parent, this is, I think, even cooler maybe. You go to, like, say, Vivaldi in this case, and it shows all of the different sub-processes that Vivaldi has created and how much CPU they're each using, how much memory they're using, what their IDs are. Isn't that cool? Yeah, actually, I think a lot of these are useful for, like,

servers, but I think I'd use this to start on the desktop. Yeah, exactly. I'm thinking this is really nice for the desktop because Windows has Sysinternal stuff. What is it? Sysmon, I think it is, which is incredibly good. It's way better than this, but it's Windows only, right? Yeah.

And we've got on the Mac, we've got system and iStats menu rather, which are really nice, but it doesn't give you the look inside the processes quite like this. You also get stuff about network, about storage, about memory, all these things. So I think that's pretty cool. And of course, it looks like you can kill things from here. Yes, you can definitely kill them. You can be malicious.

Anyway, that's my item here. If you want some nice GUI desktop monitoring tools that are cross-platform, check out this NeoHtop thing. It's pretty cool. Stop. All right. Where are we at? Remove.

Okay. Next, I think we just – did we just talk about TY or thank you or TY or whatever that was last week or something recently? Yes, we did. Yeah. So that's the – TY was the astral type checker. And so this week, why not do another? So Pyrefly is a new type checker.

It's from Facebook Meta. So there's an article, a new type checker, yeah, introducing Pyrefly. And one of the things I think is interesting about this, so it talks, I played with it just a little bit. This is also based on Rust, so it's super fast. And one of the reasons why they built it, apparently, the principles behind it are performance, of course, but also IDE first. So I guess that

that totally makes sense, but I think a lot of things are built, you know, not thinking about the IDE right away, maybe. But this is thinking about making sure that it integrates with the IDE really well and have a command line interface experience as well that's good. So IDE first performance inference, having this work well with Python programs that are not typed yet, they're not annotated at least,

but they might still be, you know, have consistent with types. So it infers types and open source, of course. So this is not a, even though it's from the Facebook engineering group, it's not, it's not closed source, open source stuff. So that's good.

There's some talk about what they're going to do in the future, but really slick looking website, of course, with a VS Code extension. And I made a mistake, though. So I downloaded this and I thought, yeah, I just want to run it on one of my projects to see how well. And the project I chose was the PyTest Check plug-in.

and it blew up. It didn't blow up. It worked fine. It just told me a whole bunch of stuff that was wrong that's not really wrong.

So I probably shouldn't have chosen the one project that I work on that completely abuses the dynamic nature of Python. There's a check object. So I do often from pytest check import check. This check object is both the interface into the system, plus it's a context manager, and it overloads a whole bunch of stuff. So yeah, that's...

Yeah, maybe, but having all those warnings might be a hint that maybe I should redesign this. We'll see. Anyway, Pyrefly, another faster type checker. And yeah. Neat. Interesting. Yeah, two things that I'd like to add. It's a good find. I was considering covering this as well. Pyrefly is a replacement for...

for the existing pyre P Y R E from Facebook. Okay. So, or from meta. So they had had that previously and I guess this is like a rewrite or something like that. And the other thing is comparing it to TY AKA red knot from astral. This looks more.

more mypy like which is somewhat the goal of ty as well but ty i believe is meant to be more forgiving so maybe it would scream at you less right it's it's meant to work on less typed code i guess but the other the main difference that i i haven't looked in this deeply so maybe it's in there somewhere but one of the big deals of ty is in addition to making a type checker that comes with a

an LSP, a language server. And one of the challenges with PyLance, the one built into VS Code, is when you get to extremely large code bases, basically it falls apart and sometimes can't even keep up or work with it. So things like your autocomplete or go to definition should start to shut off because the language server can't deal with ginormous amounts of files. And so they're trying to build a Rust-based

language server that flies on even millions of lines of code. So when you compare TY to Pyrefly, Pyrefly?

It's, they're not exact just like, well, one is from Facebook and one's from Astral, right? They're, they're slightly different as well. So with, did, do you know if Firefly is doing a, like a replacement language server also, or are they using, you know, I don't know that either. They do have LSP as one of their tags, but I don't see any more words than that. Let's see. Okay. Well,

On their website, they don't. Do you plan to build an LSP? Yes. See a roadmap. Oh, okay. And what does the roadmap say about LSPs?

it doesn't appear on it so you know it's closed maybe lsp okay yeah i can't tell it's it's an infinite scroll thing so it's like sort of hard to yeah hard to get there i mean you kind of need an lsp to understand it you need something that parses into something like an abstract syntax tree then you start asking type-based questions about it right that's how a lot of these work

And one of the frustrating things, though, with the limited... I'm looking forward to having some of these Rust-based language servers come online because it's the large projects that I really need all the help with. The smaller projects, I don't really need... I mean, I kind of can get my head around it already, but...

Well, I'm just gonna be using chat to write on my codes. I don't care. Just kidding people. Just stick with the vibe. Yes. Speaking about stuff running on platforms I worked on, talk by them training. Let me tell you about a new course that we have over here. Pollers for power users, transform your data analysis game.

So this is a super fun course put together by Christopher Trudeau. And it's, it's super fun. If you want to learn Polars and you know a little bit of pandas or, you know, tools like Excel and others, it kind of walks you through like, Hey, you know how to do this in other tools, but here's the advantages. Here's the different API. Yeah. Really fun. If you want to get started with Polars or see it compared to a

Various tools, like I mentioned. Definitely worth checking out. $29, you can get going there. And it's three hours, I think. Not a lot of your time, not a lot of your money, but you'll have a nice new skill set at the end. Nice. And let's see, what else have we got here? A couple of announcements. Airflow, the workflow...

Framework has its biggest release, the most significant release in the project history. They describe it as Airflow 3.0 builds on to adding a new service-oriented architecture, modern React-based UI, enhanced security, host of long-quested features such as DAG versioning, directed acyclic graph versioning, improved backfills, event scheduling, and remote execution. In this case, I guess that's a good thing. A lot of times remote execution is bad, but when you ask for it, it's good.

Anyway, if people do Airflow, check it out. It's pretty cool. There's a new one there. And my last one, this came in just yesterday, I think, is when I first saw it. Paste. Brian, do you use some kind of clipboard manager? Yeah. Other than just the clipboard itself, obviously. Oh, clipboard manager. No, I don't. Okay, so once you start using one of these things, you will never, ever want to go back to working without it. Have you ever done this? Have you ever gone and said...

oh, I need to copy this. And then you go over and accidentally copy something else. Or I don't know about you, but I use Bitwarden for my 2FA stuff. And by default, it has a copy that in addition to pasting the 2FA code, it'll just copy it because sometimes the paste fails. But if I didn't have this clipboard thing and I like copy something important and went over and I tried to want to paste it somewhere. Oh, I got to log in. I hit my Bitwarden thing and I'm like, no, it's gone. Where did that go? You go back and find it.

This thing called Paste for Mac. I know there's similar things for other platforms, but my recommendation in this little extra is Paste.

So super, super nice thing. They just released Fivo, which is like a big improvement. So what it does is it'll keep track of three months, a year, one month, whatever of clipboard history. So you can copy three, four things, go back, hit a button, go back, find them. You get little thumbnails of them, or you can even search. You're like, just, I want to see what did I copy? You can just type Firefox and I'll show you everything you've copied from Firefox in the last month. And you can copy from that or reuse it or whatever. Yeah.

And it'll like synchronize across Mac and your iPhone and so on. So super cool thing. Anyway, they just had a big release. It works much nicer. If you don't use something like this. I think I would just like five minutes, but you know. Yeah, you can do five minutes. I mean, you can do, you can change however you want, but I think you'd be surprised. You're like, oh yeah, I know I copied that yesterday. Or I have the same whenever I'm creating a new Python Bytes file.

I have the same description, but the software won't remember the same description from, so I got to copy it or retype a paragraph, right? Like, no. So I just hit the hot key to pull this up and I type join us. And then boom, that's the join us to be part of the show and come to the live stream. And I just paste it. And so from last week, I just get that back in like three keystrokes. Oh, nice. Brilliant. So,

If you're on Mac OS, check out this pace. They had an, they had a new release. Super nice. If you're on something else, maybe send us recommendations. We'll, we'll give them a shout out or something. All right. Those are all my extras. How about you? I got a couple. Let's see. Where are we at? So Python, the documentary, I'm kind of looking forward to this. There's a, there's a trailer out official trailer for the Python, the documentary. It's just a,

couple minutes. But looks like this. This looks great, Brian. This looks really good. And I know they did this like joke thing about Guido coming back and the Empire Strikes Back sort of thing and all that. But if you click on Cult Repo, the username of this right there and go to their videos and look through it, like if you look at all the things they've done, you can see, by the way, that video I talked about, but they have a

from Node.js to Deno. And they've got the Angular, the official documentary, and so on. They've got a bunch of cool, in-depth, highly produced Ruby on Rails, the documentary, and so on. A lot of programming-based, framework-based documentaries, like really nice storytelling there. So I think that is what's coming with the Python documentary. I'm going to have to check out Life Advice from Bjorn Stroustrup. Yeah.

Pointers. Always use pointers in your life. Never duplicate. Yeah. Interesting. Yeah. No, some good stuff there. Okay. So that was one was the documentary. Documentary? Also, quick errata. I mentioned that when I was talking about T-strings, I mentioned like the raw conversion. It wasn't the raw. Henry corrected me. It's the repper conversion. Thank you, Henry.

So the next step, so, okay, so the new Python. Oh, Tim Hopper, we covered this already, the Python developer tooling handbook. And one of my comments was, where's the testing? So anyway, he added a testing interface

Intro also, setting up testing with PyTest and UV. And actually combining the two is kind of fun to show how you do add PyTest to your dev environment with UV. Pretty fun. Very simple example, a little calculator sort of thing, add, subtract, multiply.

testing so uh shameless plug if you if this isn't enough intro to pi test you'd like um i suggest going over to courses.pythontest.com where you can pick up any course you want on pi test so

And the couple others, I guess, last thing is I got the, I've been using pocket for a while to keep track of things. I want to read pockets going away. It's a shutting down. I think as of July, July 1st or so. Anyway, I don't know when it's shutting down, but, but it's shutting down. So you got to move off onto, if you're using pocket, don't use pocket anymore. Yeah.

What you should use instead. Obviously, you can check whatever, try your own things out. I tried a few things and I landed on Raindrop. So I've been liking Raindrop so far. And somebody posted this on social media. Somebody said, well, what does the code look like? Because sometimes these bookmark sort of apps aren't that great at code highlighting. And I'll show you an example. This is of Brett.

Brett's T string article. It's not bad. It doesn't. So the web view had this is the normal view had. Oh, it doesn't show highlighting this. The other version I had had syntax highlighting on Brett's site, but it doesn't show syntax highlighting. It's just code blocks. So it's not bad. Anyway, I've been enjoying Raindrop so far. And that is all of my extras.

Awesome. Yeah, I started using Raindrop and I love it. I moved all my... I went on a journey, Brian. Not only did I start using Raindrop, I started...

I said, I'm going to go to all my various browsers I've used throughout the years, Firefox, Vivaldi and others. I'm going to clean up all of their bookmarks because there'll be like just cruft. You know what I mean? From like 10 years of some like, nope, nope, nope, nope, nope, nope, nope, nope. Keep these 100 or whatever. Then I imported all of those into Raindrop.

And now I have the extension in all of my browsers. So on any computer, any browser, I have all the same history. It's really nice. So I definitely second that. You're a beast. I just started off clean. I got like three things in there so far. I not only migrated, I cleaned it up.

One other option, if you're a self-hosting person, this appeals to me, but I did not do it because I just don't want more things to babysit at the moment. But this thing that used to be called Hoarder, now named KaraKeep, looks super cool. It's like a self-hosted read it later bookmark service, which is cool. Automatically tag your bookmarks with AI and et cetera, et cetera. It looks pretty cool. So yeah, but I'm not using it.

Are you ready for a different kind of joke? Yeah. All right. Have you seen this yet? No. Okay. Well, here we go. So I was sitting around thinking...

I don't know why I came across this, but I'm like, what if we had like historical quotes that are like well-known, but they were reframed for programmers. Right. So I said, I set out to make this just the joke for the show. And then I ended up like, you know what? Why don't I just publish this? And then we'll still make it the joke for the show. So, you know, the Roosevelt's man in an arena in the arena speech. I love the speech. I'll read it. It's a little bit long, but not very long. I'll read it for people says, um,

It's not the critic who counts, not the man who points out how the strong man or woman stumbles or where the doer of deeds could have done them better. The critic, the credit belongs to those who are actually in the arena, whose face is marred by dust and sweat and blood, who strives valiantly, who errs, who comes up short and again and again, because there is no effort.

without error and shortcoming, but who does actually strive to do the deeds, who knows great enthusiasms, great devotions, and who spins oneself in a worthy cause, who at best knows in the end the triumph of high achievement, and who at the worst, if they fail, at least they fail while doing greatly, so that their place shall never be with those cold and timid souls who never, neither know victory nor defeat. Right?

All right. So that's the famous quote. What if Theodora was speaking about programmers? So I came up with a couple versions. I think these are more fun. All right. It is not the, I kind of gave them titles. This is the legacy code warriors. This first one, it says, it is not the keyboard warrior of comment threads who elevates the craft, but the engineer whose ID still glows at midnight, whose mind is seared by stack trace here graphics,

and whose resolve endures failed build after failed build. The honor rests with those who wade into legacy code, knee-deep in technical debt, emerging grimy but triumphant with a cleaner architecture, or if defeated, bear the proud scars of having fought for elegance.

Then, I'll do the last, I'll read the last one. This is good. This is to the open source maintainers. No glory clings to the spectator who counts another's failed build. It crowns the open source contributor whose pull request is battle scarred by review, whose changelog tells the failures endured, and whose merged code becomes the unseen engine of tomorrow's discoveries. There you go. Something inspiring for people there.

You having trouble sleeping? Actually, yes, but this is not evidence of it. Okay. No, I like it. Yeah, thanks. All right. Well, that's all I got for you, Brian. That's what I got. All right. That's good to wrap it up then. Indeed. All right. See you later.