Python Bytes - #427 Rise of the Python Lord

Episode Date: April 7, 2025

Topics covered in this episode: Git Town solves the problem that using the Git CLI correctly PEP 751 – A file format to record Python dependencies for installation reproducibility git-who and wa...tchgha Share Python Scripts Like a Pro: uv and PEP 723 for Easy Deployment Extras Joke Watch on YouTube About the show Sponsored by Posit Package Manager: pythonbytes.fm/ppm Connect with the hosts Michael: @mkennedy@fosstodon.org / @mkennedy.codes (bsky) Brian: @brianokken@fosstodon.org / @brianokken.bsky.social Show: @pythonbytes@fosstodon.org / @pythonbytes.fm (bsky) Join us on YouTube at pythonbytes.fm/live to be part of the audience. Usually Monday at 10am PT. Older video versions available there too. Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list, we'll never share it. Michael #1: Git Town solves the problem that using the Git CLI correctly Git Town is a reusable implementation of Git workflows for common usage scenarios like contributing to a centralized code repository on platforms like GitHub, GitLab, or Gitea. Think of Git Town as your Bash scripts for Git, but fully engineered with rock-solid support for many use cases, edge cases, and error conditions. Keep using Git the way you do now, but with extra commands to create various branch types, keep them in sync, compress, review, and ship them efficiently. Basic workflow Commands to create, work on, and ship features. git town hack - create a new feature branch git town sync - update the current branch with all ongoing changes git town switch - switch between branches visually git town propose - propose to ship a branch git town ship - deliver a completed feature branch Additional workflow commands Commands to deal with edge cases. git town delete - delete a feature branch git town rename - rename a branch git town repo - view the Git repository in the browser Brian #2: PEP 751 – A file format to record Python dependencies for installation reproducibility Accepted From Brett Cannon “PEP 751 has been accepted! This means Python now has a lock file standard that can act as an export target for tools that can create some sort of lock file. And for some tools the format can act as their primary lock file format as well instead of some proprietary format.” File name: pylock.toml or at least something that starts with pylock and ends with .toml It’s exciting to see the start of a standardized lock file Michael #3: git-who and watchgha git-who is a command-line tool for answering that eternal question: Who wrote this code?! Unlike git blame, which can tell you who wrote a line of code, git-who tells you the people responsible for entire components or subsystems in a codebase. You can think of git-who sort of like git blame but for file trees rather than individual files. And watchgha - Live display of current GitHub action runs by Ned Batchelder Brian #4: Share Python Scripts Like a Pro: uv and PEP 723 for Easy Deployment Dave Johnson Nice full tutorial discussing single file Python scripts using uv with external dependencies Starting with a script with dependencies. Using uv add --script [HTML_REMOVED] [HTML_REMOVED] to add a /// script block to the top Using uv run Adding #!/usr/bin/env -S uv run --script shebang Even some Windows advice Extras Brian: April 1 pranks done well BREAKING: Guido van Rossum Returns as Python’s BDFL including Brett Cannon noted as “Famous Python Quotationist” Guido taking credit for “I came for the language but I stayed for the community” which was from Brett then Brett’s title of “Famous Python Quotationist” is crossed out. Barry Warsaw asking Guido about releasing Python 2.8 Barry is the FLUFL, “Friendly Language Uncle For Life “ Mariatta can’t get Guido to respond in chat until she addresses him as “my lord”. “… becoming one with whitespace.” “Indentation is Enlightenment” Upcoming new keyword: maybe Like “if” but more Pythonic as in Maybe: print("Python The Documentary - Coming This Summer!") I’m really hoping there is a documentary April 1 pranks done poorly Note: pytest-repeat works fine with Python 3.14, and never had any problems If you have to explain the joke, maybe it’s not funny. The explanation pi, an irrational number, as in it cannot be expressed by a ratio of two integers, starts with 3.14159 and then keeps going, and never repeats. Python 3.14 is in alpha and people could be testing with it for packages Test & Code is doing a series on pytest plugins pytest-repeat is a pytest plugin, and it happened to not have any tests for 3.14 yet. Now the “joke”. I pretended that I had tried pytest-repeat with Python 3.14 and it didn’t work. Test & Code: Python 3.14 won't repeat with pytest-repeat Thus, Python 3.14 won’t repeat. Also I mentioned that there was no “rational” explanation. And pi is an irrational number. Michael: pysqlscribe v0.5.0 has the “parse create scripts” feature I suggested! Markdown follow up Prettier to format Markdown via Hugo Been using mdformat on some upcoming projects including the almost done Talk Python in Production book. Command I like is mdformat --number --wrap no ./ uv tool install --with is indeed the pipx inject equivalent, but requires multiple --with's: pipx inject mdformat mdformat-gfm mdformat-frontmatter mdformat-footnote mdformat-gfm-alerts uv tool install mdformat --with mdformat-gfm --with mdformat-frontmatter --with mdformat-footnote --with mdformat-gfm-alerts uv follow up From James Falcon As a fellow uv enthusiast, I was still holding out for a use case that uv hasn't solved. However, after last week's episode, you guys finally convinced me to switch over fully, so I figured I'd explain the use case and how I'm working around uv's limitations. I maintain a python library supported across multiple python versions and occasionally need to deal with bugs specific to a python version. Because of that, I have multiple virtualenvs for one project. E.g., mylib38 (for python 3.8), mylib313 (for python 3.13), etc. I don't want a bunch of .venv directories littering my project dir. For this, pyenv was fantastic. You could create the venv with pyenv virtualenv 3.13.2 mylib313, then either activate the venv with pyenv activate mylib313 and create a .python-version file containing mylib313 so I never had to manually activate the env I want to use by default on that project. uv doesn't have a great solution for this use case, but I switched to a workflow that works well enough for me: Define my own central location for venvs. For me that's ~/v Create venvs with something like uv venv --python 3.13 ~/v/mylib313 Add a simple function to my bashrc: `workon() { source ~/v/$1/bin/activate } \ so now I can run \workon mylib313orworkon mylib38when I need to work in a specific environment. uv's.python-version` support works much differently than pyenv's, and that lack of support is my biggest frustration with this approach, but I am willing to live without it. Do you Firefox but not Zen? You can now make pure Firefox more like Zen’s / Arc’s layout. Joke: So here it will stay See the follow up thread too! Also: Guido as Lord Python via Nick Muoh

Transcript
Discussion (0)
Starting point is 00:00:00 Hello and welcome to Python Bytes where we deliver Python news and headlines directly to your earbuds. This is episode 427, recorded April 7th, 2025 and I am Brian Ocken. And I'm Michael Kennedy. And this episode is brought to you by Posit package manager. Check that spot out later in the show. Also connect with us if you'd like to, on Mastodon or Blue Sky. Links are in the show notes. And then also if you'd listen to us
Starting point is 00:00:29 through a podcast player or something, occasionally it's fun to stop by and watch us live or at least see past live episodes. You can go to pythonbytes.fm slash live. We usually do it Mondays at 10, but sometimes it changes. Anyway, it's fun to have you here and some people hop in and. Anyway, it's fun to have you here and some people hop in and ask questions and it's good. Anyway, also after the show, when we have everything,
Starting point is 00:00:52 all the dust settles, we send out links through our newsletter. So please go to pythonbites.fm and add your name to the email newsletter and you'll get the links and some extra content delivered right to your inbox It's pretty good. Um, yeah, absolutely How what do you got for us to start with? Let's go on a trip Brian. Let's go on a trip Okay, I want to go to take a little trip to get town get town 18 43. Let's do it So get town is an interesting project. I believe it's written in Python. I'll double check that in a second, although it's not totally germane.
Starting point is 00:01:29 It's a tool that you can use. And the idea is with the Git CLI, or honestly, most of the Git GUIs, like I'm a big fan of primarily doing Git through GUI operations using Sourcetree, PyCharm, VS Code, whatever I happen to be in, right? I don't think I like, well, pretend my editor doesn't know what any of the source control is and go to the terminal and do it and then come back. Like, I just preferred that way, especially, you know, that's why I called out that Git branch explorer, that two-e based one that we talked about last week, which I didn't Rust. So one of the things you'll find with most of these tools,
Starting point is 00:02:06 especially the CLI, but often all of them, is they're great at the atomic operations of Git and source control, but they don't have workflows built into them. So by that I mean, I want to create a feature branch off of this branch, and as I'm working on the feature branch, I would like to be able to type a feature branch off of this branch. And as I'm working on the feature branch, I would like to be able to type a single command and have that branch make sure that it's up to date with it
Starting point is 00:02:30 without breaking the work that I'm currently doing. Maybe in the middle of a feature branch I'm working on, I need to create a bug fix branch and do that, come back, sync them. There's like these higher level things that you would like to do, okay? So Git town is a CLI, I think it's a plugin. I think Git has like plugin type things
Starting point is 00:02:47 because the commands are still Git space command, subcommands of Git, right? So it's not a totally separate thing. Anyway, it operates all, it sort of brings all those together. And so if you're, if what I'm about to describe sounds interesting to you, you should really, really watch this seven minute video at get dash town.com and it says please check it out right so just watch this and it talks through the different
Starting point is 00:03:09 scenarios shows you how it works and so on however if you jump over to the get town github repo it gives you a much better understanding of all the pieces there and by written in Python I mean written and go okay. So it has a couple of different commands it says I could type git like in a git repo I could type git space hack and that will create a new feature branch that I can explore that will not affect any of the main work and if I need to throw it away or whatever it's fine it's kind of like the exploratory. Hack in a positive sense not hack is in the I got a hoodie and it's shady in my room sort of thing. Or sync if I'm on top if I'm on some kind of feature branch I can update that branch from the main because one of the things you want
Starting point is 00:03:56 to do as you're if you have a long running feature branch is keep periodically pulling from the main branch in there so you are less distant from it, right? If for some reason, like when you want to go back, you want that to be a just your changes, not your changes plus all of the conflicts that you've been, you know, potentially messing with and you've got another round basically. So this, you would just type git space sync. That's cool. You could type git switch to change branches via UI. Or once you are happy with your Feature branch you can say get proposed and that'll create a merge It'll create a pull or merge requests for a feature branch back on github things like that So there's a bunch of cool things like that. I thought it was gonna ask it to a dance
Starting point is 00:04:39 Exactly, you know, I mean, I know we haven't talked much and I know this is seventh grade and we're all really shy, but do go to the dance with me. My dad can drive us. Another one is you can do things like get ship, which will merge a completed feature branch and then remove it once it's successfully shipped over and so on. So there's like these cool things on top of it,
Starting point is 00:04:59 but certainly I recommend watching that video, that seven minute video, to see if this is something that's interesting to you. I think I like it, I think it's pretty cool. I could at least. There's some cool ones that I always forget about, like get town rename. I mean renaming's not difficult,
Starting point is 00:05:16 but it's nice to have a little minor. Yeah, so absolutely. And if you watch the video, you'll see that there's a lot of, really this thing is mostly built around like, yeah, you could, you could be like, well, why can't I the video, you'll see that there's a lot of really this thing is is mostly built around like yeah You could you're like well Why can't I just do you know get merged from this branch and this and that and you sure you can do these things But it has a bunch of little steps to kind of catch the edge cases like it'll use stashing for certain
Starting point is 00:05:39 Operations when it's sure that you don't want any of your changes change and other things like each one of these commands usually results in look Five or six or seven get commands It's worth checking out of especially if you like get via the CLI or you're looking at team that has once really structured ways Of doing these things. I'm definitely gonna check it out. And actually I use the the I can't remember what we called it last week The sag or something like that but I used it this weekend to look at a Git log from a project that I hadn't been familiar with to see what was going on.
Starting point is 00:06:12 Awesome, have you tried it on your Windows? Like I want a Windows Terminal follow-up. What was I using it on? Remember you were wondering if it would work on Windows? Yeah, no I was using it on my Mac laptop. Okay, well the follow-up is still pending then. Okay, and we'll check out get talent on Windows as well. Although it's a little trip to get down. It's probably fine. So yeah, that's just
Starting point is 00:06:35 automate to get which works everywhere. Okay, last week we did get going back to last week. I guess we did talk about a couple of PEPs, and today I'd like to talk about another PEP. This one comes to us from Brett Cannon. Well, I saw him post it on Blue Sky. PEP five set pipes, try that one more time. PEP five, PEP 751, not five so new, and 751 has been accepted.
Starting point is 00:07:03 So what is this PEP about? It's about lock files. So Brett says this means Python now has a lock file standard that can act as an export target for tools and create some sort of lock file. And for some tools, the format can act as a primary lock file format, as well as instead of some proprietary format.
Starting point is 00:07:21 So we already had lock files, a couple, lots of different tools had lock files, but they weren't the same lock file. They were like UV had a lock and I think poetry had a lock and there's a couple others. So now we have a standardized one and it's actually, I was looking through the standard, it looks pretty great.
Starting point is 00:07:39 One of the things that you would expect, you could do environments and versions and packages and stuff. One of the things I thought was kinda cool, scrolling down to the bottom, was that there's a tool section that is pretty much open-ended, and this allows arbitrary tool configuration.
Starting point is 00:07:58 So if other tools like Poetry or whatever wanna try to use this instead or migrate to it but but it doesn't kind of cover some of their own configuration they can override this and put some extra things in here which I think is pretty cool there's also packages tool I'm not sure which I don't know when you would do use one or the other but I'll leave it up to some tutorial writer to figure that one out. So this isn't isn't to a if you wanted to try this out now. Well, let's look at an example first. The examples is in the video if you want to check out the live version if you're listening, but it's a we're linked to it as well. It's in the
Starting point is 00:08:40 pep. There's an example. Mostly this is fairly readable and I'm pretty on board with how this is set up. Looks pretty good. It's a Toml syntax. You've even got things like, of course, hashes and stuff if you want to leave the hashes in for making sure it's the right thing. So this is all great. The other bit scrolling down is, well, how can I use this right now? There is some stuff, information about how to teach it, of course. Some discussion around rejected ideas. Oh, I forgot to mention the name. The name of it is PyLock.toml, or PyLock something.toml. That's just what they came up with. It doesn't, it doesn't conflict with any other tools right now.
Starting point is 00:09:29 And it's reasonable. So that's good. The if I, if you want to try this right now, I thought I, I thought we had a implementation. There's a, there's the, there was, okay. I can't find it right now, but there was an implementation already that is just an example that it's in Brett's tool, Mousebender, so Mousebender allows you to play with it
Starting point is 00:09:56 if you want to play with it right now. So I imagine that some of the other tools will kind of take this up also, and I would expect that that like for instance, a UV or something might, I don't know. I'm not involved with the UV, but I would expect some of these tools to pick them up pretty quick, but we'll see.
Starting point is 00:10:15 Yeah, well first of all, congratulations Brett Cannon. I know you've been working on this for a long time. And here we are, super exciting. So I'm sure some conversations at PyCon will be had about this. Super neat. So one thing that I like is the format. I saw like the hash is on the same line
Starting point is 00:10:36 as the actual requirement pinned version there. So I've tried to do hashes in my requirements.txt files and the hashes so overwhelm the version of the thing that you actually have in the diff that it's just like well just it's a bunch of hash variations when I look at the diff and I got a hunt for the actual new version like well what one of these change because the version changed and you know what the new version, and so on. So the way this looks, it looks like it's going to be, well, it might differ also on the end for the hashes,
Starting point is 00:11:11 but the first thing that appears on the line is the actual version number wheel, and so on. So I think that's gonna be really nice to look at. So I might put hashes back in. That'd be cool. Yeah, I think it's kind of cool that there's an upload time. So if you don't wanna deal with hashes, but cool that there's an upload time. So if you, if you, if you don't want to deal with hashes, but you do want to grab the upload time as a way to,
Starting point is 00:11:29 to check for things that's cool. Yeah. You just kind of know how old it's at as well. Right. I mean for things that are not using Calver or they're abusing Calver, you know, is it five minutes old or is it five months old? That might matter to you. Yeah. Yeah. Yeah, yeah. Very cool. So awesome. I'm here for it.
Starting point is 00:11:48 Do you know what else is awesome? What is that, Brian? I think Posit is pretty awesome. Oh, they are awesome. Very much. So I'd like to take a moment to thank our sponsor. This episode of Python Bytes is brought to you by the folks at Posit. Posit has made a huge investment in the Python community lately.
Starting point is 00:12:02 Known originally for RStudio, they have been building out a suite of tools and services for Team Python. Over the past few years, we've learned some pretty scary terms like type squatting, supply chain attack, obfuscated code, and more. These all orbit around the idea that you install Python packages. When you install Python packages, you're effectively running arbitrary code off the internet on your dev machine and usually even your production servers. That thought alone makes me shudder. This doesn't even touch on the reproducibility issues
Starting point is 00:12:34 surrounding external packages, but there are tools to help. Posit package manager can solve package manager can solve both problems for you. Think of Posit package manager as your personal package concierge. You use it to build your own package repository within your firewall that keep your project safe.
Starting point is 00:12:54 You can upload your own internal packages to share or import packages directly from PyPI. Your team members can install from these repos in the normal ways using tools like pip, poetry, and UV. Posit Package Manager will help you manage updates, ensuring you're using the latest, most secure version of your packages. But Posit Package Manager also takes point-in-time snapshots of your repos, which you can use to rerun your code reproducibly... rerun your code reproducibility in the future. Posit package manager reports on packages
Starting point is 00:13:28 with known CVEs and other vulnerabilities so you can keep ahead of threats. And if you need the highest level of security, you can even run Posit package manager in an air gapped environment. If you work on a data science team where security matters, you owe it
Starting point is 00:13:44 to you and your org to check out Posit package manager. Visit pythonbytes.fm slash ppm today and get a three month free trial and see if it's a good fit. That's pythonbytes.fm slash ppm. The link is in your podcast player's show notes. Thank you Posit for supporting Python Bytes. Indeed. Thanks Posit. It's a cool project Having a little bit more control over your packages is always a good thing Well Brian I want to carry on with the theme of git and talk about three more get project get topics I believe at least who so we know where like this
Starting point is 00:14:19 This is sort of the thing they teach you and early writing classes, all the W's, right? Who, what, where, when, why, how are we covering these things? We've gone from where to who, and now we're talking about git-who. So I've always enjoyed the git blame, or basically more broadly, source control blame, like, all right, who did this?
Starting point is 00:14:43 Do you see that line of code? Who do I talk to about this? they are not very good or we need to talk to them or there's something way more complicated going on here and I need to understand it better but who do I talk to about this line of code you know I mean and the way that works is you can run that on a file and it shows you line by line who made the last change to that particular line right editors support that super easy these days like in pycharm if you it'll actually put an overlay of who who wrote the function or whatever last if you click on that it'll
Starting point is 00:15:13 like sort of slide out the get blame but that's a line by line type of thing what if instead I wanted to know as a entire project like if I go to the repo and I type get who dash l it will say who has made how many commits, how many changes, how many lines, when did they last do that as a summary of the project instead of a summary of the line. Cool right? So that's super easy to do and you can go into subdirectories and sort of explore those and go who's created changes on this particular sub directory or whatever. So I think this is really neat. It's sort of a natural extension of git blame. Okay, so you can like give it a particular file even and just say who modified this file? I would yeah, I would think it would say how many contributions there are to that particular file. I don't know if you can give it a file
Starting point is 00:16:05 But there was a single file in a directory sure kid probably cool files well Yeah, yeah, just sort of shows you who has been active in this repo or this Sub-directory of a repo lately and how much have they yeah the blame part is one of the reasons why I'm careful if I try to do like a a Just a prettying up of code. You wanna break it? Well, no, I don't wanna be blamed for it. So if you're just like lining up something
Starting point is 00:16:34 to make it look nicer, be careful because you're now the owner of that line of code. Yeah, that's interesting. I wonder if you should almost create like a formatter account and just let the formatter do the formatting. Well, actually, that's one of the lovely things about putting separating formatting stuff. So that's one of the things I try to teach people is to,
Starting point is 00:16:57 cleaning up is great, but do it in a separate commit. Don't do it in the same commit as a bunch of actual code changes. But it doesn't fix the blame part No, it doesn't really fix the blame part but another thing that the That get town thing does is it'll it uses squashing pretty aggressively
Starting point is 00:17:14 So when you do all your feature branches and you make 20 changes you can squash that into a single commit As part of the publication PR flow and so then at least when people go look at the blame, it's like all part of one commit that has to do with this feature rather than rough formatting. Adjusted space, you know, like randomly. Like if you get it too small, your comments are like really, really not historically relevant, you know.
Starting point is 00:17:38 Like this is the formatting statement, like great. And why did, when were we doing this? You know what I mean? Yeah, actually I kind of forget that not everybody does that So I always do the squat do a squash workflow. You're a natural squasher. Okay natural squasher. Yeah Well, mostly because it's way easier to roll back stuff So if there's a if something that like really causes a downstream problem, you kind of want to roll back all of that work together Yeah, yeah, that's a good point. What you anyway anyway. So next up is whatcha, whatcha got?
Starting point is 00:18:07 Okay. Watch G-H-A, but there's no capitalization, so whatcha got? Tom, and this comes to us from Ned Matchelder, as in not he sent it to us, but he created it. And this is just another get thing real quick. I think people will find it relevant. So what you can do is you can install this,
Starting point is 00:18:24 and then it will allow you to watch in real time the status of your GitHub actions. So imagine there's a bunch of changes that have come in. You're running talks for different versions of Python on your thing. There's some pending other requests that are queued up and you're waiting for them to run it and you just wanna know like, well, when are these done? How how long are they taking so you can just point this at a github repo that
Starting point is 00:18:48 has a github action this is awesome it's pretty cool right yeah yes i often have like a get tab open to watch this stuff but having it right in the command line nice yeah and it's like a live updating very two-e feel right it's a very you know advanced sort of UI It's not just a stream of text But it's the UI is updating and changing with progress bars for each action and so on yeah cool So yeah, well done on that Ned. That's super cool alright. That's it for my main items over to you Brian Okay, so are we we know for your last one you got one more. one more, don't you? Oh, I got one more, yeah, I do. Thank you, Dave.
Starting point is 00:19:27 Yeah, so next up is, I'd like to talk about UV a little bit. Yes, so this is Dave J. So Dave Johnson article, it's called Share Python Scripts Like a pro UV and PEP 723 for easy deployment. And we've talked about a lot of these pieces in different episodes, but I really like this write up. It's a sort of kind of, if you want to write Python scripts there with dependencies that was an issue before and now it's not but All the different parts of how to do this so starts out with with talking about what UV what UV is and UV and 723 that's and that's the pep that allowed you to put like some stuff at the top of a file to include your dependencies and stuff.
Starting point is 00:20:25 So to set the stage, we don't have to dig into what this is, but he gives a command line script called word lookup that has some things like arg parse that's built in, but it also uses a HTTPX. So that's an extra dependency that's outside of the script. So, and this is if you're doing a web scraping script, you're gonna often have like some extra dependency or something.
Starting point is 00:20:52 And so then that's the script has, teaches you how to install UV, but you probably already have it installed. And then how do I add that thing? You don't have to memorize the format of how to put that up at the top because if you say UV add script and then you give it your script name
Starting point is 00:21:10 and then what your dependency is, it automatically fills that out for you. It's like sticks that script block at the top of your code, which is awesome. And I think I knew that, but forgot about it. So I'm glad it's in there to just add that little script tag. And then talks about why, how this is different and similar to the pyproject.toml
Starting point is 00:21:33 and the relation to that, which I kind of like that extra teaching. It isn't necessary that you know that for scripts, but it's good for people to have that knowledge about the whole ecosystem. Talks about running it with UV run, and then jumps down and saying things like, you can do UV run, but you can also just add that UV run
Starting point is 00:21:54 as a shebang for Linux and Mac users. You can add that to the top, and it gives the specific environment as UV run script that you have to stick at the top of that. That is super interesting, actually. And then you don't have to say Python or UV run script that you have to stick that at the top of that is super interesting actually and then you don't have to say python or uv run you can just say the script name if it's an executable and it'll just work which is awesome um and i didn't get into trying this with windows but uh but apparently you can kind of do some of this around how to get this invocable on Windows as well.
Starting point is 00:22:26 I haven't tried this, but you can use Pi and other things. So there's some help. I think the Pi launcher respects shabings on Windows, which is something it adds. Okay, cool. And then he recommends creating like a work, an extra script with a command line, a CMD script to launch your script with so how to how to do this
Starting point is 00:22:47 How to complete the loop with windows so really great write up for people Writing utility scripts in Python. So that's actually really nice. Yeah, well done. Yeah, so That's all for our main topics We have we both have extras Do you want to jump into your extras first or do you want me to do ours? I'll do mine real quick, sure. I got a few, I'm gonna try to go quick through them.
Starting point is 00:23:12 One, I talked about PySQL scribe, which if you're writing raw SQL for your code, but you wanna have some kind of tooling support to help you in Python, this PySQL scribe lets you express through code the structure of your tables and their relationships and then you can ask it like, hey, what would the query of this be? And then it will generate it based on like what database scheme or dialects like SQLite versus Microsoft SQL Server query syntax you wanted to generate and so on.
Starting point is 00:23:42 And I proposed when we talked about it that, hey, would it be cool if there was an ability to just point it at a bunch of create scripts that defines your 100 tables and it just knows that? Well, Daniel who runs the project said that is a good idea and just released a version that you can just point it at a directory of create scripts and it'll use them to understand your entire data structure. Good job Daniel. So a little bonus there. We talked about, this is a long-running one, we talked about formatting Markdown with MD format, which I've started to adopt, I will talk about that next, but Hugo points out, like, hey, I use Prettier,
Starting point is 00:24:18 which has been around for a long time, it now has a Markdown format, so that's really cool, from 2017, people can check that out, and I'll link to that in the show notes if you want to use that I however am continuing on with MD format and I Ran it against the entire markdown structure of my upcoming talk python in production book And it's like I said all markdown and one of the things I discovered I don't know if you knew it Brian, but I I definitely did not. This is a really interesting linting philosophy. Would you run it against Markdown?
Starting point is 00:24:48 It will render the Markdown to HTML, then pretty it, then clean it up, and then it'll run it through the Markdown parser again. And if the HTML differs, it will roll back that change. Oh, that's cool. Yeah, so one of my chapters, I put a whole bunch of plugins and goes one of the plugins is like not great because it changed the format and I'm like oh
Starting point is 00:25:09 which one is it but I like them all. I don't know maybe I need to debug it right now I'm just not formatting one chapter. You know what chapter is? 13 obviously. Obviously it's 13. Anyway what I found the the command that I think is really really good is to use, I wrote it down, it's in the show notes, but I must find it. It is to say, mdformat dash dash number, so it renumbers those things, which is great. And then this one, I thought I would like it to wrap it, but all of my editors actually preserve the wrapping format, so that it can kind of help you see the structure a little better even though markdown rendered doesn't and So that looked really crappy. So if you say dash dash wrap, no, it'll actually Explicitly unwrap if you've accidentally got some in there
Starting point is 00:25:53 So I like number and wrap no not just not change it but actually unravel the wrapping which I thought was really cool And as part of that we did talk about UV, sorry, we talked about pipx inject. And last time you pointed out correctly that UV tool install dash dash width is the equivalent. But I wanted to point out that when you, and I put it in the show notes, if you wanna use width and UV tool and start like inject, you have to say width as many times as there are extras.
Starting point is 00:26:21 So UV tool install, MD format width, MD format GFM, dash dash width, MD format front matter, dash dash width, and so on. So if you wanna get that inject feel, you've got to like width separately every single parameter, every single extra or whatever. So anyway, that's a thing.
Starting point is 00:26:41 Another one you can see right now that if you're watching the live stream or see the pictures that I'm using the Zen browser, which I really come to love. It's built on top of Firefox, which is great. And I really want this like nice clean format. We just have the tabs as icons on the side and everything's just at the top and gives you more space, right? Well, Firefox, if you are a Firefox purist, has now come up with this tabs on the left side
Starting point is 00:27:07 of things, which is a brand new feature that they just released last week, I think it was. But if you grab that little width of the tab and you slide it over to their icon size, it looks exactly like what I have on the screen right now, right? Where it has just icons on the left for the tabs and a dress bar across the top. The new Firefox is pretty good. There's still stuff missing that Zen brings that's really cool, but anyway, I wanted to point people that that's an option now. Nice. Yeah. Finally, last thing on my end is a follow-up on UV from James Fallon. Falcon, sorry, James Falcon. Makes you sit in this thing and he says,
Starting point is 00:27:41 hey, I'm also a UV enthusiast, and I was holding out to using UV because there's one case it hasn't solved. However, you guys convinced me to work through it and get it figured out. So he maintains a library supported across multiple Python versions and needs to deal with bugs and specific ones. So like, it doesn't work this way in 3.8,
Starting point is 00:27:59 but it works fine in 3.10. So the idea was to have, originally I was using pi, E, and V because you can create virtual environments with those different ones and then activate them by name but the way UV worked originally it didn't. So Woody said hey look I'm creating just a location for virtual environments on my profile, maybe a sub folder for the project, and then I use now use UV to create version specific virtual environments you know 311, 312, 313 and so on for that project. And then I use now, use UV to create version specific virtual environments, you know, 3.11, 3.12, 3.13, and so on for that project.
Starting point is 00:28:29 And then he includes a batch file that you can just say, work on this virtual environment project name, and it'll automatically find it and activate for you, and so on. So, kind of gives us an example of like how you might sort of pie V E and V your way around different versions using UV That's pretty cool. Yeah, so there's a little bash script that people can check out if they want to use it nice Okay in the show. Yep. That's it for my extras. Well, so for my extras Today so it's April right and one of the things we do in April in on April 1st, sometimes there's April Fool's pranks that happen. One of the things, so there's good April Fool's pranks and then there's bad April Fool's pranks. I'm going to cover both.
Starting point is 00:29:16 First off, I think a good one, which was a video put out by, well, it was forwarded by the PSF, but it says Cult Repo, I'm not sure who put it. I looked and I'm like, that is a really weird thing to kind of do an official joke from the PSF. Yeah. That Cult Repo group, they make a bunch of documentaries about, like highly produced documentaries about programming languages and their origins
Starting point is 00:29:41 or programming frameworks. Like they have some on Vue.js and they have some on Angular and some on, like that's where it's from. Okay, so the video is breaking Guido van Rossum returns as Python's BDFL. And it's a two minute video or almost two minutes. Hilarious, I loved it.
Starting point is 00:29:58 It shows him like typing of the, saying that the, everybody, what was the standards that the everybody, what is the standards people, oh, the board's no longer. Steering council. Steering council is no longer necessary. Couple things I wanted to point out that I loved about this video.
Starting point is 00:30:17 Brett Cannon, he's in it and he's listed as famous Python quotationist is his title. And then Guido goes ahead and says one of the things that he said, Guido says, as I always say, come for the language, stay for the community. And that's not a Guido quote, that's a Brett quote. So the famous Python quotationist gets crossed out after Guido says that, which is pretty funny.
Starting point is 00:30:49 And then a little later, who was this? Barry Warsaw walks in and says, Guido, are you ready to release Python 2.8? Which never gonna happen, right? So that's pretty good. Guido says, indentation is enlightenment and become he he says or Barry gives him credit for saying that the being pythonic means becoming one with whitespace which is good anyway the and then it kind of
Starting point is 00:31:21 wraps it up with Guido's announcing that he's going to implement a new keyword, maybe. It's kind of like if, but way more Python-ic. So maybe something. And it gives an example of maybe print Python, the documentary, coming this summer. And I kind of hope that one is real. I hope we get a documentary coming, well, it's already the summer, or it's almost the summer.
Starting point is 00:31:47 If we get a documentary. Well, we're gonna get it soon, then that'll be great. And if this Colt Repo company makes it, I think it'll be pretty good, yeah. When I first saw this, I saw a tweet come up, I'm like, hey, whatever, funny little joke. And I just thought it was a tweet. Then Nick will send it over and like, wait,
Starting point is 00:32:03 you should check this out, it's funny. And I'm like, watch, I should check this out, it's funny. And I'm like, watch, I'm like, oh, there's way more here than I realized. This is well done. This is good. Okay, so that's a good way to do a April Fool's prank. I've never done one, I've never done like a tech prank.
Starting point is 00:32:17 So I decided to try my hand at that this year. It did not go that well. So I'm, and you know how you know this the have you ever heard like if you have to explain a joke that it's not funny this is me explaining a joke so it's not funny. So there's PyTestRepeat so I've been doing on testing code I've been doing the series on PyTest plugins and PyTestRepeat is one that I use all the time and I noticed that it hadn't been being tested on,
Starting point is 00:32:46 it only was tested on 312, it's not tested on 313 yet or 314. And okay, so 314 is 3.14. Py starts with 3.14, but Py is an irrational number and it doesn't repeat. So the joke I was trying to make was I put out an episode on test and code on April 1st,
Starting point is 00:33:07 Python 3.4 won't repeat with by test repeat. And I guess it was, and I even like tried to make it, I thought obvious to say, unfortunately, it doesn't seem to work on 3.14, even though there's no rational, like no irrational. Yeah, that was nice. I listened to that and said it was well done. Anyway, I got some feedback of people confused
Starting point is 00:33:32 and wondering why I was testing 3.14 anyway, since it was an alpha. And anyway, I had to explain to five different people that it's actually fine. So the TLDR is, PyTestRepeat works fine with Python 3.1.4. So don't worry about it. Anyway, how not to do an April Fool's Brink. So I guess that's all of our extra items, right? It sure is. We'll see how much I got to explain this joke, huh? No, I think this one is fine. This one is
Starting point is 00:34:04 good. So this comes to us from the programming humor Twitter feed and it says, what's the best thing you found in code? And they are almost always about comments in the thread. So here's a, there's actually Python. So this is a comment that somebody found in the code and they posted it. But if you look through and you look at the comments below there There's a glorious set of a hundred and thirty two comments of similar another not all great
Starting point is 00:34:34 But so here's what it says at the top of this thread It says you as a comment you may think that this function is obsolete and it doesn't seem to do anything and you would be correct But when we remove this function for some reason the whole program crashes and we can't figure out why so here it will stay. So I entitled the joke so here it will stay and let me see if I can find a few. This is my favorite one though this probably should have been the top line one but this came to us as a response from the original. Somebody named Jepe or Yepe pointed out and said, not mine, but I find this kind of funny.
Starting point is 00:35:10 And this is a C-based type of language because it's slash slash for the comment. Dear programmer, when I wrote this code, only God and I knew how it worked. Now only God knows it. Therefore, if you're trying to optimize this routine and it fails, most surely it will, please increase the counter as a warning to the next person and then there's a variable below that says total hours wasted here
Starting point is 00:35:30 254 So good That's good and on and on it goes if you if you don't want the rest of your If you want to lose maybe a half hour and go right down here and there's a bunch of good stuff in there. So, there it is. That's good. Yeah, I think that's a good one. Yeah, I've only have a couple of times,
Starting point is 00:35:55 actually, at least I have at least one memory of some code that didn't look like it did anything, except for obviously it was getting run and the timing, I'm sure it was just timing. Like, if you took it out, it changed the timing of the rest of the program and then it didn't work. So yeah, I've actually run it.
Starting point is 00:36:11 You would uncover some kind of concurrency bug that it was defensive against. Yeah, yeah, yeah. Oh boy. C codes are like that, so. Yeah. It's hard to see the errors, that's true. Hard to see the errors, that's.
Starting point is 00:36:24 That was good, it wasn't now. No, it wasn't. Hard to see the errors, that's me. That was good, it wasn't, no, no it wasn't. We better quit, we better just call it an episode. Okay, alright, thanks a lot. Bye. Bye.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.