- Podcasts
- Python Bytes
- #443 Patching Multiprocessing
About this episodeTopics covered in this episode: rumdl - A Markdown Linter written in Rust Coverage 7.10.0: patch aioboto3 You might not need a Python…
- rumdl - A Markdown Linter written in Rust
- Coverage 7.10.0: patch
- aioboto3
- You might not need a Python class
- Extras
- Joke
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#443 Patching Multiprocessing
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.
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.
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.
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 Typora, 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.
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 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.
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 boto3.
So boto3 is the Python package to talk to things like S3 and other stuff in Amazon. Okay. And AWS. Don't get me started on boto3. 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.
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.
Did you find one? No. 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.
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.
- 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
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.
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.
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. 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.
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, 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.
