Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 26 additions & 27 deletions transcripts/482-pre-commit-hooks-for-python-devs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

00:00:08 tired of dealing with tons of conflicts and spurious Git changes? You need Git pre-commit

00:00:13 hooks. Well, we're lucky to have Stephanie Molin on the show today, who has done a bunch of writing
00:00:13 hooks. Well, we're lucky to have Stefanie Molin on the show today, who has done a bunch of writing

00:00:18 and teaching of Git hooks. This is Talk Python to Me, episode 482, recorded October 24th, 2024.

Expand All @@ -28,9 +28,9 @@

00:01:19 brought to you by Bluehost. Do you need a website fast? Get Bluehost. Their AI builds your WordPress site

00:01:25 in minutes, and their built-in tools optimize your growth. Don't wait. Visit talkpython.fm
00:01:25 in minutes, and their built-in tools optimize your growth. Don't wait. Visit talkpython.fm/ Bluehost

00:01:31 slash Bluehost to get started. Hey, everyone. Before we jump into the interview with Stephanie,
00:01:31 to get started. Hey, everyone. Before we jump into the interview with Stefanie,

00:01:36 I want to tell you real quickly that I just released a blog for Talk Python. Now, we have had tons of RSS

Expand All @@ -42,15 +42,15 @@

00:02:01 really cool things on there. I've already got a couple of articles posted, but I have plans for

00:02:06 some interesting series. And anytime there's some more interesting announcements or exciting news I
00:02:06 some interesting series. And anytime there's some more interesting announcements or exciting news

00:02:11 want to share with Talk Python, it's going to be over on the Talk Python blog. So if you're interested,
00:02:11 I want to share with Talk Python, it's going to be over on the Talk Python blog. So if you're interested,

00:02:16 I would really, really appreciate it. If you go to talkpython.fm, click on blog, right in the

00:02:21 navigation or at the bottom and just subscribe to the RSS feed. That way we can stay in touch.

00:02:26 And with that, let's talk pre-commit hooks. Stephanie, welcome to Talk Python. It's awesome
00:02:26 And with that, let's talk pre-commit hooks. Stefanie, welcome to Talk Python. It's awesome

00:02:32 to have you. Thanks for having me. Yeah, really looking forward to talking about pre-commit hooks.

Expand Down Expand Up @@ -360,7 +360,7 @@

00:15:46 Sentry. Create your Sentry account now at talkpython.fm/Sentry. And if you sign up with the code

00:15:52 talkpython, all capital, no spaces, it's good for two free months of Sentry's business plan, which will give you up to
00:15:52 TALKPYTHON, all capital, no spaces, it's good for two free months of Sentry's business plan, which will give you up to

00:16:00 20 times as many monthly events as well as other features.

Expand Down Expand Up @@ -486,15 +486,15 @@

00:20:47 So 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?

00:20:57 So this is just github.com slash astral.sh, which is the company behind rough newbie.
00:20:57 So this is just github.com/astral.sh, which is the company behind rough newbie.

00:21:02 And this is the rough pre-commit.

00:21:04 But what's interesting about this is, well, one, that it has nothing to do with the pre-commit project.

00:21:09 But two, that this one also takes special arguments that you can pass to it.

00:21:14 Yeah, so I think the rough pre-commit one is just a smaller version so that it works faster with pre-commit.
00:21:14 Yeah, so I think the ruff pre-commit one is just a smaller version so that it works faster with pre-commit.

00:21:20 Because pre-commit will have to install these at some point.

Expand Down Expand Up @@ -524,7 +524,7 @@

00:22:06 So 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.

00:22:14 Yeah, 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.
00:22:14 Yeah, and ruff has a exit non-zero on fix, which means if it goes through and you say to fix it, it will fix it.

00:22:21 But 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.

Expand Down Expand Up @@ -592,11 +592,11 @@

00:23:53 and then it takes these arguments, I think this is an interesting point of discussion.

00:23:57 So the example you have in your article just says, what we're going to tell rough is dash,
00:23:57 So the example you have in your article just says, what we're going to tell ruff is dash,

00:24:01 dash, fix, dash, dash, exit non-zero fix, and show fixes, which is all good.

00:24:07 But rough can be pretty complex in its configuration, right?
00:24:07 But ruff can be pretty complex in its configuration, right?

00:24:11 You can say, disable flight gate, turn this one on.

Expand All @@ -608,7 +608,7 @@

00:24:21 So you can either do this argument thing, or if it's supported, you could also potentially have,

00:24:27 say, a rough.toml, right?
00:24:27 say, a ruff.toml, right?

00:24:28 Yeah.

Expand All @@ -618,7 +618,7 @@

00:24:38 Yeah, exactly.

00:24:38 So you just add a rough section in there and then you configure things.
00:24:38 So you just add a ruff section in there and then you configure things.

00:24:42 And this is stuff that you'd want to use both in your editor as well as in the pre-commit stage,

Expand All @@ -640,7 +640,7 @@

00:25:01 No, no, you don't.

00:25:02 So I suppose that's a massive bonus of having either the tool.rough settings in your pyproject or just a rough.toml,
00:25:02 So I suppose that's a massive bonus of having either the tool.rough settings in your pyproject or just a ruff.toml,

00:25:09 however you go about that, it doesn't really matter.

Expand Down Expand Up @@ -782,17 +782,17 @@

00:28:30 a certain standard.

00:28:30 I think one of them is called committizen.
00:28:30 I think one of them is called commitizen.

00:28:32 And so that runs on, my guess is on the commit message hook.

00:28:36 Committizen?
00:28:36 Commitizen?

00:28:37 Yes.

00:28:38 Okay.

00:28:38 What is this committizen about?
00:28:38 What is this commitizen about?

00:28:39 I haven't heard of this.

Expand Down Expand Up @@ -1524,11 +1524,11 @@

00:45:18 And I will be talking about Datamorph once again.

00:45:21 And I'm hoping to run my third development sprint on Datamorph while I'm there.
00:45:21 And I'm hoping to run my third development sprint on Data Morph while I'm there.

00:45:26 Oh, that's cool.

00:45:27 Yeah, we'll talk about Datamorph in a second.
00:45:27 Yeah, we'll talk about Data Morph in a second.

00:45:28 That's some interesting stuff.

Expand Down Expand Up @@ -1782,7 +1782,7 @@

00:51:11 example, pip to install this.

00:51:12 And if you have, for example, pyproject.tomo and you specify how it should be built, then
00:51:12 And if you have, for example, pyproject.toml and you specify how it should be built, then

00:51:16 all of that just happens as it normally would.

Expand Down Expand Up @@ -1856,7 +1856,7 @@

00:52:36 And that's also a quicker way to get started versus trying to, let's say, read the pipe,

00:52:42 find the pipe project.tongle, read it in, parse out things.
00:52:42 find the pyproject.toml, read it in, parse out things.

00:52:46 That's all stuff that can come later once you figure out exactly how you want your tool to

Expand Down Expand Up @@ -1890,13 +1890,13 @@

00:53:31 You can click, you can type, but if you want something built in, yeah, if you want something

00:53:37 built in, argpars is pretty straightforward, right?
00:53:37 built in, argparse is pretty straightforward, right?

00:53:39 Yeah.

00:53:40 And I think also, I mean, if you look at the pre-commit hooks repo provided by pre-commit org,

00:53:45 a lot of them, or maybe all of them are just using argpars.
00:53:45 a lot of them, or maybe all of them are just using argparse.

00:53:49 Because for most hooks, all you'll need to say is, I have an argument parser and it accepts

Expand Down Expand Up @@ -2512,7 +2512,7 @@

01:07:51 All right.

01:07:52 Well, Stephanie, thank you so much for being here.
01:07:52 Well, Stefanie, thank you so much for being here.

01:07:54 Let's wrap things up.

Expand Down Expand Up @@ -2594,7 +2594,7 @@

01:09:30 We should be right at the top.

01:09:31 You can also find the iTunes feed at /itunes, the Google Play feed at /play,
01:09:31 You can also find the iTunes feed at /iTunes, the Google Play feed at /play,

01:09:36 and the direct RSS feed at /rss on talkpython.fm.

Expand All @@ -2613,4 +2613,3 @@
01:09:56 Now get out there and write some Python code.

01:09:57 I'll see you next time.