Latest / Talk Python To Me / #482: Pre-commit Hooks for Python Devs
Transcript
- 0:00Do you struggle to make sure your code is always correct before checking it in?
- 0:03What about your team member's code? That one person who never wants to run the linter,
- 0:08tired of dealing with tons of conflicts and spurious Git changes? You need Git pre-commit
- 0:13hooks. Well, we're lucky to have Stephanie Molin on the show today, who has done a bunch of writing
- 0:18and teaching of Git hooks. This is Talk Python To Me, episode 482, recorded October 24th, 2024.
- 0:27Are you ready for your host? You're listening to Michael Kennedy on Talk Python To Me.
- 0:32Live from Portland, Oregon, and this segment was made with Python.
- 0:36Welcome to Talk Python To Me, a weekly podcast on Python. This is your host, Michael Kennedy.
- 0:44Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython,
- 0:50both accounts over at fosstodon.org, and keep up with the show and listen to over nine years of
- 0:56episodes at talkpython.fm. If you want to be part of our live episodes, you can find the live streams
- 1:01over on YouTube. Subscribe to our YouTube channel over at talkpython.fm/youtube and get notified
- 1:07about upcoming shows. This episode is brought to you by Sentry. Don't let those errors go unnoticed.
- 1:13Use Sentry like we do here at Talk Python. Sign up at talkpython.fm/sentry. And this episode is
- 1:19brought to you by Bluehost. Do you need a website fast? Get Bluehost. Their AI builds your WordPress site
- 1:25in minutes, and their built-in tools optimize your growth. Don't wait. Visit talkpython.fm
- 1:31slash Bluehost to get started. Hey, everyone. Before we jump into the interview with Stephanie,
- 1:36I want to tell you real quickly that I just released a blog for Talk Python. Now, we have had tons of RSS
- 1:43over there because that's what powers podcasts. You can subscribe to the episodes. You can subscribe to
- 1:49an RSS feed for new course announcements over at Talk Python Training. And I've had a personal blog
- 1:55time over at mkennedy.codes, but no official Talk Python blog. And so I'm going to be posting
- 2:01really cool things on there. I've already got a couple of articles posted, but I have plans for
- 2:06some interesting series. And anytime there's some more interesting announcements or exciting news I
- 2:11want to share with Talk Python, it's going to be over on the Talk Python blog. So if you're interested,
- 2:16I would really, really appreciate it. If you go to talkpython.fm, click on blog, right in the
- 2:21navigation or at the bottom and just subscribe to the RSS feed. That way we can stay in touch.
- 2:26And with that, let's talk pre-commit hooks. Stephanie, welcome to Talk Python. It's awesome
- 2:32to have you. Thanks for having me. Yeah, really looking forward to talking about pre-commit hooks.
- 2:38You know, these are things that I'm sure a lot of people have heard of. I've certainly heard of,
- 2:42but to be honest, it's not much I've done very much with. And I bet a lot of people out there
- 2:47listening are like, yeah, that'd be a good idea. Just like continuous integration and writing tests.
- 2:51Now let's get back to it. You know, something like that. So I think
- 2:54there's a lot for people to take on, take away here. And we'll talk about what are these pre-commit
- 3:00hooks, when to use them, how to build them, and a whole bunch of other things that you're up to.
- 3:05So it should be a lot of fun. I'm looking forward to it. Me too.
- 3:08Yeah. Now, before we get to that, how about your story? How do you get into programming Python and
- 3:14pre-commit hooks and all these things? Hello everyone. I'm Stephanie Molin. I am a software engineer at
- 3:18Bloomberg. And I would say, I guess I got into programming in Python. I initially was programming
- 3:25in R and I was doing more data analysis while still building some things. And I needed to build a web
- 3:33app. And one of my teammates had suggested that rather than battling with Shiny in R, that I just
- 3:38learn Python. So I took a few weeks and just forced myself to do that. And I built something
- 3:43with Flask. And that was how I got into it. Oh, that's really awesome. Yeah. You were doing work in
- 3:50not finance, but in ads or something like that with R. What kind of work was that? Like we just generally
- 3:56add, you don't have to go into details. Yeah. So it was, it was mainly reporting and doing analysis on how
- 4:03client campaigns were going. But what really got me started with programming was more, I had gotten
- 4:08involved with a hackathon team and we had built an alerting system. So just monitoring when something
- 4:13weird went on with the campaigns. And I really enjoyed building more, more so than the analysis.
- 4:19And so I had to find a way to, and I enjoy like a little bit of data and more on the coding side.
- 4:25So I had to find something that would let me combine those two.
- 4:28Yeah. Well, that sounds really fun. I definitely, I'm on the same wavelength as you with data analysis
- 4:33is fun, but the building is, is really where things get interesting and, you know, look back and see
- 4:39like, Oh, we built this thing. That's, that's a pretty awesome feeling.
- 4:42Yeah. It was, it was a ton of fun and we ended up getting, I think third place on the hackathon,
- 4:47but yeah, that was, that was really that moment where it was like, I got to taste of something else.
- 4:52And I was like, this is, this is what I want to be doing.
- 4:55Yeah. Oh, that's fantastic. Was that at your company or was that someone?
- 4:58That was at the previous, previous role. It was the ad tech company. And so that was actually
- 5:04all built in R, the alerting system. And then, Oh no. Yeah. Okay. Yeah. And then, and then as we
- 5:10worked more on it, certain things ended up moving into Python. So a lot easier to work with and to
- 5:16automate things and not have like some laptop running R somewhere.
- 5:19Yeah, exactly. It's, that's sort of the promise of Python over a lot of these things that at first
- 5:28blush seem somewhat equivalent, right? Is that it's, it's a real programming language that can go on to do
- 5:35all the stuff. You don't have to try to automate some weird thing. That's not really meant to be that
- 5:40way. Right.
- 5:40I know. And now, I mean, I could not write R if I, if I had to, I wouldn't, I don't think I would.
- 5:47Yeah. Well, I was going to ask you now, which side of the fence do you spend more time on R or Python?
- 5:53It sounds like.
- 5:54I haven't touched R in maybe six plus years at this point. So I, yeah. Other than the arrows,
- 5:59that's probably the only thing I could manage too.
- 6:01Yeah. No more equal size, just arrows. Okay. Got it. Awesome. Well, that's super fun. Let's talk
- 6:10about pre-commit hooks, right? I've had Anthony Sotili on the show to talk about his pre-commit project.
- 6:16It was a long time ago and I'm sure that project will get a bit of a shout out from your work as
- 6:21well. But, you know, congrats, you put together a really nice series of articles and resources
- 6:28teaching people what commit hooks are, how to debug them, how to build them, how to choose them. So I
- 6:35think, you know, the stuff we're going to talk about, I'll link, of course, in the show notes.
- 6:38It's a really nice resource for folks. So thank you. I appreciate that.
- 6:41Yeah. Yeah. You bet. So let's talk about NumPy doc, doc string validation. This is, this was your entry
- 6:51way into what this whole world of pre-commit hooks is, right?
- 6:54Yeah. So, and I think July, 2022, I was at my first EuroPython and I decided to do the sprints
- 7:02for the first time. I ended up working with the scikit learn team and they wanted to make sure that
- 7:08all of their doc strings were conforming to the NumPy doc standard. They had a file in place or a test
- 7:14file that you could run and just validate that whatever changes you made were now being validated
- 7:19as far as doc strings. And I remember at one point, like I had, I think done 12 or so PRs in that sprint.
- 7:27So I was very productive. And there was one early on, I think in the second or so, where it just wasn't
- 7:32working and I couldn't figure out why it was telling me it wasn't valid. It was saying that it wasn't
- 7:37ending in a period. And I had called over the, one of the maintainers and we both stared at it. To us,
- 7:43it looked like a period. And I ended up just deleting the doc string and starting over. And it turned out
- 7:48that it was a trailing space at the end. And so I had asked the maintainer, like, how do you not have
- 7:54this happen to you? And the response was, you should install pre-commit. And by then I had, I was already,
- 7:59I had to leave. So I was like, make, I made a note to myself. I need to research this when I get home.
- 8:04And when I did, I was like, well, how did I not know about this before? And I set it up on things.
- 8:09And then I went to look, does NumPy doc have that? This seems like exactly what you would want.
- 8:15As you're writing code, you want to make sure that it's going to check the doc string there. You don't
- 8:19want to have to run some other thing later on and remember to run it. So I looked and there was no
- 8:24pre-commit hook for NumPy doc. And I had made something, something that initially we had just
- 8:29used internally within my team. And then later on, I kind of wanted to use it for a personal project.
- 8:35And so I set about seeing how we could actually open source it. And I had contacted the NumPy doc team
- 8:42and they were very, very interested in it because there was a reason there was no hook. It's because
- 8:46no one knew how to do it. Right. And at that point I had the horrible realization that what I had written
- 8:52would never work outside because it was relying on things being installed. So, and then I felt pretty
- 8:58bad about promising that to them. So I managed to come up with an entirely new solution in a weekend
- 9:03and figured out how to use the abstract syntax tree to work through. And so I built an entirely
- 9:10new version of it. And that is what is currently available in NumPy doc. And that actually led to
- 9:15them inviting me to be a core developer for NumPy doc. Congratulations. How cool is that?
- 9:22Yeah, I know. It's like the full spectrum, right? And just having heard about it and then just
- 9:27seeing the connection between two things that weren't previously connected.
- 9:31Yeah. Yeah. Well, I think your comment about the pre-commit hook not previously existing,
- 9:37you know, for this project also is, it's pretty interesting, right? It's kind of like I hinted at,
- 9:41I mean, a lot of people hear about this kind of stuff, but that doesn't mean they're putting it
- 9:45into practice, right?
- 9:45Yeah, for sure.
- 9:47And so how do we, you know, let's, let's find our way over to pre-commit hooks in general. So how do we
- 9:53encourage people or ensure that people follow coding rules, right? We've got tools like black,
- 9:59we've got tools like rough. Now those will work awesome. If you give them a consistent config file
- 10:06or config settings, not so much with black, but rough. Anyway, they'll make those changes and do a lot of the
- 10:13kind of stuff that we're talking about here, but that requires, like you said, people to have it
- 10:16installed, people to run it and people to buy into the whole concept of the project in the first place,
- 10:23right?
- 10:23Yeah, that last bit.
- 10:24We're all using these tools and we're all going to run them and we're going to remember to run them
- 10:28until one person goes, I don't like these tools. I'm not doing it. And then their settings fight with
- 10:33your settings or their spacing fights with your spacing or whatever, right?
- 10:36Yeah. I think what has, what really helped in my experience, when you incorporate these things,
- 10:41even like going and approaching open source projects that didn't have a pre-commit set up and just asking
- 10:46if they were interested in it, it's, you really see the value when you've, you think if you've ever
- 10:51reviewed something or gotten review comments about, you should start a new line here. I don't like this
- 10:56space here. And then you think about how much time you waste at that stage. And then you still have
- 11:01zero consistency because you did it one way, someone else does it another way. And even further than that,
- 11:08it's just the time you waste in your code. Oh, I should put this on a new line and reformatting files
- 11:13when you could actually be writing things and thinking about how should I design this algorithm,
- 11:18them. Right. And so I think a big part of making sure that once you find these tools that you're
- 11:23going to use and actually make sure they're using, it's making it easy to use. Like you said, yeah,
- 11:28you can just run black or rough, but you have to remember to run black or rough. And that is the
- 11:32key problem. And what's so great about pre-commit or even extensions in your IDE is that these things
- 11:38become automatic and that's what you need to get towards for these things to actually stick.
- 11:43Yeah. To make them automatic and not part of it. And to some degree, continuous integration can do
- 11:49those kinds of things. But a lot of times it's too late at that point. It's already checked in,
- 11:54it's already committed. And then you've got the back and forth of now it's a diff, but it's only a diff
- 11:59because they spaced it differently when they hit save in their IDE than when you hit save in yours and
- 12:04all that. So pre-commit hooks run prior to actually leaving your computer, right?
- 12:11Yeah. So it's actually prior to even the commit. So when you do git commit and you, let's say you pass
- 12:16your message and if it's successful, you normally, you see the hash that gets generated. If you have
- 12:21pre-commit hooks enabled, then if that, those checks don't pass, then that commit never gets created in
- 12:28the first place. So you still have the files staged, but nothing has made it to the commit.
- 12:33Yeah. That's great.
- 12:34Yeah. I was just going to explain maybe a little bit about how they work if you're curious.
- 12:38Yeah. Yeah. Well, let's start with just like, what even are, are these pre-commit hooks?
- 12:42Yeah. So pre-commit hooks, and I think the naming is, is quite overloaded and that leads to a lot of confusion.
- 12:49So at the lowest level, a Git repository in general supports a hooks system. So there's a variety of
- 12:57different types of actions that Git will trigger a script on your behalf. And one of those such actions
- 13:03is pre-commit. So as I described before, as you run Git commit, this gets triggered. Another thing
- 13:08might be pushing. You can have Git wired to run some script when you push. Now that is Git's version
- 13:15of pre-commit and hook, singular hook, because you can only have a single file run, single executable
- 13:21can run.
- 13:21Right. If you go to your, it's in the Git folder, there's a hooks subfolder and it's got little
- 13:27samples for all the different lifecycle things, right?
- 13:30Yeah. And yeah, they provide some, they have to, like I said, they had to be executable, but you can
- 13:35be in any language that you have available on the machine. And so Git provides some examples. I do think
- 13:41there are a few stages that don't have examples, but it's basically you take the name of the stage
- 13:46that you're going to use and that's the name of the file. And that has to be an executable and Git
- 13:51will run it at the designated moment.
- 13:53Okay. So it could be a Python executable or it could be a Go executable or whatever, but it's just
- 14:00one, right?
- 14:00It's just one. Yeah. Cause it has to be named. And like in the case of pre-commit, it has to be called
- 14:05pre-commit, nothing else.
- 14:07This portion of Talk Python To Me is brought to you by Sentry. Code breaks. It's a fact of life.
- 14:12With Sentry, you can fix it faster. As I've told you all before, we use Sentry on many of our apps
- 14:18and APIs here at Talk Python. I recently used Sentry to help me track down one of the weirdest bugs I've
- 14:24run into in a long time. Here's what happened. When signing up for our mailing list, it would crash
- 14:30under a non-common execution paths, like situations where someone was already subscribed or entered an
- 14:36invalid email address or something like this. The bizarre part was that our logging of that
- 14:42unusual condition itself was crashing. How is it possible for our log to crash? It's basically a
- 14:49glorified print statement. Well, Sentry to the rescue. I'm looking at the crash report right now,
- 14:54and I see way more information than you'd expect to find in any log statement. And because it's
- 14:59production, debuggers are out of the question. I see the traceback, of course, but also the browser version,
- 15:06client OS, server OS, server OS version, whether it's production or Q&A, the email and name of the person
- 15:13signing up. That's the person who actually experienced the crash. Dictionaries of data on the call stack and so much
- 15:18more. What was the problem? I initialized the logger with the string info for the level rather than the
- 15:25enumeration.info, which was an integer-based enum. So the login statement would crash, saying that I could not use
- 15:33less than or equal to between strings and ints. Crazy town. But with Sentry, I captured it,
- 15:40fixed it, and I even helped the user who experienced that crash. Don't fly blind. Fix code faster with
- 15:46Sentry. Create your Sentry account now at talkpython.fm/sentry. And if you sign up with the code
- 15:52TALKPYTHON, all capital, no spaces, it's good for two free months of Sentry's business plan, which will give you up to
- 16:0020 times as many monthly events as well as other features.
- 16:04So if you want to run more, you basically have to, potentially, write a program which then itself
- 16:10figures out all the things to do and then delegates to running them. Like if you want to run ruff with
- 16:16a fixed formatting issues and you want to run the checker fixer for NumPy doc strings and all those
- 16:23things, you'd have to write a sort of orchestrating program for that, right?
- 16:27Yeah, it's almost like you're writing in the case of like a bash script, like a giant bash script where you have
- 16:32to decide, you know, do you fail early? How do you like and check, do I run this one and then this one? And then
- 16:38even worse, you're actually, in that case, you're probably running everything, you know, you're running everything
- 16:43sequentially. And if you don't do it carefully, then you know, maybe, maybe you want to fail early, maybe you don't.
- 16:49So that becomes very, very challenging to configure and also to share because the thing about that file is that is not
- 16:55included in version control. So that would be something that you would maybe have to store somewhere else and then do a
- 17:01symbolic link. And then that becomes already a lot trickier for everyone to manage.
- 17:05Yeah, I was just doing that last night and that's an AI question. I don't remember how to do that.
- 17:09I know you can do it. It's not that hard. It involves LN, but you know, ChatGPT, what do I do exactly?
- 17:16LN-S. I've had to do that quite a bit.
- 17:19It's burned into the brain, huh?
- 17:22So one of the things that you recommend so we don't have to build this orchestration piece is actually pre-commit,
- 17:31which is a Python project, right?
- 17:32Yes. And it's not the only one. So again, that's where like the naming becomes challenging.
- 17:37But pre-commit is built in Python, but it can run hooks in a variety of languages.
- 17:42And it interfaces with GitHub's system for you. So it creates that executable and plants it there.
- 17:48But that executable is then pointing back to pre-commit so that you can just define a simple YAML file like you can see part of it on the screen right now.
- 17:56And it becomes very easy because essentially you're just configuring what you want to run.
- 18:01You're not actually coding the logic of the checks and how they relate to each other.
- 18:05Right. So let's assume that all the pre-commit hooks that you want to run somehow exist out there in the world, right?
- 18:12You don't have to create them for the moment.
- 18:14So what you can do with pre-commit is you can set up a YAML file.
- 18:20I always get those crisscrossed.
- 18:22A YAML file, a pre-commit config YAML file, which then has a bunch of listings of here's a Git repository.
- 18:30And if you install it as a Python package, here's a bunch of things that you can run on it, like check toml, check YAML and so on, right?
- 18:38Well, it doesn't actually have to be a Python package, right?
- 18:40So in that repo, and we're maybe jumping ahead, but there's a special file in that repo, which will tell pre-commit how it actually needs to install it.
- 18:48So it could be anything.
- 18:49Oh, that's interesting.
- 18:50So the thing that integrates with the pre-commit project, it has to opt in in a sense in that it has to have a configuration file or a launch file or a setup file, something like that.
- 19:01Yeah. So right now we're looking at pre-commit config.
- 19:04There's pre-commit hooks, and that one is kind of registering it with pre-commit system.
- 19:09So it tells pre-commit how to install it once it gets a hold of it.
- 19:13And it also lists out these hooks that we see here under ID, but that will be defined over there so that pre-commit knows, well, what is check toml?
- 19:21What is check YAML?
- 19:22Okay. Yeah.
- 19:24That's really cool.
- 19:25And you can have more than one of these repositories in there, right?
- 19:30Correct.
- 19:31Yeah. So the repos section is a list of repo sections, and then each repo then has other config, like the individual hooks that you want to run from that repo.
- 19:42Right, right.
- 19:43So for the first example that you have in this, and this is your article, I guess, I don't know if I give this the proper announcement, but how to set up pre-commit hooks.
- 19:53This is your, I perceive this as kind of your getting started article for this whole series.
- 19:57I don't know if you see it that way.
- 19:58Yeah.
- 19:59Yeah, this was the first one.
- 20:01I had gotten a lot of questions on how to do this.
- 20:04And I think it's always interesting, especially when you think about, you know, speaking at conferences, I feel like, and which I do a lot of, and I feel like a lot of what gets more hits in that sense is like the advanced stuff, maybe more creating it.
- 20:15But there's so much value in people just getting started and figuring out how do I even use this in the first place?
- 20:20Because this saves you so much time.
- 20:23So I really, this was where I got started for that reason.
- 20:25I think a lot of people were able to benefit from this article.
- 20:28Yeah, it seems like it.
- 20:30I know it's fun to talk about the super advanced deep dive things, but most people, they just need to get started.
- 20:36They just need some foundation, right?
- 20:37And I think, I think that's actually where most of the benefit comes from, even though it is really fun to see some cool deep dive talk that people are going into, right?
- 20:47So this next one is pretty interesting that we're adding here in this example, and that's the rough pre-commit from straight from Astral, right?
- 20:57So this is just github.com/astral.sh, which is the company behind rough newbie.
- 21:02And this is the rough pre-commit.
- 21:04But what's interesting about this is, well, one, that it has nothing to do with the pre-commit project.
- 21:09But two, that this one also takes special arguments that you can pass to it.
- 21:14Yeah, so I think the rough pre-commit one is just a smaller version so that it works faster with pre-commit.
- 21:20Because pre-commit will have to install these at some point.
- 21:23It will have a cache.
- 21:25So if you don't change the version in this case, it will be able to reuse that.
- 21:28But that first time, you do have a bit of a delay.
- 21:31And that's not something you want.
- 21:33It's something you have to be very careful of when you want to be using these.
- 21:36And then the args thing is nice because you have a few options when you configure these tools, depending on what the tool supports.
- 21:43In this case, rough supports, as I think we mentioned a little bit earlier, configuration file.
- 21:47So, for example, you could have stuff in your pyproject.toml.
- 21:50But the key here is that maybe you're using rough in your IDE.
- 21:55And maybe you don't want to do the same kind of changes that you want to do in pre-commit.
- 22:00Maybe you wanted to ask you if it's going to change something.
- 22:03Whereas in the pre-commit stage, you definitely want it to be fixed.
- 22:06So you can use the args here to provide stuff that you only want to happen when it's running in the context of pre-commit.
- 22:14Yeah, and rough has a exit non-zero on fix, which means if it goes through and you say to fix it, it will fix it.
- 22:21But then it'll error out and say that wasn't a smooth transition or whatever, which is cool because that will then fail the commit itself.
- 22:30Correct.
- 22:30Give you the modified files and say basically have a look.
- 22:34See if you like it now, right?
- 22:36Before it actually just ships it off.
- 22:37That's so important because sometimes you realize there was some rule that you hadn't reviewed before.
- 22:43That's not quite doing what I want and let me tweak my setup.
- 22:45So it's nice to have that bit where you can verify what was actually changed is what you want.
- 22:50Yeah, I guess it's a little bit dangerous to just say change it and then commit it.
- 22:54I've had people.
- 22:55So I did a workshop on pre-commit both on setting it up and then making your own hooks at EuroPython this year.
- 23:03And I did have a few people actually.
- 23:05One very insistent asking me why wasn't there a hook or why don't they support just fixing it
- 23:12and then automatically adding it and committing it on your behalf.
- 23:14And to me, as a person who works in security, that just sounds very scary.
- 23:18I don't want things doing that.
- 23:20I want to see what is being changed and whether or not I agree with it or not.
- 23:23Yeah.
- 23:24Why doesn't it just go ahead and push it as well?
- 23:28Come on.
- 23:28Yeah.
- 23:28Well, I think that was part of the suggestion.
- 23:30I was like, I certainly don't want that running on my machine.
- 23:34Yeah, it does skip out on some of the benefits of the multi-stage aspects of Git, I suppose.
- 23:39But it is efficient.
- 23:40You just get it done all at once.
- 23:41That's pretty cool.
- 23:42Yeah, but you don't know what else is grabbing, which is the scary part.
- 23:44No, of course not.
- 23:45I know.
- 23:45Super bad.
- 23:47So this example that we're talking about here where we've got a pre-commit hook that we're grabbing
- 23:53and then it takes these arguments, I think this is an interesting point of discussion.
- 23:57So the example you have in your article just says, what we're going to tell rough is dash,
- 24:01dash, fix, dash, dash, exit non-zero fix, and show fixes, which is all good.
- 24:07But rough can be pretty complex in its configuration, right?
- 24:11You can say, disable flight gate, turn this one on.
- 24:14These are warnings.
- 24:15These are errors.
- 24:16And there's a whole, you know, here's how many line columns I want and all of this stuff, right?
- 24:21So you can either do this argument thing, or if it's supported, you could also potentially have,
- 24:27say, a ruff.toml, right?
- 24:28Yeah.
- 24:29So I tend to want to minimize the amount of configuration files I have.
- 24:34So in my case, I think below I talk about having it in the pyproject.toml.
- 24:38Yeah, exactly.
- 24:38So you just add a rough section in there and then you configure things.
- 24:42And this is stuff that you'd want to use both in your editor as well as in the pre-commit stage,
- 24:46because you want them to agree.
- 24:47And nothing worse than one telling you the lines too long and the other one like,
- 24:51nope, that's good.
- 24:51Go ahead.
- 24:52Or put a space after the comma in parameters and then take away the space and put the space and take away the space.
- 24:59Exactly.
- 24:59You don't want them fighting.
- 25:00You want them in agreement.
- 25:01No, no, you don't.
- 25:02So I suppose that's a massive bonus of having either the tool.rough settings in your pyproject or just a ruff.toml,
- 25:09however you go about that, it doesn't really matter.
- 25:11Because then no matter how you're using rough via the pre-commit or for your project, it'll be the same thing, right?
- 25:17Exactly.
- 25:17Yeah.
- 25:18Okay.
- 25:18Yeah.
- 25:19That's pretty awesome.
- 25:20Now, I guess maybe we got a bit ahead of ourselves.
- 25:24If I want to somehow install a pre-commit hook or pre-commit so that when I then give it one of these toml files,
- 25:32it'll go subsequently grab them and do the things.
- 25:34How do you get started with that?
- 25:36I think I need a rephrasing of that question.
- 25:39Yeah.
- 25:40Sorry.
- 25:40So if I have just a plain GitHub repository and I want to have pre-commit manage the hooks for that repository,
- 25:49like what do I do?
- 25:50Okay.
- 25:51So the first thing is you have to actually install pre-commit.
- 25:54And that's not the command that's on the screen.
- 25:56This is more of a pip install.
- 25:58So make sure you have the Python library in place.
- 26:02And then you need to have this configuration file.
- 26:05At least one hook in there so that you have a valid file.
- 26:09And then you can run pre-commit install.
- 26:12And I omitted it here, but what I talk about in a different article,
- 26:15when you run this command, pre-commit actually tells you that it created the git hooks pre-commit file.
- 26:21And if you open that up, and I have an example on that other article,
- 26:25it's very simple and it's just calling pre-commit the tool itself.
- 26:28So in all cases, you need to have it installed in your environment.
- 26:33And a single time you run pre-commit install, which then does the wiring on the git side.
- 26:39And this is something that everyone in your project has to run on any machine that they are using.
- 26:45Because it's part of the repository itself, that file needs to exist there.
- 26:50And that can only happen if you run this command.
- 26:52Yeah.
- 26:53So there's a .pre-commit.config.yaml file.
- 26:56That's what you put into GitHub at the root of your project or something like this.
- 27:01But then to actually configure git itself, you've got to run this pre-commit space install.
- 27:07And it basically wires up the hooks to make that happen, right?
- 27:11Correct.
- 27:11So yeah, when you run this, that file gets created on your behalf.
- 27:14And then you don't have to worry about wiring that up.
- 27:17And then it's transparent.
- 27:18All you have to do is tweak your config and then the changes happen.
- 27:22Nice.
- 27:23I don't know if the naming, how much to believe the naming.
- 27:26Can it do things other than pre-commit?
- 27:28Yes.
- 27:28Can it do pre-push and those kinds of things?
- 27:32They don't support every single one.
- 27:35But there are quite a few that they do support.
- 27:38For example, I once configured an open source project with a pre-push because it was a slower
- 27:44check.
- 27:45And that's something you definitely don't want running on each commit.
- 27:48But it might be something where you want to make sure when you push the files that you've
- 27:51addressed something that's maybe a little bit longer.
- 27:54And that is really not any different than configuring with the pre-commit config YAML.
- 28:00There's just a separate item that goes in there that says which stage to run.
- 28:03By default, it's pre-commit.
- 28:04So you don't see it.
- 28:06But if you needed to change it, you can.
- 28:07Yeah.
- 28:07I figured that was the case.
- 28:08But I'd never tried.
- 28:09And given that it's named pre-commit, you know, it's kind of named after one of the hooks,
- 28:13right?
- 28:14But of course.
- 28:15I think that's named probably the most useful one.
- 28:17I would.
- 28:18Yeah, I would think so.
- 28:19I think a very popular example would perhaps be the commit message hook.
- 28:25So there's a lot of tools that work on, you know, making sure your commits are following
- 28:30a certain standard.
- 28:30I think one of them is called committizen.
- 28:32And so that runs on, my guess is on the commit message hook.
- 28:36Committizen?
- 28:37Yes.
- 28:38Okay.
- 28:38What is this committizen about?
- 28:39I haven't heard of this.
- 28:40I don't think their example uses that.
- 28:42But I think they do have a pre-commit hook.
- 28:45And I believe it works that way.
- 28:46Yeah.
- 28:47Yeah.
- 28:47Interesting.
- 28:48Okay.
- 28:48What's this thing?
- 28:49A release management tool for teams.
- 28:51Yeah, sure.
- 28:52That makes sense that you want to kind of be a little bit careful about what your commit
- 28:56messages are.
- 28:57Maybe you want to grab certain commit messages and add them to your changelog or something
- 29:01like that, right?
- 29:01Yeah.
- 29:02I think there's been quite a bit of talk about this one at conferences I've been lately.
- 29:07I think it's gotten a lot of traction.
- 29:09Yeah.
- 29:092.5,000 GitHub stars.
- 29:11That's pretty good.
- 29:12I'll check it out.
- 29:13This is news to me.
- 29:14This portion of Talk Python To Me is brought to you by Bluehost.
- 29:18Got ideas, but no idea how to build a website?
- 29:22Get Bluehost.
- 29:23With their AI design tool, you can quickly generate a high-quality, fast-loading WordPress
- 29:28site instantly.
- 29:29Once you've nailed the look, just hit enter and your site goes live.
- 29:33It's really that simple.
- 29:34And it doesn't matter whether you're a hobbyist, entrepreneur, or just starting your side hustle.
- 29:39Bluehost has you covered with built-in marketing and e-commerce tools to help you grow and scale
- 29:44your website for the long haul.
- 29:46Since you're listening to my show, you probably know Python, but sometimes it's better to focus
- 29:50on what you're creating rather than a custom-built website and add another month until you launch
- 29:55your idea.
- 29:56When you upgrade to Bluehost cloud, you get 100% of time and 24-7 support to ensure your
- 30:02site stays online through heavy traffic.
- 30:04Bluehost really makes building your dream website easier than ever.
- 30:08So what's stopping you?
- 30:09You've already got the vision.
- 30:10Make it real.
- 30:11Visit talkpython.fm/bluehost right now and get started today.
- 30:16And thank you to Bluehost for supporting the show.
- 30:19All right.
- 30:21What other takeaways should we talk about in this first one?
- 30:23I think we maybe have pretty much covered it.
- 30:26Let's see.
- 30:26I guess, you know, we mentioned before, but if people want to see sort of examples of pre-commit
- 30:32hooks failing or succeeding or failing because they changed something, which is not exactly
- 30:37a failure, but stopping and starting over, you have a nice example of what that's like
- 30:42there.
- 30:42So one thing that I guess might be useful is sometimes maybe you don't want to run the
- 30:49pre-commit hooks.
- 30:50Maybe you need to check in something in a certain way to fix the servers down, right?
- 30:57We have to check this in.
- 30:58I can't fix this hook, whatever this hook is upset about right now.
- 31:01It needs to go in right away.
- 31:03Just let me commit it, right?
- 31:05You can do that.
- 31:05I mean, I think there are probably several use cases or something like this.
- 31:10Maybe you're going to be squashing things later and it doesn't, and it's, you don't,
- 31:13maybe you don't even know what the API for you're doing, what you're doing is going to
- 31:17look like.
- 31:17It could be, and this kind of ties back to what we talked about earlier, perhaps roughs
- 31:22doing something and you don't agree with, but you need to like check with the rest of
- 31:25your team to make sure that everyone's in agreement with let's remove this rule.
- 31:29Right.
- 31:29So it's, I, this definitely don't encourage always doing this.
- 31:34That defeats the purpose, right?
- 31:35But there is kind of a break glass solution here where you, let's say you first run, get
- 31:40commit and something fails and it's not something that you either want to fix at the moment or
- 31:45really can fix.
- 31:45Then you can just pass it, pass in dash, dash, no verify.
- 31:48And none of the checks run at that point.
- 31:51So it's like, as if the checks were never there in the first place.
- 31:54Right.
- 31:55Right.
- 31:55Right.
- 31:55Okay.
- 31:55That's pretty interesting.
- 31:56Like you say, hopefully people don't run that all the time.
- 32:00At that point, just remove the pre-commit setup, save yourself.
- 32:03Yeah.
- 32:03Like what are you, what are you even doing?
- 32:05Right.
- 32:05I suppose there's an interesting interplay between pre-commit hooks and continuous integration,
- 32:11right?
- 32:12Like in a sense, they are often checking some of the same things.
- 32:16What do you think?
- 32:17So I think it's probably an example, like not, not quite a Venn diagram.
- 32:22I probably, the circle for pre-commit is entirely contained within the circle for the CI/CD.
- 32:29The difference is there are certain things where you can get immediate feedback, quick
- 32:33feedback locally, and that should be something that you can put pre-commit things like linting,
- 32:37formatting, et cetera.
- 32:38And then CI/CD may be running your test suite.
- 32:42That's definitely not something you want to be doing in a commit.
- 32:44Imagine you have a test suite that takes three minutes to run, even maybe three minutes isn't
- 32:48that bad, but every commit waiting three minutes is definitely not something you want to do.
- 32:52No.
- 32:53But it's still a check that you should definitely be running.
- 32:55So in CI/CD, I would run everything.
- 32:57Do the linting, do the formatting.
- 32:58That's your final, that's your last layer of defense and you need to be checking everything.
- 33:03And this just allows developers to get that feedback sooner.
- 33:06Right.
- 33:07So what you're actually checking in and you finally approve is much closer to what CI/CD
- 33:12would kind of want in the first place, right?
- 33:14Yeah.
- 33:14Yeah.
- 33:14Okay.
- 33:15And it's also a much faster feedback, right?
- 33:17So like if the thing has to run all the way through the linting, the formatting, the testing,
- 33:20the type checking, whatever, you might be waiting 10, 15 minutes for all the things to run when
- 33:25you could have had, you know, under a minute, hopefully way under a minute feedback instantly that
- 33:30your file wasn't formatted correctly.
- 33:31It should be near instantaneous, right?
- 33:34I mean, instant maybe is asking too much, but some of that astral stuff is kind of ridiculous.
- 33:40Yeah.
- 33:41I think you have to be very careful, right?
- 33:43Because there's all these checks and I think you had up on the screen maybe earlier, like
- 33:47the pre-commit hooks, the general ones provided by the pre-commit organization.
- 33:53Yeah.
- 33:53There's tons of things in there, but you do have to be careful, right?
- 33:56Because if you're like, oh, this could be good and this could be good and this could
- 33:59be good.
- 33:59Each check is adding time.
- 34:02Assuming, like I say, assuming they're all running on Python files, you're adding time
- 34:05to how long.
- 34:06So you do have to be mindful of what you actually need.
- 34:09And if you go to the point where you end up making the whole process take too long, people
- 34:15are going to stop using it.
- 34:16And then that defeats the...
- 34:17Yeah.
- 34:17Yeah, exactly.
- 34:18As soon as it becomes a point where people go, I'm not using this thing, then you're kind
- 34:22of kind of sort of lost unless you can just say, no, you have to use it.
- 34:25But then you just have unhappy teammates.
- 34:27Exactly.
- 34:28Either way, it's not a real great outcome, is it?
- 34:29I mean, if there's something that maybe only runs on a few files every once in a while, then
- 34:35if you are having problems with speed, then you can also consider moving that to the CI/CD.
- 34:39And I am definitely a big fan of rough, as you said, like just switching from black, flaky,
- 34:45all that onto rough, you do save a significant amount of time on these checks and it's a huge
- 34:50benefit.
- 34:50Yeah, it's pretty ridiculous.
- 34:51Now, this is not a get pre-commit thing.
- 34:54This is a pre-commit the project thing.
- 34:57But you can, if you're using this pre-commit project we've been talking about, you can say
- 35:01pre-commit space run and do kind of a test without actually doing a commit, right?
- 35:07Correct.
- 35:07Yeah.
- 35:07So there's a bit of nuances.
- 35:09So if you just do pre-commit run, it's going to run all of your hooks, but on the staged
- 35:14changes, because it's thinking essentially you're doing like a dry run.
- 35:17If you, let's say, are adding a new hook and you want to make sure all of your files are
- 35:22compatible with that new hook, then you might want to do something like pre-commit run dash
- 35:26dash all files.
- 35:27So look through your entire repository, regardless of whether you have changes in place.
- 35:31So if you say pre-commit run, it only works on your, basically your changed files, not the
- 35:37stuff that's already there and accepted.
- 35:38Correct.
- 35:39And another neat thing is in the case I mentioned where you add a new hook, you might just want
- 35:44to run that hook.
- 35:44So you can say pre-commit run and then the hook ID, and then you would just run that hook
- 35:49and then you can define either a certain set of files or the staged runs, whatever.
- 35:52Yeah.
- 35:53That sounds pretty useful when you're building your own pre-commit hook, right?
- 35:56So yeah, depending on how you build it, you can either use that or they have also a try
- 36:01repo command.
- 36:03Right.
- 36:03Got it.
- 36:04Got it.
- 36:04Well, let's see.
- 36:06Maybe we could jump over and talk a bit through your hook creation guide, a step-by-step guide
- 36:12to developing your own pre-commit hook.
- 36:14I thought this was really, like I said, a good article.
- 36:17And maybe one of the first things we talk about is just what makes a good hook in the first
- 36:23place, right?
- 36:24You said that they can't be too long or people will go crazy and turn them off or skip them
- 36:29or whatever.
- 36:30But what else?
- 36:31So I think another big thing is if you're able to fix something, then you should fix it.
- 36:36In the case of formatting and you're saying, oh, this should have a trailing comma, then
- 36:41that's easy enough.
- 36:42You can add the trailing comma.
- 36:43You don't make more work for the user.
- 36:44If you can't do that, then you should be very specific saying this file.
- 36:48And if you have a line number saying exactly where it is, because just saying there's something
- 36:53wrong in this file and someone has to hunt it is also not a good user experience.
- 36:57No, that's going to be frustrating and super, super quick.
- 37:00Yeah.
- 37:01So be really descriptive about it.
- 37:03And then also, maybe choose not to make it a pre-commit hook, right?
- 37:06Not necessarily everything needs to run on every commit.
- 37:09Yeah, I think that the speed thing is a huge factor.
- 37:12And in general, I think one big thing that is key to note here is that it's even,
- 37:18though, let's say you change files that, let's say you change a Python file, a Markdown file
- 37:23and an image file.
- 37:24If you're making a hook that only runs on a certain type of file, if you're careful and
- 37:30specify that, then it's not necessarily a bad thing to include that in there because it will
- 37:34only get triggered on those certain types of files.
- 37:36And so like an example I have is the XF stripper.
- 37:40Well, I created when I was building my website.
- 37:44Your XF stripper is super interesting.
- 37:47I'm starting to think maybe I want this as well.
- 37:48Yeah, I was just very paranoid at one point about just working with images.
- 37:53And so they come with, what's up here?
- 37:57So exchangeable image file format data or XF as it's commonly called.
- 38:02It's metadata that is in the image that you might not realize is there.
- 38:06And so in this article, I talk about a picture of me presenting that I was given from a conference.
- 38:12And this was something that was stored, I think, in a Google Drive.
- 38:15So you have access to all the metadata that was available.
- 38:18So I never met the photographer.
- 38:20And yet I know the photographer's name, the camera they use, what type of computer they have,
- 38:24how they edited it, all kinds of information.
- 38:27And the dangerous part is the exact location of where this was.
- 38:31Now, conference, not a big deal.
- 38:33But you have to think about maybe you're blogging about something you did in your house or your apartment.
- 38:38And now you have a photo up on your website where anyone can potentially see it that has the GPS coordinates for where you live.
- 38:47Yeah, that wouldn't be great, no.
- 38:48So I was very paranoid about this.
- 38:50And I don't want the idea of like, oh, I'm going to add a new image.
- 38:54Let me go through my checklist of what I need to do because I know at some point I'm going to mess something up or forget it.
- 39:00And so this is a perfect use case for the pre-commit, right?
- 39:03Because you want something that is going to stop you and tell you, nope, you can't do this, right?
- 39:08And in this case, it can also remove the metadata because I am being super conservative and saying no metadata,
- 39:14which has the nice side benefit of shrinking files, which is good for serving them.
- 39:19Yeah.
- 39:20Well, what value is it to have all that metadata in there for a blog?
- 39:26Most of the time, most people are not, they just want to see, they want to read the blog.
- 39:29They're not going to dissect your image, right?
- 39:31I think it depends what you, I mean, maybe you have a travel blog and you want to know like, here's that location.
- 39:36And then you have one off post where you introduce yourself and oops, you know?
- 39:40Yeah.
- 39:41There's so many ways.
- 39:42And I think even just thinking, oh, I'm only going to be doing this.
- 39:46There's always going to be something that later on happens.
- 39:48So you have to be very careful just upfront that everything is going to go through this track.
- 39:53Sure.
- 39:54Can your exit thing, can it be selective about the metadata?
- 39:58That's something I do want to do in the future.
- 40:00Just remove the location if you say.
- 40:03But the thing is, there's like, looking through all of that, it's hard to tell if there might be something in one subset of images you take that might be sensitive.
- 40:11You can even think of certain situations where you might not want someone to know what kind of device you were using.
- 40:16Right.
- 40:16Because maybe they're like, oh, that device is vulnerable to something and I know they have it.
- 40:20Right.
- 40:21The worst of these is, I think, the multiple times, pretty sure it was the Samsung, but one of the Android companies posted a picture promoting the new phone.
- 40:34And, you know, the exit information had the picture as being from an iPhone or something like that.
- 40:38Oh, no, it was the other way around, I think.
- 40:40Oh, the other way around.
- 40:41I think I remember hearing that, yeah.
- 40:41Well, it was like one phone company was posting it from, but the picture was actually, even though it was about the phone, it was, you know, implying this picture comes from or something.
- 40:49It was like, nope.
- 40:50Whoever is on the marketing team just happens to have the other kind of phone and there it goes.
- 40:54Right.
- 40:54And it's a huge scandal.
- 40:55I mean, for those companies that talk about how awesome they're, how much better their cameras are or whatever.
- 41:00Well, I see that's also the thing, right?
- 41:01Because you never know who's going to look at the metadata either.
- 41:03So, and it's interesting because certain things will, certain platforms will remove it.
- 41:09So I mentioned like Google Drive, it's everything is preserved.
- 41:12But the thing is, is you have to know ahead of time.
- 41:15So you'd have to say, I'm planning to put this image here.
- 41:18Let me upload a dummy image.
- 41:20I don't care and check if the metadata is still there.
- 41:23Yeah, exactly.
- 41:24Yeah.
- 41:25I think, I think Mastodon might remove it.
- 41:27There's some certain platforms that will take away that metadata.
- 41:30I think Facebook might.
- 41:31It's been a long time.
- 41:33I mean, it's a huge security concern.
- 41:35So I imagine more and more places are, but I just wanted to have an abundance of caution and not risk anything happening.
- 41:41Well, yeah.
- 41:42And you're putting it on the internet as well, which there's, it goes straight from your computer through some sort of static website process.
- 41:49And then it's downloaded, right?
- 41:50There's very, there's no, nothing in between those two steps.
- 41:53Exactly.
- 41:53At least not in terms of image processing.
- 41:55Yeah.
- 41:55Yeah.
- 41:56Cool.
- 41:57Yeah, this is nice.
- 41:58I'm thinking about grabbing it and trying out.
- 42:01What file types does it work on?
- 42:03Does it work on just JPEGs or does it do like WebP and all that?
- 42:07Any image, anything that's classified as an image on pre-commit, the way pre-commit runs.
- 42:12And it has to work with, I'm using Pillow.
- 42:15So if Pillow can't read it, then it's not going to work.
- 42:17Right.
- 42:18Then I'll just skip over it or whatever.
- 42:20Yeah.
- 42:21Yeah.
- 42:21So really quick, while we're talking about stuff on your website, your website's super nice.
- 42:26Did you build this yourself?
- 42:28Like, how is this thing built?
- 42:29I did.
- 42:29I did build it to myself.
- 42:32I took a couple months in the beginning of the year and I had before a single page where
- 42:38it was just like some boxes.
- 42:39And then I was like, this needs to be revisited.
- 42:42So it's built with Next.js and so React and TypeScript.
- 42:47And then I use Tailwind CSS.
- 42:50And yeah, it was kind of just like, I mean, a lot of these things are for me because sometimes,
- 42:54you know, I like seeing all in one place where I'm speaking next or like stats about where
- 43:00I've spoken, like a map and stuff.
- 43:02And I went through, so kind of my process would be, you know, on my iPad, I would sketch out
- 43:08what I kind of envisioned a page looking at and then I would prototype it in React and
- 43:13see, okay, maybe this isn't fully work or like tweak things and iterate on a few times
- 43:17and bit by bit the pages formed.
- 43:20The latest thing I added was this timeline functionality.
- 43:24At EuroPython this year, I had this idea for a timeline and I kind of got really, really into
- 43:31it.
- 43:31So it was funny.
- 43:31I had a Python conference.
- 43:32I was doing tons of React.
- 43:34But if you scroll down a tiny bit, there's actually too much.
- 43:38This one, right?
- 43:39Yeah, yeah.
- 43:39Versus the little text.
- 43:41Oh, the complete upcoming.
- 43:42Yeah, I got you.
- 43:43So I built this.
- 43:44Oh, that's beautiful.
- 43:45I love it.
- 43:45It's like a little infographic of your upcoming events.
- 43:48Yeah.
- 43:49So I was like very inspired and I did this in a few days.
- 43:53But it's nice because, you know, going from the sketch to the React components, it's become
- 43:59very natural, which it takes a bit to get there.
- 44:03But it was nice because I did have to learn TypeScript for some changes in my team.
- 44:08We were going to be starting moving to TypeScript.
- 44:10So this was great to work on something that, you know, fit in my head as far as what needed
- 44:15to be done.
- 44:16And it was very, very helpful.
- 44:17But yeah, so I'm very proud of this.
- 44:20There's still more, tons more to do.
- 44:22I have massive lists.
- 44:24But yeah, I remember looking at Google.
- 44:25This is a nice static site.
- 44:26Very cool.
- 44:27And I didn't even see this feature.
- 44:28This is great.
- 44:29Broadvon out in the audience says fire emoji for it.
- 44:31Very good.
- 44:32Thank you.
- 44:33And also, thanks.
- 44:36I see you put the podcast appearance on here as well.
- 44:38That's cool.
- 44:38So that's happening today.
- 44:40Watch the live stream now.
- 44:41If you're not watching now, then it's probably missed it.
- 44:43But the recording will be there, of course.
- 44:45But the reason I say that is you maybe want to give a shout out to some of your upcoming
- 44:49events.
- 44:50Yeah, why not?
- 44:51So I'm going to be in San Francisco next week talking about my Datamorph project.
- 44:57And I'll also be doing a book signing there for my hands-on data analysis with Pandas book,
- 45:02second edition.
- 45:03And then after that, I'm off to France to give a workshop on Pandas and then also talk about
- 45:09getting started in open source contributions.
- 45:12And then a couple of weeks after that, I will be at the final conference of the year in Australia.
- 45:18And I will be talking about Datamorph once again.
- 45:21And I'm hoping to run my third development sprint on Datamorph while I'm there.
- 45:26Oh, that's cool.
- 45:27Yeah, we'll talk about Datamorph in a second.
- 45:28That's some interesting stuff.
- 45:30But this is quite the agenda.
- 45:33You got a full trip coming up.
- 45:34No, I'm excited.
- 45:35It's nice to see different cultures.
- 45:39It definitely does land different, you know, the topics and just reactions.
- 45:43Some people are at the top excited.
- 45:46Some of them are just straight face.
- 45:48You're like, I enjoy it.
- 45:49I think it really comes into play as far as giving workshops.
- 45:54I was in Portugal last week and I did the data analysis workshop.
- 46:00And I think that was one of the best ones I've ever had.
- 46:03It was very, very highly interactive and it was a really fun time for me.
- 46:07And hopefully everyone else thought so as well.
- 46:09Yeah, that's fantastic.
- 46:11How did you get into public speaking?
- 46:12Yeah, so I wrote the hands-on data analysis with pandas book in 2019.
- 46:20And at that time, if you had told me, go do some public speaking, I'm like, please no.
- 46:25You're going to France and Australia and Portugal recently.
- 46:29So I'm like, no, no, no.
- 46:30Yeah.
- 46:30And then, well, during pandemic times, a conference reached out to me about doing a workshop on pandas
- 46:38because I had written the book and doing it virtually.
- 46:41And to me, that felt like a good stepping stone to get over that fear of public speaking and
- 46:47the fact that it would be virtual.
- 46:48I wouldn't really have to look at anyone.
- 46:50And I was still absolutely terrified when it came to actually delivering that talk.
- 46:55And when you think about it, it wasn't a talk, right?
- 46:57So it was my first thing was a four-hour workshop.
- 47:01And now I'm at the point where a virtual thing is much less desirable because it's so hard when
- 47:08you can't see people, you can't see our things landing, are they confused, are they with me?
- 47:12Are they even still there?
- 47:14So, and then after I did, you know, I made it to the end and I was like, okay, that's
- 47:19definitely something I want to work on and do it again.
- 47:22So I did, I came up with a second workshop on data visualization.
- 47:26And then I think I did two or three more virtual sessions.
- 47:31And then it became that some conferences were now in person.
- 47:35And I was like, okay, I think I should try this.
- 47:37And again, it was still a long one.
- 47:40It may have even been a six-hour session that time.
- 47:42So it's like crazy, right?
- 47:43And then I did that in person.
- 47:45And I was like, okay, I survived.
- 47:47And then it kind of just felt like something, if I kept doing it, I would get over it or
- 47:52at least get to the point where, you know, I could do it without being terrified for a
- 47:56month ahead of time.
- 47:57Right.
- 47:57And I am at that point now.
- 47:59It is like, I enjoy doing it because I enjoy, I'm very passionate about knowledge sharing and
- 48:04just teaching people and getting that interaction that, oh, people are really like getting value
- 48:09out of this.
- 48:10And that to me is very nice.
- 48:11Yeah.
- 48:12It's super rewarding.
- 48:13So, but yeah, this is quite impressive.
- 48:15So just, I got the sense you kind of got started pretty soon.
- 48:18You said 2019.
- 48:19So that's, haven't been doing it for that long.
- 48:21And this is great.
- 48:22So maybe, you know, you brought it, maybe we could talk a bit about your book as well.
- 48:27I don't know what to say about this one.
- 48:29Just that it exists and people should check it out.
- 48:33It's giant.
- 48:33It's giant.
- 48:34As you can see, 788 pages.
- 48:36Holy moly.
- 48:37That is giant.
- 48:38Yeah.
- 48:40So this is the second edition.
- 48:42If you scroll down, there's also the covers for the Korean and Chinese editions.
- 48:46Oh, awesome.
- 48:47And I do not read either of those, but I do have copies.
- 48:52You can act of faith to put your name on them.
- 48:53You know what?
- 48:54I've been told by people that read both of those languages that the name is not quite translated
- 48:59correctly, but you know, I'll forget about that.
- 49:02It's cool to have the copies.
- 49:03Yeah.
- 49:04So this book covers obviously pandas working through the basics of data analysis.
- 49:10We also talk about data visualization.
- 49:13And then there is a little bit towards the end about like actually applying this stuff
- 49:19to use cases and also a little bit of machine learning.
- 49:21Cool.
- 49:22Yeah.
- 49:23So I'll put a link in the show notes.
- 49:24People can check it out if they would like to.
- 49:26All right.
- 49:27I feel like there's a few things.
- 49:28We didn't make it very far in our creation guide.
- 49:31So let's talk about the recipe.
- 49:33All right.
- 49:34What are the four steps?
- 49:35At least Stephanie's recipe for pre-commit hook.
- 49:39Yeah.
- 49:39This is definitely my recipe.
- 49:41I mean, I've, I think I've made two that are published ones and then obviously a few other
- 49:46for trainings and explanation purposes.
- 49:48And this, this is something that works well for me.
- 49:50And I think makes sense as far as thinking about the pieces.
- 49:53So the first thing, the hardest thing is actually to figure out what are you checking and how do
- 49:59you actually code that up?
- 50:00And if you want to do this in Python, this is just, okay, code your logic.
- 50:03Yeah.
- 50:04Right.
- 50:04Yeah.
- 50:04Well, and if it has a --fix, maybe that's even harder than just trying to
- 50:09understand, right?
- 50:10Because now you got to not break somebody's code or sorts of things like that.
- 50:13Yeah.
- 50:13But this would be where you start at the basic level, probably first, you know, find,
- 50:18figure out, can you find the issue and show people where it is?
- 50:22And then you can look into fixing it.
- 50:23But yeah, you have to be very careful, especially if you're going to be touching things.
- 50:27So I guess it's pretty straightforward, but the magic of Python is not just the language
- 50:32and the static, the standard library, but the 500,000 external packages, right?
- 50:37There's probably a ton of external packages that understand code, check different things.
- 50:41And you could, you can use those in your hook implementation, right?
- 50:44Just like a standard Python package, it can have dependencies and stuff.
- 50:47Yes.
- 50:48And so I talk about this in the third step, but I do like to make it as a package just
- 50:54because you know that that's going to work and grab the dependencies as long as you follow
- 50:57what you already know.
- 50:59And pre-commit will, you will tell pre-commit in the fourth step in that pre-commit hooks
- 51:04file how it should be installed.
- 51:06So when you say this is, this is Python, then it will know, okay, so I should be using, for
- 51:11example, pip to install this.
- 51:12And if you have, for example, pyproject.tomo and you specify how it should be built, then
- 51:16all of that just happens as it normally would.
- 51:18It's just that pre-commit is doing it instead of you.
- 51:20Yeah.
- 51:20Yeah.
- 51:21That's kind of, instead of you doing a pip install dashy dot or whatever, that it's
- 51:25kind of figuring that out.
- 51:26And I guess we haven't really talked too much about it, but when you pre-commit install, it
- 51:31looks at the, this hooks YAML file and then it, it creates the environment and it downloads
- 51:36all the packages the first time to kind of set it up.
- 51:39Then it just runs over and over after that.
- 51:41Right.
- 51:41Yeah.
- 51:41Unless you change something in your pre-commit config file, then it won't need to rebuild the
- 51:47environment for this.
- 51:48So if you keep the same version, then it's kind of like you said.
- 51:51I installed this version of the package.
- 51:52And as long as you don't say you need to update the package and it's kind of like a virtual
- 51:56environment.
- 51:56Okay.
- 51:57You already have that.
- 51:57There's no need to.
- 51:58Yeah.
- 51:59Yeah.
- 51:59Excellent.
- 51:59So your recipe is one, design the check function to turn it into a CLI, which there's some interesting
- 52:07stuff in that one as well.
- 52:08That's.
- 52:08And I think that's kind of where the --fix comment comes into play.
- 52:13Right.
- 52:13So your logic, that check function, you should be able to say this was successful.
- 52:18This was not successful as in stop the commit.
- 52:21And then the CLI provides a very easy way to plug into that.
- 52:26Maybe you want to say --fix or dash dash, you know, leave this type of file alone,
- 52:31whatever kind of modification you want to do.
- 52:33You can expose that in a CLI.
- 52:36And that's also a quicker way to get started versus trying to, let's say, read the pipe,
- 52:42find the pipe project.tongle, read it in, parse out things.
- 52:46That's all stuff that can come later once you figure out exactly how you want your tool to
- 52:51be configured.
- 52:52Yeah.
- 52:52Especially if it just has one or two arguments, it might not be necessary to be too, too over
- 52:57the top with all the configuration.
- 52:58And then you make it installable.
- 53:00Basically, like you said, make it a package and then create the pre-commit hooks.
- 53:05Yeah.
- 53:05Well, those are the steps.
- 53:06So I think write the function, that's pretty straightforward.
- 53:09You just, whatever you want it to do, you just write a function that does it.
- 53:12You do have an example in here about checking for valid file names and snake cased file names.
- 53:19So things like it can't be just one letter and it has to be snake cased and so on.
- 53:25Right.
- 53:25But then to turn that into a CLI, there's a lot of options in Python these days, right?
- 53:31You can click, you can type, but if you want something built in, yeah, if you want something
- 53:37built in, argparse is pretty straightforward, right?
- 53:39Yeah.
- 53:40And I think also, I mean, if you look at the pre-commit hooks repo provided by pre-commit org,
- 53:45a lot of them, or maybe all of them are just using argpars.
- 53:49Because for most hooks, all you'll need to say is, I have an argument parser and it accepts
- 53:54file names.
- 53:55And at that point you have this boilerplate that you can just copy and you don't even
- 53:58need to worry about configuring multiple, you know, different arguments.
- 54:02It doesn't have to be too advanced with like sub commands and all that kind of stuff necessarily.
- 54:06Yeah.
- 54:07Yeah.
- 54:07And then make it installable.
- 54:09This is, you recommend a pyproject.toml, which yeah, for packages these days, that seems
- 54:15pretty much the de facto standard, right?
- 54:17Yeah.
- 54:18And then what's nice is, yeah, you're using current things.
- 54:21You're not relying on setup.py.
- 54:23And also in there, there's a way to expose an entry point.
- 54:27And that's line 24.
- 54:28Yeah.
- 54:29Yeah.
- 54:29Yeah.
- 54:29Yeah.
- 54:30That's really nice.
- 54:30I love entry points.
- 54:31I think it's, I think they're massively underused in Python.
- 54:35You know, people talk about how do I create a script that I can give it to somebody so they
- 54:40can run something.
- 54:41And that so often involves like, where is it?
- 54:44Where is its associated files?
- 54:46Where is its Python?
- 54:47And where is its dependence?
- 54:48All of that stuff you, if you just create a package and it has an entry point, you can
- 54:52pipx install it or uv tool install it.
- 54:55Or, and now you just have all these commands and people don't have to mess with all the Python
- 54:58stuff.
- 54:59Even if you know how to do it, you don't necessarily want to do that all the time.
- 55:01Right?
- 55:02Yeah.
- 55:02And then it's just easy to, you can kind of call it from anywhere at that point.
- 55:05Yeah, exactly.
- 55:06So in this example, you give, you put a, a validate dash file name command and you
- 55:12just point to, you know, what module and then what function to call.
- 55:16And that's the CLI.
- 55:17Yeah.
- 55:17That's really nice.
- 55:18And then of course that, that function in there is built and backed with arg parse.
- 55:22So it all, it kind of all comes through a circle right there.
- 55:24Yeah.
- 55:24Yeah.
- 55:25So it's like you, it's almost like you had created, you know, some command line utility,
- 55:29like bash wise or something.
- 55:31And you just have that available and it's hooks into your, your CLI.
- 55:35I also want to call out on a 21 line 21, cause we talked about dependencies, right?
- 55:39So anything you put in there, that's automatically will get grabbed when pre-commit installs.
- 55:44So in this case, there's nothing.
- 55:46And then the case of the exit stripper I mentioned, like we need to install pillow, right?
- 55:50So this is how you can configure how pre-commit will grab everything.
- 55:55And I also see it has, yeah, I see there's a requires Python version.
- 55:58Does pre-commit help you get Python in any way?
- 56:01Or is it just assume that there's a...
- 56:03You need to have whatever languages you're relying on, you do need to have them installed
- 56:06already.
- 56:07Okay.
- 56:07So in order for you to use this pre-commit hook on your machine, you'd have to have, for
- 56:12example, Python 3, 10, 11, 12, something like that installed, given that it says 310
- 56:16or greater.
- 56:17So for example, like if you saw some hook that sounded interesting, but it's written in Go
- 56:21and you don't have Go on your computer, you have to figure that out first.
- 56:24That's a no-go.
- 56:25It's a no-go.
- 56:28All right.
- 56:28Let's see.
- 56:28Yeah.
- 56:30And then last thing to do is you say, create the pre-commit hooks.yaml file.
- 56:36And is this the thing that goes into your repo?
- 56:39So when pre-commit sees it, it knows what to do?
- 56:42Yeah.
- 56:42So for example, in the exif stripper repo, there's this file exists.
- 56:47So if someone uses exif stripper, they point to that repository.
- 56:51And then when pre-commit goes and grabs it, it looks for this file, right?
- 56:54And then the key things here, for one being language.
- 56:58So language tells pre-commit, how does it try to install that?
- 57:02So in this case, it says, oh, this is Python.
- 57:04So then it knows, okay, pip.
- 57:06The ID at the top, that's the name that you reference in the pre-commit config.
- 57:12Like when you want to, like we saw check toml, check yaml in the beginning, those correspond
- 57:17to entries in the pre-commit hooks yaml of that repository that they were being referenced
- 57:23from.
- 57:23So pre-commit can, so first finds this file, it can install, then it can see, oh, which
- 57:28hook do you want?
- 57:29Validate file name in this case.
- 57:30And then how do I call this?
- 57:32And that's entry.
- 57:33And this is pointing to the entry point that we made, but it can be anything, right?
- 57:38You could call rough and then add, you know, 20 different command line flags if you want.
- 57:43And that can be your hook.
- 57:44And that would be fine as well.
- 57:46And what's very interesting here is it's optional, but it's the types one at the bottom.
- 57:51So I talked before about XF stripper only running on images, right?
- 57:55It'd be wasteful to have it look at toml and markdown, right?
- 57:58If it's not going to do anything with it.
- 57:59Can't find any XF information in the toml.
- 58:01Yeah.
- 58:02So this controls that.
- 58:04So for example, this hook will only run on Python files.
- 58:08And this logic, I'm blanking on the name of the tool that pre-commit uses to figure this
- 58:14out.
- 58:14But this is handled elsewhere.
- 58:15So there's like certain names that you can use.
- 58:17Right.
- 58:18Some sort of category mapping over to these file extensions or these bombs at the beginning
- 58:23of the file or whatever mean that it's this thing.
- 58:26Exactly.
- 58:26There is a very dangerous thing with this and that types is an and.
- 58:31So if you say, if you wanted to do like this should run on Python and markdown, you can't
- 58:35use this because it will look for files that are both Python and markdown and will not end
- 58:41well.
- 58:41Not too many of those exist.
- 58:43Yeah.
- 58:43There's a separate types or that you have to use.
- 58:46That's like a little gotcha.
- 58:47It's like an ORM sort of instead of a SQL statement.
- 58:51Kind of you got to.
- 58:52Yeah.
- 58:53Those things always get weird.
- 58:54Like import the or operator.
- 58:56Like, okay.
- 58:57Yeah.
- 58:58Cool.
- 58:59Okay.
- 58:59That's actually that that is very good to know because it looks like a list of options.
- 59:03It is.
- 59:05Yeah.
- 59:05But they combine.
- 59:05So you might have something like it is a file and it's Python.
- 59:08That might be one thing I've seen.
- 59:10Right.
- 59:10Okay.
- 59:11Yeah.
- 59:12Cool.
- 59:12So if I wanted to have more than one hook, I could put it into one.
- 59:16I could have more than one here.
- 59:18Is that possible?
- 59:18Yeah.
- 59:19So this looks like a list.
- 59:20Yeah, exactly.
- 59:21It's structured as a YAML list.
- 59:22So you just kind of could copy that block, paste the new one, and then just change whatever
- 59:27fields you want.
- 59:28And then that's now the second hook that you expose.
- 59:31Right.
- 59:31And working backwards, I suppose you just expose a different entry point potentially and then
- 59:36just call it out or whatever you want.
- 59:38Well, I mean, you could like maybe you have a validate file name and maybe you have another
- 59:41one that's like validate long file names or something where you're like, now they have
- 59:44to be this long.
- 59:45And then it's just a shortcut for something else.
- 59:47So it doesn't have to be a different thing.
- 59:49Oh, yeah.
- 59:49You just put an argument in there as a default kind of for people.
- 59:52So we talked about args earlier and that was something the user could tweak.
- 59:57Anything you put in here is essentially like it will always run with these.
- 1:00:01So you could bake in certain things that have to happen.
- 1:00:04Yeah.
- 1:00:04Awesome.
- 1:00:05I love it.
- 1:00:06Okay.
- 1:00:06We're pretty much out of time, but let's talk about one final thing.
- 1:00:12Not this one.
- 1:00:13Your Datamorph project.
- 1:00:15Give a quick shout out to that before we wrap things up.
- 1:00:19What do you think?
- 1:00:19Sure.
- 1:00:19So this project started related to the pandas workshop I had mentioned.
- 1:00:26I wanted to have a visual to really drive home the point that we needed to visualize our
- 1:00:31data because pandas very much data wrangling.
- 1:00:35And after talking to people two hours about data wrangling and statistics, you can calculate
- 1:00:40on tabular data.
- 1:00:41Some people just feel like, oh, okay, we're done.
- 1:00:44I mean, you know, we're done.
- 1:00:45And that's definitely not the case.
- 1:00:47And I was thinking about, and you had it on the screen before, but the data source doesn't.
- 1:00:52So yeah.
- 1:00:53So there was research in 2017 by Autodesk where they took the idea of Anscombe's Quartet, which
- 1:01:01is, sorry, just a little bit above that, which is just a set of four, yeah, four data sets.
- 1:01:08They share the same summary statistics.
- 1:01:10So the mean in X and Y, the standard deviation in X and Y, and the Pearson correlation coefficient.
- 1:01:16And they look very different.
- 1:01:17And if you think of, naively, you think, well, I know the average and maybe how spread out
- 1:01:24things are.
- 1:01:25So I can kind of get a sense of what this data probably means.
- 1:01:28But in reality, outliers and other weird things could just completely blow up those ideas,
- 1:01:33right?
- 1:01:34Yeah.
- 1:01:34And so in 2017, they had developed this algorithm using simulated annealing.
- 1:01:40So if you scroll down once more, where they take the dinosaur at the top and they use
- 1:01:47simulated annealing to push the points.
- 1:01:48Let me describe this really quick for just people listening.
- 1:01:50So there's a matplotlib looking graph of some data points, and it has a certain standard
- 1:01:56deviation, certain mean, et cetera.
- 1:01:58But if you actually look at it, it looks like a T-Rex, right?
- 1:02:02Something like this?
- 1:02:03Yes.
- 1:02:03Is that a decent enough description?
- 1:02:05That's a perfect description.
- 1:02:07Yeah.
- 1:02:07So what the researchers have done is they use this simulated annealing algorithm to push
- 1:02:12the points around.
- 1:02:13So starting from that dinosaur and just moving the points ever so slightly in such a way where
- 1:02:18the summary statistics are unchanged, at least to the two decimal places where they're currently
- 1:02:23shown, and tried to make other shapes.
- 1:02:26So some of the other shapes they have are a bullseye, a circle, lines slanted vertically
- 1:02:32or a star.
- 1:02:33And all of these can be formed from that dinosaur, some to varying degrees of success.
- 1:02:38But they're visually recognizable, which is the point that is pretty important here, right?
- 1:02:45So you cannot, as we said, rely on those summary statistics because you don't know.
- 1:02:48Is it the star?
- 1:02:49Is it the dinosaur?
- 1:02:50Is it a line?
- 1:02:51It could be anything.
- 1:02:52And they also had animation that they included.
- 1:02:56So basically, you could start from the dinosaur and then turn it into a circle.
- 1:03:00And that's even more impractical because you realize at that point that it's not just the
- 1:03:06dinosaur and the circle that have something in common, but it's the infinite number of
- 1:03:10points arrangements that you can make between them that actually share that.
- 1:03:14And so I wanted to explore if I could extend that to working for arbitrary data sets and also
- 1:03:20different shapes.
- 1:03:21So I found the research code and spent quite a bit hacking at it and even just trying to
- 1:03:27get it to work for their example.
- 1:03:29And that took quite a bit of time.
- 1:03:30And then I had this idea of being that it was for a pandas workshop to take a panda and
- 1:03:35turn it.
- 1:03:36Initially, I wanted to turn it into the dinosaur.
- 1:03:38I still have not found a good way to do that yet, but I also haven't been trying at all this
- 1:03:44year on that, to be honest.
- 1:03:45But I figured out how to, and by adding a lot of other things that didn't exist in the initial
- 1:03:51algorithm, things like calculating bounds of the data and different metrics that I figured
- 1:03:56out a way to get it to work regardless.
- 1:03:59So I can give it a panda data set or a soccer ball and it can perform these transformations
- 1:04:04and move the points around.
- 1:04:06So on the screen, we have the first time I shared this publicly, what I had been working on,
- 1:04:11it happened to be Easter.
- 1:04:12So I made a bunny holding an Easter egg with the words, happy Easter off the side.
- 1:04:17And it turns into two vertical lines all while preserving the summary statistics.
- 1:04:22This is something I think makes it for a very good teaching tool in say like an introductory
- 1:04:28statistics course to encourage people that they need to visualize.
- 1:04:32There's an interesting study, I think called the hypothesis is a liability.
- 1:04:38And they talked about taking students in a statistical analysis course and they split them into two.
- 1:04:44And one set of students were just given the data set and say, here, explore, see what you find.
- 1:04:49And then the other set were given a set of hypotheses to test.
- 1:04:53And it turns out that the data is shaped like a gorilla.
- 1:04:56And the students who were told here, test these hypotheses were five times less likely to even
- 1:05:02realize that it was shaped like a gorilla because they never plotted it.
- 1:05:05Yeah.
- 1:05:06This is such a huge thing to like get people learning this early.
- 1:05:10And the more shocking these visuals are, the better.
- 1:05:14Yeah.
- 1:05:14And I think these are super shocking, right?
- 1:05:17Having T-Rexes and bunnies and go, you know, that bunny is, you know, equivalent.
- 1:05:22And there's a continuous transformation from bunny to blob of dots with one outside dot, right?
- 1:05:28That kind of stuff kind of surprise you, I think.
- 1:05:30And one thing I see, especially when the dinosaur came out, but even when I posted some of my first
- 1:05:37examples is you see people comment right away, wow, that there's something that's so cool that
- 1:05:41that dinosaur is possible to do that with.
- 1:05:44Like, no, no, no.
- 1:05:44It's not, it's not just the dinosaur or just the panda.
- 1:05:47It's really like anything.
- 1:05:48And so the way this also works is that people can use their own data sets or they can add
- 1:05:53something new.
- 1:05:53And that's what I've had, that's what's what I've done this year in the two previous development
- 1:05:59sprints that I had people just been, I did one in EuroPython and one in PyCon Taiwan earlier
- 1:06:07this year.
- 1:06:07And hopefully in Australia, we'll do some more.
- 1:06:11But I had people add, for example, a target shape.
- 1:06:15So what the, for example, the panda would turn into, we have a club, like the card suit,
- 1:06:21which was quite a challenge, and the spade.
- 1:06:24And I had already had the heart.
- 1:06:25The heart is actually a trigonometric equation, which, you know, blew my mind at first.
- 1:06:30There's actually a page I found on, I think, Wolfram Alpha, which was like, I want to say
- 1:06:35like 10 or 15 different equations, trigonometric equations for different types of hearts.
- 1:06:40And you can pick the exact type of heart you wanted.
- 1:06:43Social media heart, the emoji heart, what are we talking about?
- 1:06:45No, no, it was just like, this is longer, this is more curved.
- 1:06:48Yeah, yeah, yeah, that's awesome.
- 1:06:49But these are all now math problems when you think about that side of it.
- 1:06:53So this could then be used maybe in a course where they want to focus on math, but also
- 1:06:57some more coding.
- 1:06:58So there's lots of different use cases, like just giving it the data.
- 1:07:02And that's very much more just pure statistics.
- 1:07:04But, you know, I think, and I've heard from a few teachers that, from what I presented,
- 1:07:09that they're, it sounds like this would be something that they would like to use.
- 1:07:13So hopefully that does happen.
- 1:07:14If not, it's a fun thing to put in my slides.
- 1:07:16And I did enjoy getting it to work.
- 1:07:18Yeah, I didn't pull up any good videos for the YouTube video, but there's some really nice
- 1:07:23animations of actually seeing it go from one to the other that you got.
- 1:07:27And this is, you're doing a talk at PyCon Australia, and then you're doing a sprint on
- 1:07:32this as well, right?
- 1:07:33Coming up in November 22nd, about a month from now.
- 1:07:36Correct.
- 1:07:37So cool.
- 1:07:37People can check that out if they happen to be at PyCon Australia and want to...
- 1:07:41Well, I'll also be talking about it in San Francisco next week.
- 1:07:45There won't be a sprint, but I will be talking about that.
- 1:07:48So people can...
- 1:07:48Okay.
- 1:07:49It's not a PyCon.
- 1:07:49Sure.
- 1:07:50It's still cool.
- 1:07:51All right.
- 1:07:52Well, Stephanie, thank you so much for being here.
- 1:07:54Let's wrap things up.
- 1:07:56But I guess, you know, give us a final call to action for people maybe interested in pre-commit
- 1:08:00hoax or other stuff that you're doing.
- 1:08:02Yeah, you can find everything that we mentioned here and the projects on my website.
- 1:08:06I'm putting much more effort into putting stuff on there this year now that I've rebuilt it.
- 1:08:12So definitely check there and sign up for my newsletter.
- 1:08:15Follow me on socials.
- 1:08:17There's no links down here, but you can find them.
- 1:08:19There'll be links on the episode page.
- 1:08:21So we'll put them there.
- 1:08:22All right.
- 1:08:23Well, thanks.
- 1:08:24Thanks for being here.
- 1:08:24It's great to talk to you.
- 1:08:25Thanks for coming on and sharing.
- 1:08:26Thanks for having me.
- 1:08:27Yeah.
- 1:08:27Bye-bye.
- 1:08:28This has been another episode of Talk Python To Me.
- 1:08:32Thank you to our sponsors.
- 1:08:34Be sure to check out what they're offering.
- 1:08:35It really helps support the show.
- 1:08:37Take some stress out of your life.
- 1:08:39Get notified immediately about errors and performance issues in your web or mobile applications with Sentry.
- 1:08:45Just visit talkpython.fm/sentry and get started for free.
- 1:08:50And be sure to use the promo code talkpython, all one word.
- 1:08:53This episode is brought to you by Bluehost.
- 1:08:56Do you need a website fast?
- 1:08:58Get Bluehost.
- 1:08:58Their AI builds your WordPress site in minutes and their built-in tools optimize your growth.
- 1:09:04Don't wait.
- 1:09:05Visit talkpython.fm/bluehost to get started.
- 1:09:08Want to level up your Python?
- 1:09:10We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:09:14Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:09:19And best of all, there's not a subscription in sight.
- 1:09:22Check it out for yourself at training.talkpython.fm.
- 1:09:25Be sure to subscribe to the show.
- 1:09:27Open your favorite podcast app and search for Python.
- 1:09:30We should be right at the top.
- 1:09:31You can also find the iTunes feed at /itunes, the Google Play feed at /play,
- 1:09:36and the direct RSS feed at /rss on talkpython.fm.
- 1:09:40We're live streaming most of our recordings these days.
- 1:09:43If you want to be part of the show and have your comments featured on the air,
- 1:09:47be sure to subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:09:51This is your host, Michael Kennedy.
- 1:09:53Thanks so much for listening.
- 1:09:55I really appreciate it.
- 1:09:56Now get out there and write some Python code.
- 1:09:57I'll see you next time.