- Podcasts
- Python Bytes
- #438 Motivation time
About this episodeTopics covered in this episode: Python Cheat Sheets from Trey Hunner Automatisch mureq-typed My CLI World Extras Joke See the full show…
See the full show notes for this episode on the website at pythonbytes.fm/438
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#438 Motivation time
Hello and welcome to Python Bytes, where we deliver Python news directly to your earbuds. This is episode 438, recorded June 30th, 2025. I am Michael Kennedy. And I am Brian Okken. And this episode is brought to you by the amazing folks over at Posit and Posit Connect, their data science execution and hosting platform, and a bunch of other things, which Brian will tell you about shortly.
But for now, if you want to connect with us, you can do so over at Mastodon or Bluesky or to a lesser degree even on X. Although that place has not got as much action these days, sadly. But yeah, connect with us over on social. Join us on YouTube right now. We're recording live. We typically do that at 10 a.m. on Mondays, a few minutes after 10.
we sort of get stuff ready. And when we got it all set, we push go. So you can find out more about that and get notified and subscribe, you know, crush the bell, all that sort of stuff over at pythonbytes.fm/live. And if you want an extra additional insights into the episode and the tools and topics we cover, sign up, become a friend of the show by joining our mailing list.
And Brian will send out an awesome email that not just lists what we talk about or have in the show notes, but way more. It's really, really good. Right, Brian? Yeah. I like it a lot. I do too. I'm really liking where it is these days. I enjoy reading it. Would you say it's cheating though? Do you feel like it's cheating?
It's definitely cheating. No, cheating is okay sometimes. It is. All right. So let's hop into the first topic. On the Python Morsels website, this is Trey Hunter's blog and thing. I'm not sure what you call it. Anyway, it's a training sort of thing. He's got a whole bunch of articles about, he pulled together a list of all of his cheat sheet articles.
And I kind of love this. So there's some of these that I'm going to pull out a few of my favorites. But so Trey Hunter's cheat sheets, we've got Python string methods, built-in functions in Python, fstrings, converting a string to a date time, pathlib, even big O notation. Nice. The time complexities of different data structures.
That's cool. Anyway. Some of these are through, you have to pay to be part of a service to watch some of them, but some of them are free. I'm going to highlight a couple of the free ones. Python F string tips and cheat sheets. So we all love f-strings, but sometimes I can't remember all the different formatting stuff like formatting numbers.
So this is good to have just some cheat sheets. Like how do, if you do want to do zero digits or zero digits or prefix, like you want, you want to have like, if you're going to do money, you want dot zero, zero or something. And so how do you do that? It's point two F nice. Or, but it's like the variable and then colon point two.
Anyway, I'm not going to try to describe it on the podcast, but having all of this in here and then occasionally you want like zero padding or space padding or something. and so it's good to look up how to do that. It's got a whole bunch of stuff. Space padding, yeah. Neat. Yeah, those little tricks and formatting tips that go into the f-strings or string.format or whatever, those are amazing and they're super rich.
There's a lot you can do with them. I didn't know you could do thousands of separator. That's neat. That's cool. Yeah, I do that all the time and I combine it. I'll do comma 0.2 F and it'll do two decimal places Oh, nice groups. Okay. So f-strings, cheat sheet, that's great. Another one, Pathlib module.
Like, what is the thing that Pathlib decided to use that was obvious? It's not always obvious. So cool cheat sheet there on Pathlib. The other one I want to point out is Python's mini command line utilities. And those are things that you just say, like just built into Python, you can say Python dash M and then the thing.
And it's usually an internal standard library thing. But if you just run it by itself, some things you can, there's a bunch of stuff you can do. I was, there's a general purpose, the general purpose ones, we like a lot of people know that you have http.server does a thing. But JSON tool is kind of nice.
You can do JSON tool to kind of print out some JSON nicely. Calendar is a nice cheat sheet for just being able to print out a calendar and figure out when, like, and you can give it a date. If you just do calendar, it'll print today, but you can give it a special date and it'll print that out if you're trying to figure out, wow, in 1996 was April 3rd on Monday, or, you know, you can do things like that.
And my favorite is especially handy on Windows section because I kind of grew up on Solaris, actually, but Unix environments. And so but I spend my days on a Windows machine. So I get like sad if I don't know where zip or gzip or tar are and things like that. I don't really use tar that much these days.
But you can use these things directly from Python if you have Python installed, like Python-mgzip, and you can have zip and unzip utilities. This is great. FTP, so many things that are just standard on Linux that aren't on Windows. You can install them, but if you have Python, you already have them installed.
So that's pretty neat. Anyway, those are some fun cheat sheets. There's a bunch of others, too. So thanks, Trey, for pulling all of these together. Yeah, those are pretty cool. And the CLI tools, there's a lot of them. Yeah, there really are. This is a big article. So yeah, I think we've covered it before, but I think so. But now it's grouped in with all the other things.
Yeah. Indeed. All right. Let's talk about something that I'm excited about, Automatisch. So Automatisch is automatic in German. And this is a tool called, which is an open source alternative to Zapier. So Automatish helps you automate your business processes without coding. They have a, you can sign up for this instead, which is kind of just like Zapier. So, you know, I mean, good for them and all, but the real reason that it's interesting to me is you can self-host it.
Okay. Yeah. So this is not, it is not a Python built tool, but I don't really think it matters. I think it's a tool that would be super useful for people doing Python things. You know, like I tool to listen to Slack. And when somebody posts something with this word in it, I want it to call a web service that's written in FastAPI or, you know, something like that, right?
So yeah, it's super cool. It's well loved. It's got 12,000 plus GitHub stars. And if you've used Zapier, it feels a lot like it. You know, you go in there and say like this thing they have on the homepage that's like, well, when somebody posts something on Twitter, then I want you to do something in Slack, right? Maybe if somebody posts something that talks about our brand, then post into the marketing Slack, right? I don't know, just making stuff up, right? So super cool.
and you don't want to share that information with cloud services, it's Docker Compose Up, and you've got your own Zapier, which I think is pretty cool. It's open source and doesn't have really that much vendor lock-in. I mean, there's some lock-in to the app, but not into them per se because you have the source code, I guess, is the motivation.
If you go look at all the integrations, there's quite a few. Airtable, AppRite, ClickUp, Datastore, DeepL, Discord, Disqus, Flickr, how about that? GitHub, GitLab, Google Calendar, and so on, right? Quite a few things you can connect with into, out of, RSS, and so on. Webhooks, which is the one I was talking about, right?
So they've got a Docker compose file, like I said, and they have a Docker image. and Automatish IO, which it's just based on. So you don't even really have to build it. You just, you know, pull the thing. And once you have it, you're good to go and you run it. And one of the things they do, I thought, just, you know, people who are in the Docker land.
So the Docker compose endpoint or entry point rather runs this shell script. And the shell script actually goes and it looks and it says, if you don't have a.env file already set up, like if you didn't set one and copied over, It'll do things like set up random SSH or random rather encryption keys and webhook secrets and other types of things.
Make sure you randomize this. Don't leave it the default or you might get hacked. You know, that kind of stuff. Yeah. Yeah. I just thought that was kind of a cool little technique there doing it. I just saw on Bluesky, I think somebody commenting that instead of putting their API keys in their source code, they changed the name to, this is not my API key.
I haven't decided if it is for me or not yet, but I kind of want to play with it. So I was curious, like a number of forks, is that like, is high good or? I think so. Well, to me, the number of forks indicates in a healthy project, how many people want to contribute back? Because if you're going to fork it and then PR, do a PR back, you can't do it directly.
Like how many contributors? There's not that many. Maybe like save it. But you know, if you're doing this for your business, you probably fork it. Like we just need a copy just in case. I think where it might be a bad, bad thing is where there's been like a big reaction to like a change in an open source license or something.
And people are like, I'm going to grab it real quick. You know what I mean? Like I'm thinking of Redis or some other other things where there was like drama. You know what I mean? I don't know that there's any drama about this. I haven't heard of any drama. So I was just thinking about that, like the forks, because the yeah, like you said, it's you have to fork it to contribute or and some people fork it.
just to play with it. But then also that doesn't mean that there's, there's 800 supported forks. They're just. Oh no. Yeah. So for me, there's kind of two reasons I fork stuff. One, because I want to contribute or two and like, this is really important. What if it were just to go away for some random reason?
I just want to copy. You know what I mean? Oh yeah. Yeah. All right. Yeah. Cool. So those are, those are the two, right? Like I might fork court and flask because talk Python is based on those things. All right. And I don't really necessarily need to contribute to them, but I kind of just want to have a copy, you know, because it's so important.
Posit has made a huge investment in the Python community lately. Known originally for our studio, they've been building out a suite of tools and services for Python. Today, I want to focus on hosting your Python-based data science workloads. This includes dashboards, reports, plots, interactive web apps, all the way to custom Flask and Django apps. Their service is Posit Connect.
Connect will manage your APIs and serve your interactive apps. If and if desired, update your ports and dashboards on a scheduled basis. That's cool. That's right. No more need to explain to the stakeholders why the dashboard or plot stopped updating last week. You get to focus on your data science and leveraging your skill set while Connect makes you look good, keeping your code running in private.
Thank you so much, Deposit, for supporting Python Bytes. Definitely. Thank you, Deposit. Very cool service. All right, Brian, you probably don't remember Murecht, but it is something we covered way back in 2022. M-U-R-E-Q, as in mu, the micro symbol in science. And the idea of that was we're going to have the minimal, the most minimal version of request the library as possible.
So that's fun. And it's really cool for times you don't want to have external dependencies. You can just copy the one file into your project or just take the code and jam it at the end of your project or however you want to do it, right? Yeah. So Harold Martin sent us a note, said, hey, I have updated this project, forked, I believe, and created a new one, updated for murex typed.
Yeah. Neat. Yeah. So why do you care about this? Well, like I said, it's a single file, zero dependency alternative to requests, but works on modern tooling. You can open it up. It's literally murec.py and you just copy this puppy in. But if you just look in here, you can see, you know, like the default timeout is a colon float.
And the headers are a mutable mapping of string string or an HTTP message. And there's like, you look at the typing, like there's some of these down here that are pretty gnarly. I'm glad I didn't have to write them. Like this yield response has headers or a list of tuples of strings of strings, or it could be none with a default of none and so on.
So there's a couple of cool benefits to not having dependencies that you have to worry about. And by the way, it's the same API as requests. So if you have requests, you could use this. You could just change the import statement, or you could even do import murect as requests and then don't touch the rest of your code.
You know what I mean? So it says, why do you even care about this? Well, apparently it's quite a bit better in terms of memory usage. So like standard Python, 7.4 megs to run on, I don't know, apparently Ubuntu on AMD 64. But if you go and run murect and you import it, picks up in some more libraries, do an actual function call, it's 15 megs.
And Python 3 has HTTP.client, which does a bunch of similar stuff. So it's pretty easy to wrap that in the same API is what he's saying. And finally, no supply chain attacks. You can get this one file, validate it, put it in there, and then it's not going to get updated. it's about 500 lines of code.
Just vendor in something if you can and pretty good. Yeah. It's the opposite of LeftPad. Remember LeftPad, right? Yeah. Yeah. With the JavaScript thing that took down like the world. But no, right pad. I don't know. What's up with that? So left pad, let's see. When was this? I think this is the same guy.
I think he got ultimately, yeah, it's got its own Wikipedia page. This guy took down the left pad package. There was a separate package you got to left pad a string. So I just sit and write in the job. You know, npm install left pad, basically, or npm. And what they say of it, two-year dependencies, right?
Guy got mad that people were taking advantage of his open source work and deleted it or something like that. And it just, it took down, like it took down React and some other things. Facebook, PayPal, Netflix. Yeah, this caused a widespread disruption as technology corporations, small and large, including Facebook, PayPal, Netflix, and Spotify, who use a lot of bad, their software products could no longer build their packages.
I mean, it's bad. Is this, there was another guy who also got arrested for creating a bomb. And I'm not sure if this is the same guy. Maybe that was a Python guy. One of these guys that like did something like this also. It might be a sign of like an unstable situation. But anyway, it's kind of funny and kind of just over like the most extreme example you can look at.
But stuff like this, this Vendorian N for these simple things is like, okay, you're no longer subjected to that weirdness, right? Yeah. I guess the opposite side is if there were a security vulnerability in the code, not malicious necessarily, but something they missed and they updated, you're not going to get that fixed either, right?
So you got to consider those things. But being a wrapper on the built-in HTTP.client is probably fine. Interesting. I was just looking up our history. You can search Python Bytes. And even though LeftPad happened in 2016, the same year that we started Python Bytes, that term doesn't show up until 2021, four years ago.
Last one for you. Yeah. I want to talk about command line interfaces. Actually, not command line interfaces, really shells. So Frank Wiles posted MyCLIWorld, and he's talking about shell customizations. Let's see. He says, when I was first starting out, I spent a bunch of my time SSHed into a remote server, so didn't customize his shell that much.
But now he's mostly doing web development on a local laptop, which I realized that it's a big change for me, too. I am not SSHing very much anymore. So customizations are easier. So I kind of love these sorts of articles of like, these are the customizations I use. But he also listed a bunch of cool tools that he's using.
I tried Starship, and something about my setup, it slowed my shell down too much. So I'm not using Starship anymore. But I wanted to pop over, not go through his full article, but talk about some of the things he brought up. DIRenv, D-I-R-E-N-V is one of the tools. And this is to before each prompt during VDR, however you pronounce that, checks for the existence of environment RC files, ENV RC and optionally.ENV files and does any settings.
So like we were talking about with one of your previous tools, if you've got like API keys and stuff hiding in a.ENV, you can have that automatically loaded up when you go into the correct directory. It's kind of nice. Then Zoxide, which this is definitely one that it was been on my list to try out.
So it's a, instead of the pattern of find a name, you know, finding a name, name of a file and finding that somewhere, it's a better way to find stuff. And then if you're actually looking in, wanting to look at the contents, Ack, I think I'm sure we've covered Ack before. Ack is a great tool for really quickly looking, it's better than grep and said sort of things.
So I want to check this out for backing up my shell history. Should be fun. um he also in the article he refers to using just files and uh and for some reason just just just doesn't work for me so i guess i'll just add on that we covered po the poet it does similar a similar role as just so um anyway uh another and then he talks about some customizations like uh his own aliases and um even has a an article for one of the a couple of the aliases which is This is, I was like, I never thought to do this as an alias, but I'm so glad that he wrote this down. So let's say you're working on a project and you, before you, you hop in and you know, there's been changes by some other, somebody else on the team. So you do a get pull and a bunch of stuff gets pulled in. What just came in? And so there's, it's just a, you, apparently you can get it with get log with like a, at curly brace one, something like that. I'm not going to remember
that so he made an alias that's just um just that but it it's called get pull log or get diff or pull diff um does a diff basically of like what what changed and the actual code that changed but the log is the stuff i pulled in what are the get comment or the commit comments for those um so uh again just really love the uh the idea of um of people writing blog posts of all of their shell customizations and sharing all the command line tools that they use is pretty nice.
There's a lot of cool stuff that isn't there. Yeah, I've used Xoxide. I really liked it. I think some of the others are cool. These Git little tips are great as well. Like, I'd never remember those things either. Super weird. But yeah, you just alias stuff. And I think that's one of the tricks is like some of these shell things are hard or complicated or even just a lot to type.
But if you just put them into your profile or your B, your bash or ZSHRC file, right, then just remember the one or two words, right? And you're good to go. Yeah. And I also, I like the idea. So some stuff is different for different projects. So you might have like the same command using just or PO, you can have the same command do different things depending on which project you're in, the appropriate thing for that.
I wonder if you could use dir env to change what the same command means per directory. Like maybe something is built using make and another thing is built using, I don't know, poe or something, right? And you could just have like the word build do whichever it is. But if you're in that directory, it looks up and says, okay, that means call make in this case.
Otherwise it calls, you know, wouldn't that be neat? Yeah. Yeah. Cool. Cool. Yeah. Very neat. For people out there who are like, I'm kind of not very comfortable in the terminal or I don't like being in the terminal. Look at stuff like this. If you just open up a bare bash shell or a bare power shell or whatever, that is not a nice experience.
But if you put a bunch of these little cool extensions and add-ons and make it your own, all of a sudden it's not just not bad. It's delightful, right? And so I think especially people who are kind of beginners listening, like look into this stuff. Yeah. I always get thrown when I assume VI mode or Vim mode, and it's usually not the default.
So my big tip is set-O-VI, and then it works. There you go. Yeah, if that's what you're expecting, definitely do that for sure. Yeah. All right. You got extras? I got no extras. I just have one extra that's kind of out of the blue. It's a completely, and now for something completely different sort of thing.
An article my wife shared with me, which I thought was fun. it's on the phys.org website it's a new theory proposes time has three dimensions with space as a secondary effect um anyway it's a fun read about uh possibly three-dimensional time like kind of like we have three-dimensional space um and uh it's interesting read uh kind of kind of a fun picture too and i do like that i'm seeing this now people are actually fessing up when they have an AI generated image as a credit.
Anyway, running a quick little search. I came up with a Python on the beach. the one where you came in, dialed in from Hawaii, which is awesome. But if you go down to the extras, this is what I was hinting at. And this is not the same person. So this is a totally different, not a left pad incident, a left pad like thing.
So Merrick Squires, who had taken a couple of his packages and like done some sort of supply chain attack or at least sabotage. Also, this is a post that says, hey, Brian Krebs, I just noticed that this guy, Marek Squires, seems to be the same fellow that sabotaged two of his own popular open source libraries last week, KellerJS and FakerJS.
I admire your dedication to the role. And they're all with these nice pictures. Yeah, like over the motivational background pictures. The sun setting. Last one. Today I am letting go of the things that are holding me back from the life I want to live. Then I'm picking them all back up again because I have separation anxiety.
anyway um i love love the uh the funny things i'll put a link to the uh to the book and um not with any sort of like kickback link just a link to the book people are plain old link just a plain old link sweet yeah that's really good those i love those things which are funny i haven't seen the whole book but it i it definitely appeals to me i i know there used to be i think they're still around the demotivator posters right like the motivational posters they have the demotivators and they're similar thing in like poster form yeah by a company called despair Inc I believe is what the title the name of the company and and it's it reminds me also way back in uh SNL I don't remember which genre of SNL but SNL had uh deep thoughts by Jack Handy and um and I always thought that was like a made up thing, but apparently that's the, it was one of the writer's names was Jack Handy.
So it wasn't. Okay. Awesome. Well, very funny. Thanks for the joke. All right. And thank you to everyone for listening. If you're here live, thank you for being here live. And if you watch us on YouTube, be sure to subscribe to the channel to get these all the time. We have all of them recorded and available for you and subscribe or follow.
