Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 443, recorded August 4th, 2025.
And I'm Brian Okken.
And I'm Michael Kennedy.
And you can reach us on the socials on Bluesky or Mastodon.
Check out the show notes or the website, pythonbytes.fm, to find all those links.
And if you'd like to watch us live, you can check out pythonbytes.fm/live.
and it's usually Mondays at 10 a.m. Pacific time.
But you can go there for all the older, to link to the YouTube channel to get all the older episodes as well.
And this episode is sponsored by you guys, by the offerings that both Michael and I have.
And you're supporting us through that really helps us going to getting courses, buying books.
That's pretty much it.
Also Patreon.
So thanks Patreon people.
Let's kick it off.
What you got, Michael?
I have something sent in from Owen Lamont.
And so, Owen, thank you for sending this in.
I believe we've talked about Markdown formatting stuff before, but I want to look at this one because it's got some rough vibes.
R-U-F-F, not R-O-U-G-H.
Rough vibes in that it's a formatter written in Rust, seems insanely fast.
And even though it's a general purpose thing and it's written in Rust, it has special love for the Python people.
So there's a PyPI wrapper, basically a wheel that wraps up the commands going to it.
So you can pip install it, uv pip install it, more importantly, uv tool install.
It also has a pre-commit hook and pyproject.toml support.
Pretty neat, right?
Very cool, yeah.
I just ran it on a project I'm working on.
And apparently, what did it say?
How many errors?
14, 14 errors I found in my, and it will fix them in the similar way if you do a --fix, I believe.
So that's pretty cool.
High performance markdown formatter.
So you can install it in lots of ways, but I would just uv tool install it.
It has 54 linting rules, which are apparently common markdown issues.
Like if I have a heading, there should be a line break between the heading and the content of that section.
You can fix most of them with --fix, like I said, which is beautiful.
No dependencies, single binary.
Highly configurable, which is great because a lot of the warnings I get when I run it are this line length of 102 exceeds the 80 character limit.
I don't know, like when do people, when do we move on from the 80 character limit in like things, Python and other?
I have a 4K monitor, 32 inch 4K monitor.
If I put stuff in 32 or 80 columns, it's like on the left and the 80 columns is like, well, that's the default size of a terminal.
Like, okay, is that where most of our markdown is done?
Probably not, but I don't know.
I'd say make it long and let it wrap.
The reason I don't like that rule, particularly for markdown is I use type-ora, which I love.
But type-ora, it keeps a little more of the formatting visually there.
So even if I was to like do the markdown and render it to a webpage or to a PDF, the line breaks would disappear 'cause you have to have two line breaks, right?
Like a blank line.
But in Typeora, while you're editing it, you see them.
And so you would see like chunks.
So if I make my editor wider, it like stops going.
If I make it skinnier though, then it like has like weird half line breaks because it's wrapping the 80 lines to like 60 and then there's 20 more.
And like, it's just, I hate that rule.
So why am I ranting so much?
Well, because I rant apparently.
But it's also super configurable.
So you can go to a Tommel file down here.
And once you find it in here, it has a bunch of examples.
I think up at the top here, there.
And you can go in here and it gives you examples.
Like I can say disable rule MD013.
Or in my case, yes, that's the one.
Of course it's 13.
It's unlucky.
But you can also configure the rules.
Like say rule seven is about indentation.
How many characters, how many spaces do you want to indent by?
Or different things, right?
Don't apply the line length considerations to code blocks or tables, but override the line length to be 100.
Again, I'm turning that off.
But still, I guess I could set it to infinity.
That would be fine.
But isn't this cool?
Yeah, it is really cool.
I want to jump on the line length bandwagon a little bit here, though.
Let's do it.
I agree.
I'm glad this is configurable.
Because in writing a book or something or a tutorial, I'm going to have long paragraphs.
And I'd rather have those just wrap, and I don't want to limit my line length.
So I would turn that off if I'm writing long form stuff.
Yeah, I'm thinking my blog posts and things like that, right?
Which are all marked down.
But for the markdown in a project, even if it's a documentation project in maybe, I guess, I can see it for readmes or something or things that are changing a lot because you're doing diffs more.
You do have to be aware of the diffs.
But I think diff tools deal with word wrap fine now.
So anyway, I don't know.
Yeah, that's a fair issue.
Fair point.
But if you got long form writing, it doesn't make sense.
Yeah, it doesn't make sense at all.
Yeah, that's weird.
It's not like in Word or Google Docs.
Like, where do you want to break your lines?
Like, no, I want it to just go across the page.
Can we just let me write?
Yeah.
All right.
But it's super cool.
You can, like I said, uv tool install it.
It even has instructions for uv.
Or you can use uvtool run.
And so you could run it without even actually installing it just to test out how it might go.
Yeah.
So what's the big, do you know what the biggest mistake is you usually make for Markdown?
I haven't done enough messing with it yet,
but I can report back to you.
Okay.
Mine, I haven't even used the tool yet, but I'm looking forward to trying it because the thing that always trips me up is a space before unordered list.
So if you write a sentence with a colon and then you do a new line, and then you start like, you know, do the asterisks or dash or something like that and start a list.
Some tools will automatically understand that you intended it to be a list, and some of them don't, and you just get a bunch of asterisks in a paragraph.
So, yeah, I need something to fix that for me.
Definitely.
All right.
On to the next topic.
We are, I want to talk about coverage because Ned Batchelder released, This is a blog post from the end of July, July 24th.
Coverage 7.10.0 with patch.
So we're actually up to 7.10.2 now, but it's the patch that's like the super cool news.
And I just read about this, and I am like really excited about it.
So one of the things, it adds three things.
So if we go to the changelog, It's adding patch subprocess, patch execv, and patch exit or underscore exit or something.
And I'll do the weird ones first.
I don't really see execv around.
But the issue with execv and exit is that that's a way, like something happens and your stuff gets torn down before coverage has a chance to write its stuff.
It just like processes stop.
And that's not cool.
But with this, you can fix that.
And there have been workarounds for these other things.
And so that's not really the big news.
The big news, I think, is subprocess.
Because there were ways to, if you're trying to run coverage on a project that has subprocesses, you have to have some way to cover all of those processes and then combine them later.
And there were ways to deal with it, but it was a little clunky.
Now, we've got a way to do it built in.
You just say patch equals subprocess and coverage does it for you.
How cool is that?
And multiprocessing.
It'll count multiprocessing execution for coverage.
That's, yes.
Thank you, thank you, thank you, Ned.
So I'm really excited about this.
It's pretty cool.
Anyway, that's it, really.
Awesome.
Yeah, it's a really good one.
Short and sweet.
This one comes to us from Pat Decker, I believe.
I hope I'm remembering that right because I forgot to write it down.
So someone else sent it in.
I apologize.
I'm pretty sure it's Pat sent this over and it's AIO Bodo 3.
So Bodo 3 is the Python package to talk to things like S3 and other stuff in Amazon.
Okay.
And AWS.
Don't get me started on Bodo 3.
It's a bit of a insane package the way it's created.
But what I want to talk about is AIO Boto3, which is a wrapper on top of Boto3 resources that leverages the AIO Boto core async backend.
So what's going on from here?
It's a package by Terry Kane, and she created, I think, to basically make higher level operations, which you would use from the Boto3 level instead of the Boto core, which is more low level detailed interaction with AWS.
us. But there was an async low-level one, but not an async high-level one. And so now there's an async high-level one. So for example, do you want to work with S3 contents asynchronously? Well, here you go. So you can do things like create a session and then say async with, go to a resource for S3, then await getting a bucket, and then loop over asynchronously with an async for across all the items in that bucket. So if you want to do a bunch of S3 type of work or DynamoDB or Kinesis, whatever, then you want to do that asynchronously. Well, here you go. Also, she has an example of working with a DynamoDB table and reading and writing objects into it, which is pretty sweet.
What's Kinesis? What is Kinesis? Good question. Is that an AWS thing? Yeah, looking that up.
this. That's not how you spell it, but
luckily. I just thought it was keyboard.
It's a family of services provided by AWS for processing and analyzing real-time streaming data at a large scale.
I'm glad you asked, because this is what I've been working for a long time around.
Okay. Sorry. No.
Apparently, like, data streaming, data lake, data processing, analytics.
Okay. Got it. Cool. That's it.
That's all I got to say about it, but if you're basically if you're using Boto3 and you want to do async, AIO Boto3.
Alright. Well, I Sorry for the distraction, but I wanted to...
Anyway, I have a Kinesis keyboard.
That's why I'm like, what?
Yes, you do, don't you?
Tell people what it like.
Here, put one up on the screen.
Yeah, I was trying to look for one.
Kinesis keyboard images.
Oh, here we go.
Did you find one?
No.
There we go.
They are wild.
I had one for a while.
I'm like, I'm not sure I can do this.
Oh, I love it.
So I just did the image search.
um yeah they're split like this uh and it's in there and also your your keys are in little
little divots yeah like maybe if i could describe it for people ryan like imagine you took an orange you cut the orange in half you took out the orange fleshy bit and you lined the inside of the orange peel with keys that's what typing on is like you type into like these round holes okay but i would
say like coconuts maybe because it's bigger but we're like a coconut where you just work with like the lower third and the top third yeah but one of the things that's cool about these is they're in
uh do you remember the men in black movie oh yeah yeah they're well i did till they flashed me but
you know well the men in black movie had um if you the office scene in the first first uh one
um everybody's weren't using kinesis it's pretty cool were they okay how awesome all right um i i'm
I wasn't going to talk about keyboards, but what am I talking about?
I'm going to talk about You Might Not Need a Python Class by Adam Grant.
So I think we've probably talked about this before, but it's worth reminding people because there's a lot of people that come in to Python from other languages and classes are used a lot in other languages and you don't really have to use them here so much.
So I'm just going to run through some of the options.
One is for simple data containers, think about named tuples, which are great, or data classes.
Actually, probably data class first, and then if it's not quite right, named tuple.
But here's an example of somebody doing a custom class with point.
And also, the intending is wrong here, Adam, but oh well.
Anyway, examples of how to use that with a named tuple or just a data class.
So it works pretty good.
You don't usually have to create your own classes.
- All right, I don't really see that.
- Also, if you're creating a class with a static variable, there's a really good chance that should just be a module level variable.
Like modules themselves often can behave in the same way that people do classes.
Like I wanna group the functions together and have some shared data.
- That's a module.
- Exactly, exactly.
- Yeah, so that's one thing that's not in this, but one of the things I've taught people for a long time is if you think you need a singleton pattern in python it's just a module just do a module 100 and there isn't any really and if you're afraid of global data in python it's not really global it's just global to the yes it's accessible to anything but it's just module global it's not a big not a big deal anyway uh examples with points uh but there's some surprising stuff in here uh stateless utility functions just use functions and here's a yeah this is somebody that must have came from if you if you if everything's just that like you said if everything's a static method then it doesn't need to be there just make it a function um grouping constants also use modules um well there's also enums that you can do but uh but anyway um yeah if you're just having some constants and you're trying to group them together just put them in a module um for some reason this freaks people out sometimes and i think it's just the people that are new to python but yeah i think
I mean, I came from C-sharp, which had a lot of class, very much.
Like, everything had to be in a class at the time when I was doing it.
Like, literally everything.
So I was very much in that space, but I've moved on.
Also, on the constants, I agree.
But maybe throw in a typing final of type.
So they've got, like, a host and a port.
You could have a typing.final bracket str and a typing.final bracket int.
Oh, yeah.
Yeah, so then at least the editors and stuff go, yeah, like, don't edit this.
Don't edit it, yeah.
unless you're meant to but the way they say the word constant that probably means not so much
changing yeah but also having it in a class and it stopped people from changing it either
no at least you get a warning yeah tells you you're bad if you want to be bad uh managing state with
uh simple structures use dictionaries or lists definitely um what the a lot of this the gist is python is a lot of built-in stuff that you can just you know learn how to use dictionaries and lists well. It'll take care of a lot of stuff. This one is surprising to me. Simple one-off operations. Use lambdas or comprehensions. I mean, sure, the example works for a lambda and comprehension, but also you could just use a function. If you're going to grab a lambda, you could just write a function. Yeah, lambdas are great. Avoiding complexity. Use built-in libraries. Don't reinvent the wheel. There's probably something that is an example with config parser or json they usually they they can do a lot um yeah uh and then this is this is i'm glad we tie into your first uh first topic when you actually need a class well there's a bulleted list but they didn't do a new line so it i'm pretty sure it was a markdown that didn't get converted correctly so um yeah anyway uh and i'd like to add what are my additions if you think you need a class, you probably don't. If you really do think you do ask a friend because friends don't let friends create extraneous classes in Python. And then if you think you're the exception, it probably isn't an exception. But, and then finally, I'd like to say, if you, if you think you need data classes, but data classes aren't quite cutting it for you, check out attrs. Adders
is still around and attrs is awesome. So yeah. Or pydantic. Yeah. Or pydantic. Yeah. When the when you actually need a class yeah i'm i agree with this i like it yeah well so what did
he say he said um uh you if you need to encapsulate state or behavior yes but also uh you can use a data class or a module yeah um you if your objects have clear behavior method behavior slash methods associated with their data and you're modeling complex hierarchical stretch structures yeah i'm
I'm thinking the middle one.
If you have data that is tied to an instance of the class, you need to have multiple ones of those and the methods operate on that particular data.
I mean, that's when you need it, right?
Not for all the other jumps and hoops people used to use it for.
And as far as inheritance hierarchies go, since I've been using Python, I have multiple times created class hierarchies and then regretted it.
I don't think I have any that were legitimate reasons to use a class hierarchy.
But also, after using Python so much, I don't create class hierarchies in C++ much anymore either because I like using containment instead of inheritance, I think is a cleaner model.
So anyway.
Yeah, composition over inheritance indeed.
That's it.
It's a long way.
All right.
Those are our topics.
Do you have any extras?
I have at least one extra.
Let's see what I can do about that.
So this Thursday, as in three days from now, eight o'clock Pacific time, I will be doing a live webcast
with Will Vincent from PyCharm.
Yeah, so we're talking about basically uv, what is uv, all the way that you can apply to your projects.
Should be a lot of fun.
I'm really looking forward to it.
I wasn't entirely sure what we were going to cover.
Will and I talked about it today.
I have a bunch of great ideas.
Cool.
So if you want to see uv in action, we talked about that post from Armin Roeneker, I don't know, a few months ago or whatever.
Why are you not using UV?
If you're not, why?
A lot of people are like, what's UV?
Or it's too hard to move from, or it doesn't, whatever.
We'll kind of address all that kind of stuff.
Plus, maybe some fun Docker things, some performance things, all over the place.
Awesome.
Yep.
I have a couple extras.
All right.
So first off, this was sent to us by listener John Hagan.
The PyPI blog has an incident report about a phishing attack.
So apparently there was some targeted phishing emails.
There were some, and I didn't read this that closely, but it's creepy because it was a phishing attack that involved a fake PyPI that had like a phishing domain that was in the middle.
So if somebody clicked on the link, it all behaved just like PyPI, but there was somebody in the middle capturing stuff.
That's really creepy.
What was it?
It involved, and it involved like the fact that in some fonts, INJ look identical.
So it was a pypj.org domain.
Yikes.
Anyway, I just wanted to have people aware of that.
It was apparently found and fixed relatively quickly.
There were, I guess, four user accounts successfully phished.
They're either disabled.
So there's some recommendations, takeaways, calls to action.
If you have a dormant PyPI account, so if you have a PyPI account you're not really using, consider removing it.
You can always create another one if you need to later.
If you have an older PyPI account and you're not using 2FA yet, please sign up for that.
Even if you only pop in once a year, make it more secure.
Be good.
And use web often via browser hardware security or hardware security keys.
Wow.
I don't even know.
Is that just web authentication?
I don't know.
I don't know what this is.
I think it's like YubiKey type stuff.
Okay.
I don't do it though.
So I don't know that well.
I'm all about the 2FA.
And I'm all about the 45 character password, but I'm not doing web often.
45 characters?
Wow.
Or whatever.
Like, I'm so frustrated.
There's so many websites out there that you'll set.
Like, I used to have a default.
I think it maybe was 36 and one password for randomly generating a password.
I'm like, that should pretty much stop it.
You know what I mean?
Yeah.
Right?
And God forbid there's like a moment or two where you've got to type it in.
Like, for example, on Windows, If you get a new system, you got to log into your Microsoft account before you get into the system, the first boot or something.
Like, oh, God, I got to type it.
So you don't want it to be like, you know, paragraph.
But so many websites go, no, your characters have to be, your passwords have to be less than 16 characters or less than 12 characters.
I think my bank would limit it to like less than 10.
I'm like, my bank, what is wrong with you people?
if anybody should accept that, you know, a big password, but it's a tech support.
They're like, well, somebody is going to say they're locked out of their account because somebody put a long password and they can't type it in or, you know,
there's all these crappy reasons.
What gets me is when people like passwords get, when they exclude common characters like colon or quote mark or like really your system is not able to handle colons and a password.
That's just like insane.
Anyway, or so.
Yeah, I agree.
But anyway, okay.
So phishing attack, I've got a couple other quick extras.
I do have some, I'm not dedicated to the weekly testing code, but lately it's been weekly.
So testing code, I got a couple, had an interview with Adam Johnson that was two topics.
We split it into two episodes.
Both are now available.
We had pytest Django that we talked about.
And then we talked about get tips for testing.
And the top, especially some of the stuff on the get diff, get stash, and get bisect sections are pretty interesting.
So some good stuff there.
Yeah, very nice.
And those are my extras.
All right.
Do you have a joke?
I do.
But this joke, you know how they say jokes are not funny if you've got to explain them.
I'm going to explain this anyway.
But not the joke itself.
I'm going to explain the foundational information people need to know.
So a lot of times people say these days, Brian, they say, Visual Studio, I'm using, like, what editor do you use?
Oh, I use Visual Studio.
They're not using Visual Studio.
They're using something called Visual Studio Code or VS Code, right?
Yeah.
There is, there has been, since the 90s, an editor called Visual Studio.
It is not Visual Studio Code.
It is a beast of a beast.
Like, it's like a five gig download.
It manages Azure.
It does database.
It does team foundation server.
It does like all this stuff.
It's like a really heavyweight editor.
And VS Code was basically created to make a lightweight little editor that is not Visual Studio proper, right?
Yeah.
All right, so I got to just set that because I know a lot of people, especially younger folks, Visual Studio is Visual Studio Code.
But now are you ready for the joke?
Yeah.
All right, let's do it.
So there's a nurse talking to a guy.
Do you have any history of mental illness in your family?
The guy looks over as well.
My brother uses Visual Studio 2022 as a default text editor.
Yeah, that's good.
Yeah.
It's pretty good, right?
Pretty good.
Because that thing is big and it's slow to start and it's like ridiculous.
Default text file editor.
Yeah.
That's the joke.
That's what I got you.
So I haven't had to use Visual Studio for a while, but we did used to i was using it for compiling stuff and i i can't remember what the short code was for compiling it was like f7 or f11 or f2 one of the f keys was just to compile and so whenever anybody asked me or do you use visual studio i'm like just as a really big uh thing to hit f7 with um or whatever yeah yeah yeah yeah um so yeah and that it's true i would i would edit in way back in the day.
It was before Visual Studio or VS Code. So I was probably editing it in Vim or Sublime or something like that. And then I'd have Visual Studio off to the side and I would just go over to it and hit the key to compile and then go back to my day.
This is what it is.
This is a good one. I like it.
I do too. I used to use Visual Studio and I enjoyed it. I thought it did cool stuff.
as a default text editor for just simple files.
It is not what it was for.
Yeah, I had people like composing their email in Visual Studio.
Oh my gosh.
Really? This is what you know?
Okay.
All right. Fair.
Well, I mean, they probably do have a history of mental illness then.
I think so.
Then they open up Outlook and send it and you know for sure there's something going on there.
Outlook.
Exactly.
The only thing on my desktop that if I hit Control-F, it doesn't find stuff.
It forwards an email.
Yeah, exactly.
So, well, excellent episode again.
Thanks, Michael.
Thanks, everybody, for listening.
You bet.
See you later.
Bye, everyone.
Bye.