WEBVTT

00:00:00.001 --> 00:00:04.880
Are you considering or struggling with replacing much of the interactivity of your Django app with

00:00:04.880 --> 00:00:10.140
front-end JavaScript? After all, your users do expect an interactive and modern app, right?

00:00:10.140 --> 00:00:16.380
Before you make a rash decision, you owe it to yourself to check out HTMX. It goes really well

00:00:16.380 --> 00:00:22.320
with Django. We have Christopher Trudeau here to run us through the whole awesome list of HTMX and

00:00:22.320 --> 00:00:28.820
Python things and tell us about his new HTMX and Django course. This is Talk Python To Me,

00:00:28.820 --> 00:00:50.220
episode 437, recorded October 5th, 2023. Welcome to Talk Python To Me, a weekly podcast on Python.

00:00:50.220 --> 00:00:54.600
This is your host, Michael Kennedy. Follow me on Mastodon, where I'm @mkennedy,

00:00:54.600 --> 00:01:00.920
and follow the podcast using @talkpython, both on fosstodon.org. Keep up with the show and listen

00:01:00.920 --> 00:01:07.700
to over seven years of past episodes at talkpython.fm. We've started streaming most of our episodes live

00:01:07.700 --> 00:01:13.600
on YouTube. Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about

00:01:13.600 --> 00:01:19.440
upcoming shows and be part of that episode. This episode is brought to you by IRL,

00:01:19.440 --> 00:01:25.140
an original podcast from Mozilla. When it comes to artificial intelligence, AI, what's good for

00:01:25.140 --> 00:01:30.760
trillion dollar companies isn't necessarily good for people. That's the theme of season seven of IRL,

00:01:30.760 --> 00:01:36.480
Mozilla's multi-award winning podcast hosted by Bridget Todd. Season seven is all about putting

00:01:36.480 --> 00:01:42.160
people over profit in AI. Check them out and listen to an episode at talkpython.fm/IRL.

00:01:42.520 --> 00:01:47.640
And it's brought to you by Sentry. They have a special live event, like a mini online conference,

00:01:47.640 --> 00:01:52.380
where you can connect with the team and take a deep dive into different products and services

00:01:52.380 --> 00:01:58.000
every day for a week. Join them for launch week, new product releases, exclusive demos,

00:01:58.000 --> 00:02:03.020
and discussions with experts from their community on the latest with Sentry. You'll see how Sentry's

00:02:03.020 --> 00:02:08.520
latest product updates can make your work life easier. Visit talkpython.fm slash

00:02:08.520 --> 00:02:15.240
sentry-launch-week to register for free. Hey, Christopher, welcome to Talk Byther Me.

00:02:15.240 --> 00:02:19.320
Ah, it's been a little over a year. I just looked it up. It's nice to be back.

00:02:19.320 --> 00:02:21.740
Yes, the annual appearance.

00:02:22.080 --> 00:02:27.540
Sure. You want to make it annual? I can go for three or four, and that's a little like we'll see into the future.

00:02:27.540 --> 00:02:33.340
We both spend a decent amount of time behind microphones these days, don't we?

00:02:33.340 --> 00:02:37.080
I seem to. Yes, yes. It does seem to be the way it is.

00:02:37.080 --> 00:02:38.320
It's a funny world, right?

00:02:38.320 --> 00:02:41.860
I was just looking it up because I figured, you know, your standard interview question,

00:02:41.860 --> 00:02:46.500
so what have you been doing? It's like, well, I've put out over a dozen courses since the last time I was on.

00:02:46.580 --> 00:02:52.080
So, yes, as you said, it's a lot of time behind the mic, so not so much the live mic.

00:02:52.080 --> 00:02:58.840
So if I'm doing a little nervous, say the word so too many times, it makes me more human than in my courses, I guess.

00:02:58.840 --> 00:03:01.540
That's right. The magic of editing.

00:03:01.540 --> 00:03:02.360
That's right.

00:03:02.360 --> 00:03:04.360
That was a concise and quick response.

00:03:05.300 --> 00:03:12.460
Well, it's great to have you back on the show and looking forward to talking about one of my very, very favorite topics,

00:03:12.460 --> 00:03:15.320
HTMX at this time in the context of Django.

00:03:15.320 --> 00:03:20.140
Yeah, I was actually just the other day listening to your episode.

00:03:20.140 --> 00:03:21.080
What is it?

00:03:21.080 --> 00:03:27.240
428 when you had Vincent and Gibson on and you delve into HTMX a little bit.

00:03:27.240 --> 00:03:28.600
They seem to be big fans.

00:03:29.040 --> 00:03:36.420
It's one of the sort of semi-gags in the course that we're going to talk about a little bit is I just kept telling people that I'm in love.

00:03:36.420 --> 00:03:38.860
Like it really is the answer.

00:03:38.860 --> 00:03:41.760
I'd love to see it become part of the HTML standard.

00:03:41.760 --> 00:03:44.400
It's a much, much happier way of coding.

00:03:44.400 --> 00:03:48.360
Makes me feel like the old days, things are much simpler with it.

00:03:48.360 --> 00:03:49.620
Yeah, I totally agree.

00:03:49.620 --> 00:03:56.760
And Carson Gross, the creator of it, does often say it's kind of like HTML just kind of stopped growing when JavaScript came along.

00:03:56.760 --> 00:03:57.840
And this is what it should have been.

00:03:57.840 --> 00:04:02.700
But well, if I've got to do it, I'll take one for the team and build HTMX for everyone.

00:04:02.700 --> 00:04:03.400
But you're right.

00:04:03.400 --> 00:04:05.420
It really should just be built in more or less, shouldn't it?

00:04:05.420 --> 00:04:05.680
Yeah.

00:04:05.680 --> 00:04:09.820
Every once in a while you come across something where you sort of look at it and you're like, wait, this is the right way.

00:04:09.820 --> 00:04:11.760
Crap.

00:04:11.760 --> 00:04:14.440
I've been doing it wrong for almost 30 years.

00:04:14.440 --> 00:04:15.660
This is the right way.

00:04:15.660 --> 00:04:17.260
So why didn't anyone tell me?

00:04:17.260 --> 00:04:17.960
That's right.

00:04:17.960 --> 00:04:18.300
Yeah.

00:04:18.300 --> 00:04:19.160
Yeah.

00:04:19.160 --> 00:04:26.520
It's a little bit of a, oh, wait, if I'd had this so long ago, it would have made this and this and this so much easier.

00:04:26.520 --> 00:04:30.140
So, yeah, it's definitely a part, definitely some forward progress.

00:04:30.140 --> 00:04:30.640
It is.

00:04:30.640 --> 00:04:38.080
Well, you mentioned when I had the Django chat guys on the show not too long ago, that was when we talked about Django.

00:04:38.080 --> 00:04:39.380
Surprise, surprise.

00:04:39.380 --> 00:04:44.220
But mostly, you know, we started out with the focus of Django turning 18.

00:04:44.760 --> 00:04:56.420
And, you know, maybe we can just start with Django itself before we dive into HTMX, because I think Django more than the other frameworks has its opinions and its styles and its way of doing things.

00:04:56.420 --> 00:05:06.140
And so integrating with HTMX, I think, is a pretty interesting thing that, you know, other people and you've done with, as we'll talk about through this course that I'm going to mention in a moment.

00:05:06.140 --> 00:05:12.100
But, yeah, just, you know, what are your thoughts on Django over the years and Django being, you know, old enough to vote now?

00:05:12.280 --> 00:05:16.900
Well, you know, there's this line I came across that I've since stolen.

00:05:16.900 --> 00:05:19.600
Somebody said, it's not a dinosaur, it's a shark.

00:05:19.600 --> 00:05:21.760
And I love that concept, right?

00:05:21.840 --> 00:05:23.900
It's still growing and it's still changing.

00:05:23.900 --> 00:05:25.620
It's still very actively developed.

00:05:25.620 --> 00:05:31.860
But, you know, I've been playing with Django 5 recently and there's nothing in there that broke any of my four code.

00:05:31.860 --> 00:05:37.360
And if you're going to be coding with the same library over and over again, that's actually desirable, right?

00:05:37.360 --> 00:05:41.520
You want the new features, but you don't want to have to go and redo something every single time.

00:05:41.520 --> 00:05:43.220
You know, I don't want to knock view.

00:05:43.220 --> 00:05:44.580
It's got some strengths.

00:05:44.580 --> 00:05:48.140
We'll talk a little bit about that as well when we start getting into some of the HTMX stuff.

00:05:48.140 --> 00:05:55.460
But by example, because I don't use it very frequently, it seems every time I go back, it's like, oh, they've changed how this happens and I have to rethink this, right?

00:05:55.460 --> 00:05:57.260
And I don't run into that with Django.

00:05:57.260 --> 00:06:02.440
It's become so large that it also addresses different problems for different people.

00:06:02.440 --> 00:06:04.400
I love that they're adding all this asynchronous stuff.

00:06:04.400 --> 00:06:05.880
I will probably never use it.

00:06:05.880 --> 00:06:14.920
And I think it's great that it's out there because it solves a problem for the folks who are trying to use that kind of thing and they don't have to go off to another library.

00:06:15.100 --> 00:06:18.340
But for those of us who don't use it, it's like, nope, that's fine.

00:06:18.340 --> 00:06:18.660
Whatever.

00:06:18.660 --> 00:06:19.660
It doesn't break anything.

00:06:19.660 --> 00:06:21.180
They don't have to start from scratch.

00:06:21.180 --> 00:06:23.360
And they keep chugging along.

00:06:23.360 --> 00:06:29.380
And, you know, both Will and Carlton sort of commented about the community and they're right.

00:06:29.380 --> 00:06:30.060
It's there.

00:06:30.060 --> 00:06:37.440
You know, Django, the project site that has all of the add-ons, there's like over 4,000 different apps and libraries that you can use.

00:06:37.440 --> 00:06:39.180
So it's not just the framework.

00:06:39.180 --> 00:06:40.620
It's not just the core.

00:06:40.620 --> 00:06:41.600
It's the ecosystem.

00:06:41.600 --> 00:06:43.240
And it makes a big difference.

00:06:43.240 --> 00:06:45.000
It makes your life a lot easier that way.

00:06:45.000 --> 00:06:45.860
A lot of choice.

00:06:45.860 --> 00:06:49.360
More than almost any other individual library in Python.

00:06:49.360 --> 00:06:51.760
Django's got a massive community behind it, doesn't it?

00:06:51.760 --> 00:06:52.040
Yeah.

00:06:52.040 --> 00:06:52.400
Yeah.

00:06:52.400 --> 00:06:55.000
Well, you know, there aren't other conferences, right?

00:06:55.000 --> 00:06:56.460
There's PyCon and there's DjangoCon.

00:06:56.460 --> 00:07:01.100
And everything else is go to a PyCon and talk about it in a room.

00:07:01.100 --> 00:07:02.920
And then there's an entire conference for it.

00:07:02.920 --> 00:07:04.140
And two of them, right?

00:07:04.140 --> 00:07:06.080
There's Europe and the US, right?

00:07:06.180 --> 00:07:07.800
So it's a big deal.

00:07:07.800 --> 00:07:08.180
It is.

00:07:08.180 --> 00:07:12.020
And it's been a while since I've been to a requests con, although I do like requests.

00:07:12.020 --> 00:07:12.220
Yeah.

00:07:12.220 --> 00:07:12.640
Yeah.

00:07:12.640 --> 00:07:16.160
Also, you mentioned the async stuff and some of these new things.

00:07:16.160 --> 00:07:22.200
Python and Django, it's just amazing how stable they are in the sense of two to three aside, right?

00:07:22.200 --> 00:07:24.620
Like it's very, very, very rare.

00:07:24.620 --> 00:07:29.640
Not never, but very rare that you have to go and fix code because a new version of Python came out.

00:07:29.640 --> 00:07:29.900
Yeah.

00:07:29.900 --> 00:07:30.820
It's the same thing, right?

00:07:30.880 --> 00:07:39.920
So 3.12 just launched, been playing with the RCs for a little bit, just, you know, swap out the virtual env and my code just keeps chucking along, right?

00:07:39.920 --> 00:07:45.940
Like there's no, I haven't run into a problem even with beta versions in years, right?

00:07:45.940 --> 00:07:49.140
So that, and that stability is, it's important, right?

00:07:49.140 --> 00:07:54.600
It's like you kind of said, we're still, still hurting a little bit from the scars from two to three.

00:07:54.600 --> 00:07:57.500
So I think everybody's being cautious in the right way.

00:07:57.500 --> 00:07:57.820
Yeah.

00:07:57.820 --> 00:07:59.120
I think that's probably true.

00:07:59.120 --> 00:08:04.700
Also some of those new features that maybe you won't use or I won't use or whatever.

00:08:04.700 --> 00:08:13.620
I think they're still really important to have because I don't really hear it so much anymore, actually, but there used to be a lot of talk of like, oh, we're switching to go because of async.

00:08:13.620 --> 00:08:14.580
We need async.

00:08:14.580 --> 00:08:29.100
So we're switching to go and because we need, you know, and even if you individually don't use it, having those features in Django or in Python, they're really important because they kind of knock that conversation.

00:08:29.100 --> 00:08:29.960
out, right?

00:08:29.960 --> 00:08:33.580
They're like, oh, we had all these people love Python, but they had this one special case.

00:08:33.580 --> 00:08:37.580
So they were forced to leave like, well, now they're not necessarily forced to leave because of that.

00:08:37.580 --> 00:08:41.760
And I think, you know, that's positive for everyone, even if many people don't use it directly.

00:08:41.760 --> 00:08:42.100
Yeah.

00:08:42.100 --> 00:08:42.860
Well, for sure.

00:08:42.860 --> 00:08:43.100
Right.

00:08:43.100 --> 00:08:51.520
Like if, you know, if async is what was stopping you from using Django and switching to FastAPI, then, you know, now you don't necessarily have to.

00:08:51.520 --> 00:08:51.760
Right.

00:08:51.760 --> 00:08:53.760
And again, I'm a fan of FastAPI.

00:08:54.140 --> 00:08:56.340
A lot of it comes down to what you're building.

00:08:56.340 --> 00:09:01.640
And, you know, I often get the question also, well, why would I pick Django versus this versus that?

00:09:01.640 --> 00:09:09.140
And I'm like, well, if you're, if you're building an actual project where you need web pages as well as the API, as well as this and as well as that.

00:09:09.140 --> 00:09:14.920
Well, you can do that with FastAPI plus SQLAlchemy plus something else, but, you know, it's all self-contained in Django.

00:09:14.920 --> 00:09:16.760
And so things tend to work better.

00:09:16.760 --> 00:09:28.620
So those edge cases that you talk about that might cause you to go off to another library, even if they don't do it quite as well, it might just having it enough so that you don't leave is makes the difference for sure.

00:09:28.620 --> 00:09:29.080
It does.

00:09:29.080 --> 00:09:29.820
It does.

00:09:29.820 --> 00:09:33.800
There's a whole show comparing Django to FastAPI right there, isn't there?

00:09:33.800 --> 00:09:34.460
Probably.

00:09:34.460 --> 00:09:36.020
And Django or Django Ninja.

00:09:36.020 --> 00:09:36.740
Probably several.

00:09:36.740 --> 00:09:37.700
Probably several.

00:09:37.700 --> 00:09:38.120
Yes.

00:09:38.260 --> 00:09:40.140
Probably, but not this show, not this one.

00:09:40.140 --> 00:09:40.980
All right.

00:09:40.980 --> 00:09:41.540
What's next?

00:09:41.540 --> 00:09:42.800
Let's talk about your book next.

00:09:42.800 --> 00:09:43.260
Sure.

00:09:43.260 --> 00:09:49.760
So one of the things you've been up to in addition to courses is writing books, Django in action.

00:09:49.760 --> 00:09:50.800
Almost released.

00:09:50.800 --> 00:09:51.240
Is that right?

00:09:51.240 --> 00:09:52.200
What's the status?

00:09:52.200 --> 00:09:54.140
So speak in singular.

00:09:54.140 --> 00:09:55.680
It's this is my first.

00:09:55.680 --> 00:09:56.860
So be kind.

00:09:56.860 --> 00:09:58.780
It's in early release.

00:09:58.780 --> 00:10:01.720
So you're able to purchase the first.

00:10:01.720 --> 00:10:03.720
I think we're up to seven chapters.

00:10:03.720 --> 00:10:08.240
And essentially, if you buy the electronic edition, then you get a chapter.

00:10:08.240 --> 00:10:09.940
About a chapter or two a month.

00:10:09.940 --> 00:10:11.200
It kind of comes out piecemeal.

00:10:11.200 --> 00:10:12.800
It's called Django in action.

00:10:12.800 --> 00:10:13.880
It's on Django.

00:10:13.880 --> 00:10:16.120
It's divided into three parts.

00:10:16.120 --> 00:10:20.120
So part one primarily is sort of that intro stuff.

00:10:20.120 --> 00:10:21.340
How to get projects going.

00:10:21.340 --> 00:10:23.660
What a view is routes and all that kind of good thing.

00:10:23.660 --> 00:10:27.200
Part two is around the tools that are built into Django.

00:10:27.580 --> 00:10:31.160
So how to use the admin, you know, slightly more advanced topics.

00:10:31.160 --> 00:10:34.180
And I'm currently in the process of writing part three.

00:10:34.180 --> 00:10:40.360
And the intent of part three is how to extend your use to the third party libraries.

00:10:40.360 --> 00:10:42.380
You know, you just mentioned Django Ninja.

00:10:42.580 --> 00:10:46.080
So I'm hoping to have a chapter both on Ninja and a chapter on HTMX.

00:10:46.080 --> 00:10:48.740
And both of these will guide people to, okay, great.

00:10:48.740 --> 00:10:51.040
So now you've got Django, but you want to build X.

00:10:51.040 --> 00:10:52.020
I need an API.

00:10:52.020 --> 00:10:53.160
Well, how do I do that?

00:10:53.160 --> 00:10:54.960
Well, there's Ninja and there's the DRF.

00:10:54.960 --> 00:10:59.080
I want to have a little more functionality, a little more dynamicism.

00:10:59.080 --> 00:10:59.660
Oh, okay.

00:10:59.660 --> 00:11:02.020
Well, a good answer to that now is HTMX.

00:11:02.020 --> 00:11:04.300
So this is how you wrap those things together.

00:11:04.300 --> 00:11:06.580
So the intent is to try and cover that.

00:11:06.580 --> 00:11:17.840
I'm sort of hoping that there's enough there in part three that folks who have done a bit of Django before are still interested in it and can pick some new things up as you go along.

00:11:17.840 --> 00:11:27.000
And, you know, with the release of Django 5, I've been busy going back in and, you know, adding, hey, and this is what they added in 5 and this is what changes.

00:11:27.000 --> 00:11:29.580
So trying to cover all of that.

00:11:29.580 --> 00:11:32.960
Full publication will probably be early next year.

00:11:33.140 --> 00:11:36.720
But if you're on the electronic copy, you can start now and go from there.

00:11:36.720 --> 00:11:37.980
So, yeah, it's available.

00:11:37.980 --> 00:11:44.560
And I guess while I'm on the topic, I've been getting a lot of great feedback and we've got a forum for folks who've read the book.

00:11:44.560 --> 00:11:50.520
And it makes a big difference to me because, you know, somebody says, oh, hey, I did this and it didn't quite work.

00:11:50.520 --> 00:11:51.900
And I'm like, oh, okay, it shouldn't.

00:11:51.900 --> 00:11:53.680
But let's add a couple sentences about that.

00:11:53.680 --> 00:11:59.700
So it's kind of great to have this dynamic process going and prove it as I go along, which is so.

00:11:59.700 --> 00:12:05.040
So those folks who have been participating in the early release, I very much appreciate that feedback.

00:12:05.040 --> 00:12:10.240
It's cool to be able to build it out in public, not just drop 300 pages of printed something.

00:12:10.240 --> 00:12:15.180
Well, you know, it's something I'm sure you, you know, you encounter with the courses all the time, right?

00:12:15.180 --> 00:12:18.800
Like I've got, we'll call it a particular sense of humor, shall we?

00:12:19.340 --> 00:12:26.400
And when, you know, I put something in a course that I find funny, it's not like you're, there's no audience, right?

00:12:26.400 --> 00:12:29.860
Like you have no idea whether or not the joke lands.

00:12:29.860 --> 00:12:31.420
It's sort of the same thing.

00:12:31.420 --> 00:12:36.860
Like you get, you never get any of that kind of feedback with a course and the book can very much be the same way.

00:12:36.860 --> 00:12:40.320
So, yeah, that early release in the forum helps a little bit.

00:12:40.320 --> 00:12:44.160
So, and so, yeah, nobody's, nobody's going to tell me whether or not I'm funny,

00:12:44.240 --> 00:12:47.180
but they can at least catch whether or not the code works, which is useful.

00:12:47.180 --> 00:12:48.040
Exactly.

00:12:48.040 --> 00:12:53.860
And speaking of projects you've been working on, one of the things that kind of inspired me to have you on the show

00:12:53.860 --> 00:12:59.260
to just dive into Django and HTMX is you actually did a talk Python course, HTMX and Django,

00:12:59.260 --> 00:13:02.300
modern Python web apps, hold the JavaScript, which is awesome.

00:13:02.300 --> 00:13:09.620
That's a really fun, just under two hours course that really shows people like how to integrate HTMX into Django.

00:13:09.620 --> 00:13:10.040
Yeah.

00:13:10.220 --> 00:13:15.020
And, you know, we should shout out the, there's a sister course on there that you started out with,

00:13:15.020 --> 00:13:16.000
with Flask.

00:13:16.000 --> 00:13:19.840
And essentially I took the same concepts and then stuck it in the Django world.

00:13:19.840 --> 00:13:25.500
So if you're coming from Django instead of Flask, then this, I guess it's a,

00:13:25.500 --> 00:13:27.960
it's sort of the equivalent of translating it into Spanish.

00:13:27.960 --> 00:13:32.660
So we cover a lot of the same kind of concepts in both courses.

00:13:32.660 --> 00:13:35.640
We start with this video collector project.

00:13:35.640 --> 00:13:41.860
So it's an actual project with, you know, clickable links and it allows you to sort of store videos that you see from YouTube

00:13:41.860 --> 00:13:47.360
and shows a little image of the thumbnail and, you know, the, the, who the author is.

00:13:47.360 --> 00:13:49.600
So a little database kind of application.

00:13:50.220 --> 00:13:54.260
We start there with a working project and then we HTMX-ify it.

00:13:54.260 --> 00:13:55.320
I'm just going to make words up.

00:13:55.320 --> 00:13:55.560
Yeah.

00:13:55.560 --> 00:13:56.120
It's a verb.

00:13:56.120 --> 00:13:56.600
We can do it.

00:13:56.600 --> 00:13:57.560
We're making verbs today.

00:13:57.560 --> 00:13:57.880
Come on.

00:13:57.880 --> 00:13:58.700
That's, it works.

00:13:58.700 --> 00:14:01.040
In both courses, we add like a click to edit.

00:14:01.040 --> 00:14:04.040
So you've got a little link, you click on the link and it turns into a form.

00:14:04.040 --> 00:14:05.440
Infinite scroll.

00:14:05.440 --> 00:14:08.820
The idea is you scroll down that content keeps getting added.

00:14:08.820 --> 00:14:12.560
Search as you type, which to me is just such a beautiful example, right?

00:14:12.580 --> 00:14:17.700
Like if you've already got search on the website, HTMX, it's like four lines of code.

00:14:17.700 --> 00:14:22.100
Like it's, it's startlingly easy to do it in a dynamic fashion.

00:14:22.100 --> 00:14:25.580
And it's complete with things like it updates the URL.

00:14:25.580 --> 00:14:30.140
So you can do deep linking and you can do a, you know, back button goes to the previous search.

00:14:30.140 --> 00:14:33.220
And all that basically comes by adding just a few attributes.

00:14:33.220 --> 00:14:34.760
So that's, that's beautiful.

00:14:35.080 --> 00:14:43.580
And then the Django version of the course also has a fourth example, which is how to take HTMX and integrate it in with bootstraps.

00:14:43.580 --> 00:14:50.980
You've got libraries on top of libraries and how sort of that JavaScript event system works in that situation and how you can get those things going.

00:14:50.980 --> 00:14:54.460
So, so yeah, so it's very example driven.

00:14:54.460 --> 00:14:58.620
Let's add features and learn how HTMX works along the way.

00:15:00.720 --> 00:15:05.100
This portion of talk Python to me is brought to you by IRL, an original podcast from Mozilla.

00:15:05.100 --> 00:15:11.640
When it comes to artificial intelligence, AI, what's good for trillion dollar companies isn't necessarily good for people.

00:15:11.640 --> 00:15:13.900
Can the risk and rewards be balanced?

00:15:13.900 --> 00:15:20.300
That's the theme of season seven of IRL, Mozilla's multi award-winning podcast hosted by Bridget Todd.

00:15:20.300 --> 00:15:24.200
Season seven is all about putting people over profit in AI.

00:15:24.200 --> 00:15:26.960
I think you'll find episode two pretty interesting.

00:15:26.960 --> 00:15:31.720
As you surely know, LLMs like ChatGPT are all the rage these days.

00:15:31.720 --> 00:15:33.280
Do they seem like magic?

00:15:33.280 --> 00:15:39.480
Well, it turns out that much of their power comes from millions of people entering and correcting data in these LLMs.

00:15:39.480 --> 00:15:45.180
Episode two, the humans in the machine gives us a glimpse into the world of these people behind the AIs.

00:15:45.180 --> 00:15:51.660
For policy junkies, IRL looks at the idea that we're all just guinea pigs in a big AI experiment,

00:15:51.660 --> 00:16:01.980
like the meal planning app that suggests bizarre recipes such as Oreo vegetable stir fries and flawed technologies that compose more deadly risks when it comes to something going wrong,

00:16:01.980 --> 00:16:05.120
like self-driving cars blocking emergency responders.

00:16:05.120 --> 00:16:10.020
You'll also hear from people building more responsible ways to test new AI technology.

00:16:10.020 --> 00:16:14.060
And we find out why it's taking so long to regulate this massive industry.

00:16:14.300 --> 00:16:16.640
That's IRL season seven from Mozilla.

00:16:16.640 --> 00:16:21.400
Check them out and listen to an episode at talkpython.fm/IRL.

00:16:21.400 --> 00:16:23.680
The link is in your podcast player show notes.

00:16:23.680 --> 00:16:27.060
Thank you to IRL and Mozilla for sponsoring the show.

00:16:29.320 --> 00:16:36.400
You know what surprised me about getting into HTMX was you add all this functionality to this existing app,

00:16:36.400 --> 00:16:39.180
kind of like you do in this course or I did in the Flask course,

00:16:39.180 --> 00:16:42.600
and the code actually gets cleaner and simpler at the end.

00:16:42.600 --> 00:16:42.860
Yeah.

00:16:42.860 --> 00:16:43.460
Yes.

00:16:43.460 --> 00:16:48.840
How can it do more and be more easy to understand and clean than the previous version, you know?

00:16:48.840 --> 00:16:49.140
Yeah.

00:16:49.380 --> 00:16:52.160
And, you know, we're going to spend a bunch of time talking about today, too,

00:16:52.160 --> 00:16:54.120
is there's some libraries out there that make it even better.

00:16:54.120 --> 00:16:57.480
And some of these I found after writing the course.

00:16:57.480 --> 00:17:03.900
So it's sort of like, oh, well, hey, if I do that and go back, use that and I will write even less code, which is fantastic.

00:17:03.900 --> 00:17:04.300
Yeah.

00:17:04.300 --> 00:17:04.800
All right.

00:17:04.800 --> 00:17:10.380
Let's, you know, not everyone has already had this love affair that you and I have had with HTMX.

00:17:10.380 --> 00:17:15.880
So maybe you could just give us like a really quick overview of what HTMX is.

00:17:16.040 --> 00:17:19.700
And I think maybe the way to do it would be just we could make a concrete example,

00:17:19.700 --> 00:17:21.980
like click to edit or something like that.

00:17:21.980 --> 00:17:25.160
We could just show like maybe you could just talk us through an example real quick.

00:17:25.160 --> 00:17:27.720
And that would suffice is what the idea is.

00:17:27.720 --> 00:17:27.920
Yeah.

00:17:27.920 --> 00:17:35.080
So it's HTMX is a JavaScript library and it's a JavaScript library that if you're lucky means you'll never have to write JavaScript.

00:17:35.080 --> 00:17:37.360
So you essentially drop it into your page.

00:17:37.360 --> 00:17:43.600
And how it works is you apply a set of attributes to your HTML.

00:17:44.060 --> 00:17:47.180
And those attributes affect how things work.

00:17:47.180 --> 00:17:49.060
All of the attributes are namespaced.

00:17:49.060 --> 00:17:50.540
They all start with HX.

00:17:50.540 --> 00:17:57.300
And the key ones are HX get and HX post, which you can see on the example there on the button.

00:17:57.300 --> 00:17:58.480
There's an HX get.

00:17:58.480 --> 00:18:05.680
And essentially what happens is for a button or a link, you're replacing something like an H ref with this concept.

00:18:05.840 --> 00:18:12.080
And when you click the button or the link that get fires an Ajax call to the server.

00:18:12.080 --> 00:18:21.000
And the intent is instead of getting a full new page like you normally would when you click a link, it will send back a little piece.

00:18:21.000 --> 00:18:24.920
And that little piece is then injected into the page.

00:18:24.920 --> 00:18:27.720
And you can use different attributes to control how.

00:18:27.860 --> 00:18:32.600
The example that's up on the screen here is using the HX swap attribute.

00:18:32.600 --> 00:18:38.480
And that essentially says replace the entire outer div with the content that comes back from the server.

00:18:38.700 --> 00:18:48.260
So the div with the first name, last name, email, which is just a read only, gets replaced with the form that comes down from the server.

00:18:48.260 --> 00:18:52.860
So now essentially we've got click to edit on something that was display and now is a form.

00:18:52.860 --> 00:18:54.820
That's the general idea.

00:18:55.380 --> 00:19:03.640
HTMX sets some headers so that on the server side you can tell whether or not it's actually a HTMX call or not.

00:19:03.640 --> 00:19:06.400
And in the Django world, this works really, really well.

00:19:06.400 --> 00:19:13.660
So a common pattern with a Django view when you're dealing with forms is say have a get and a post inside of the same view.

00:19:13.660 --> 00:19:22.240
So you do a get to get the page and then the post when you're actually submitting the form for that page and you keep it all together inside of the same view function.

00:19:22.840 --> 00:19:29.280
HTMX can do something very similar and essentially instead of checking for get or post, you check for this HTMX header.

00:19:29.280 --> 00:19:33.300
And then you can either send down the whole page or the little partial replacement.

00:19:33.300 --> 00:19:35.880
And like in this example, it's the form that goes with it.

00:19:35.880 --> 00:19:42.840
In addition to things like this form, you can attach it to say we kind of talked about searches you type.

00:19:42.840 --> 00:19:46.620
So you can attach these kinds of attributes to say an input tag.

00:19:46.620 --> 00:19:50.180
And then when maybe you want to bring one of those up, we've got it somewhere.

00:19:50.180 --> 00:19:50.840
Yeah, perfect.

00:19:51.300 --> 00:19:54.640
There's additional things that you can set that change how it behaves.

00:19:54.640 --> 00:19:59.260
So for example, you want to activate this event when someone has typed something in.

00:19:59.260 --> 00:20:01.000
So you're looking at the JavaScript key up event.

00:20:01.000 --> 00:20:06.460
You only want to do it if the input has changed, not just if the event fired.

00:20:06.460 --> 00:20:09.680
So if I'm using my arrow keys, it doesn't send something off to the server.

00:20:10.280 --> 00:20:17.440
And then you can put a delay in so that if we get a bunch of events at the same time, it's not until there's a pause where you send it to the server.

00:20:17.440 --> 00:20:20.720
So if somebody is rapidly typing, you don't send every single keystroke up.

00:20:20.720 --> 00:20:26.200
In the course I also cover, you can set up conditionals on it as well.

00:20:26.200 --> 00:20:31.940
So I've got to check in one version of one sample that checks whether or not there's actually content.

00:20:31.940 --> 00:20:34.660
So you have to have typed at least three letters, for example.

00:20:34.660 --> 00:20:34.940
Right.

00:20:34.940 --> 00:20:37.080
So you can put these kinds of checks in.

00:20:37.200 --> 00:20:47.660
And essentially, it really is very much like roundtrip 1.0 web, except what you're getting down is instead of a whole new page is you're getting a partial.

00:20:47.660 --> 00:20:50.340
And the HTMX library injects this in.

00:20:50.340 --> 00:20:58.940
It's a way of doing some very 2.0 stuff in a very 1.0 way, which means you have very little JavaScript to have to write.

00:20:58.940 --> 00:21:03.240
So personally, I have always found React to be overkill.

00:21:03.240 --> 00:21:05.320
And that's not I'm not trying to slag React people.

00:21:05.920 --> 00:21:07.900
Programming languages are a religious topic, right?

00:21:07.900 --> 00:21:09.820
This isn't me saying you shouldn't.

00:21:09.820 --> 00:21:11.440
This is me saying it doesn't work for me.

00:21:11.440 --> 00:21:15.060
I started coding for the web back in the Perl's CGI days.

00:21:15.060 --> 00:21:20.900
And when JavaScript was first introduced, one of the arguments for it was, oh, you don't need a tool chain, right?

00:21:20.900 --> 00:21:21.740
It just worked.

00:21:21.740 --> 00:21:24.480
And, you know, you just refresh the page and it goes.

00:21:24.480 --> 00:21:33.680
So the whole concept of like TypeScript and a transpiler and web packaging and all the other stuff that's attached to modern web dev, I find exhausting.

00:21:33.900 --> 00:21:38.620
And because of that, I've kind of always headed towards Vue because it's a little lighter weight.

00:21:38.620 --> 00:21:41.260
But even then, I'm often doing things against recommendation.

00:21:41.260 --> 00:21:49.380
I have been known to serve Vue JavaScript files through the Django template engine so that I can embed JSON objects.

00:21:49.380 --> 00:21:52.360
And that's a no-no, but it's worked for me.

00:21:52.360 --> 00:22:00.680
But I often find with Vue, even though it's lighter weight, because it's written for folks who primarily use Node, there's some assumptions in the documentation.

00:22:00.680 --> 00:22:04.620
There's always this bit of a challenge to sort of get it to work in Django.

00:22:04.860 --> 00:22:09.040
And what I've, you know, I've gone back and looked at everywhere I've coded with Vue.

00:22:09.580 --> 00:22:18.100
HTMX solves like 95% to 99% of the things that I would have done with Vue, that I've done with Vue in the past.

00:22:18.100 --> 00:22:22.900
And the only exception was I once wrote a drag and drop card game.

00:22:23.560 --> 00:22:29.980
And I don't know if I could do that in HTMX, but pretty much everything else I could replace with HTMX.

00:22:29.980 --> 00:22:33.140
And the amount of code I'd have to write would be a lot less.

00:22:33.140 --> 00:22:38.040
The amount of JavaScript I'd have to write, which I've always sort of felt is a necessary evil.

00:22:38.040 --> 00:22:40.140
It would almost just go away.

00:22:40.140 --> 00:22:43.320
And now it would be unnecessary and still evil.

00:22:43.320 --> 00:22:45.920
But yeah, that's me on my soapbox.

00:22:45.920 --> 00:22:48.500
So yeah, that's the short version of it.

00:22:48.500 --> 00:22:49.720
You've played with it a bit.

00:22:49.720 --> 00:22:50.780
Did I miss anything?

00:22:50.780 --> 00:22:51.700
Something you should highlight?

00:22:51.700 --> 00:22:53.640
No, I think that was a really great summary.

00:22:53.640 --> 00:23:00.940
The one thing I would like to throw out there that is not immediately apparent to people, but is a tremendous advantage of HTMX,

00:23:00.940 --> 00:23:09.380
is that typical web development puts you into different mindsets for different parts of the application and context.

00:23:09.380 --> 00:23:10.940
So I'm working on the database.

00:23:10.940 --> 00:23:14.120
So I've got to think about database access and security in that context.

00:23:14.120 --> 00:23:15.960
Now I'm working on server-side code.

00:23:15.960 --> 00:23:17.060
And what can I do on the server?

00:23:17.060 --> 00:23:19.440
What kind of code can I run on the server?

00:23:19.440 --> 00:23:20.800
What packages do I have available?

00:23:21.220 --> 00:23:22.240
Now I'm on the client side.

00:23:22.240 --> 00:23:23.400
I can't do direct stuff.

00:23:23.400 --> 00:23:25.780
I have to have an API to interact with the server.

00:23:25.780 --> 00:23:27.080
So how do I build the API?

00:23:27.080 --> 00:23:31.980
And there's all the restrictions of the code, regardless whether it's JavaScript or something else, in the front end.

00:23:31.980 --> 00:23:35.800
And so you have these context switches of like, where are you in the app?

00:23:35.800 --> 00:23:38.160
And with HTMX, it's like, everything's on the server.

00:23:38.160 --> 00:23:39.580
Everything's in one language.

00:23:39.580 --> 00:23:41.340
Everything's in Python and Django.

00:23:41.540 --> 00:23:46.880
And whatever you do, you do it in Python and Django in this context or whatever your web framework is.

00:23:46.880 --> 00:23:50.540
And the title of the course, Hold the JavaScript.

00:23:50.540 --> 00:23:58.220
When I did the original Flask course, I got a bunch of flack from somebody on the thing that artists formerly known as Twitter.

00:23:58.600 --> 00:24:00.600
Like, why are you hating on JavaScript?

00:24:00.600 --> 00:24:02.520
This is just not what the world needs.

00:24:02.520 --> 00:24:04.000
I'm like, I'm not hating on JavaScript.

00:24:04.000 --> 00:24:08.740
I'm hating on the idea of having to write in three or four languages to accomplish one thing.

00:24:08.820 --> 00:24:13.660
And evidence of this, like, evidence of this benefit is it's popular in the node community.

00:24:13.660 --> 00:24:14.500
Right?

00:24:14.500 --> 00:24:16.560
It's popular in the JavaScript community.

00:24:16.560 --> 00:24:18.140
And they don't hate JavaScript.

00:24:18.140 --> 00:24:28.860
But they, like us, would also like to not have two different styles of JavaScript, two different modes of JavaScript, two different contexts of code execution in just one place.

00:24:28.860 --> 00:24:33.700
And I think it's easy to see, like, oh, how does this do something similar but cleaner than React?

00:24:33.700 --> 00:24:37.960
It also transforms, like, where and how your code runs.

00:24:38.020 --> 00:24:39.620
And I think that's really a big deal.

00:24:39.620 --> 00:24:39.960
Yeah.

00:24:39.960 --> 00:24:42.740
Well, at risk of getting too far off topic, right?

00:24:42.740 --> 00:24:45.540
Like, the web is a giant house of cards.

00:24:45.540 --> 00:24:47.120
And it always has been.

00:24:47.120 --> 00:24:51.940
And our answer every single time has been, oh, let's add another layer of cards.

00:24:51.940 --> 00:24:55.740
And we've been adding layers of cards for, you know, 20 years.

00:24:55.740 --> 00:24:58.160
And it's shaky in places, right?

00:24:58.160 --> 00:25:04.220
So anything that takes a couple layers off the top and simplifies how you think about things, I think, is definitely a benefit.

00:25:04.220 --> 00:25:07.220
And like you said, HTMX is tool agnostic.

00:25:07.220 --> 00:25:08.100
It's still agnostic, right?

00:25:08.100 --> 00:25:10.560
So it's got nothing to do with Python.

00:25:10.560 --> 00:25:13.220
It works with whatever your stack is.

00:25:13.220 --> 00:25:15.860
And that in itself is something that is a thing of beauty.

00:25:15.860 --> 00:25:19.680
Because if you're a node person, knock yourself out, right?

00:25:19.680 --> 00:25:21.880
You want to PHP, whatever.

00:25:21.880 --> 00:25:22.540
Go for it.

00:25:22.540 --> 00:25:23.720
It doesn't matter.

00:25:23.820 --> 00:25:33.800
Because essentially, it's back to the fundamental idea that HTML is based on, which is that hypertext concept of I click on something, it goes and gets a new thing and it puts it in the page.

00:25:33.800 --> 00:25:37.380
And in this case, instead of it being the whole page, it's a partial.

00:25:37.620 --> 00:25:39.140
It's a powerful, powerful tool.

00:25:39.140 --> 00:25:39.560
Indeed.

00:25:39.560 --> 00:25:43.020
Just to kind of put a finalize this whole thought here.

00:25:43.020 --> 00:25:44.700
It's like, so Mark's out there in the audience asking.

00:25:44.700 --> 00:25:48.020
So most business cases, use cases can be solved with HTMX.

00:25:48.020 --> 00:25:49.580
My vote is, yeah.

00:25:49.720 --> 00:25:52.100
Especially if you put business use cases.

00:25:52.100 --> 00:25:57.360
If you're writing forms over data, like sort of enterprise-y apps, like 99%, right?

00:25:57.360 --> 00:25:58.380
All the crud stuff.

00:25:58.380 --> 00:26:05.500
Like I said, I think the only thing I would, the only place it doesn't really fit is when you're getting to the level of something like games.

00:26:05.500 --> 00:26:12.800
And in fact, so we'll talk about it briefly, but there's a white paper on HTMX.org that talks about one of the companies that actually did a conversion.

00:26:13.420 --> 00:26:21.640
And, you know, they had a fully running site and converted it over to HTMX and they had some big wins by doing that.

00:26:21.640 --> 00:26:23.120
Could come back to it in a minute.

00:26:23.120 --> 00:26:28.920
But I'm hard pressed to think of a business use case that wouldn't be improved by using HTMX instead.

00:26:28.920 --> 00:26:29.340
Yeah.

00:26:29.340 --> 00:26:33.820
And it's so simple that like a lot of times the use case was, well, just the web app.

00:26:33.820 --> 00:26:34.760
It's not dynamic.

00:26:34.760 --> 00:26:35.660
It doesn't do that.

00:26:35.660 --> 00:26:42.760
You can add a lot of cool dynamic features to an existing app rather than like, oh, we have this really complex React app

00:26:42.760 --> 00:26:43.540
that we're going to simplify.

00:26:43.540 --> 00:26:47.960
I imagine usually it's kind of like a lift up the feature set then bring down as well there.

00:26:47.960 --> 00:26:50.960
Some of this comes out of things like HTML5 as well, right?

00:26:50.960 --> 00:26:57.220
So having email type on your input field means that there's a certain amount of validation that's happening in the browser now, right?

00:26:57.220 --> 00:27:01.820
So things that we used to have to do in JavaScript, now the browser is taking care of some of that.

00:27:01.820 --> 00:27:09.140
So by taking some of those kinds of features, you know, I don't have to have that check manually written on the browser side anymore.

00:27:09.140 --> 00:27:14.280
And then adding HTMX to give that dynamicism, it just sort of tops it up, right?

00:27:14.280 --> 00:27:16.060
So it's like I said, it's a step forward.

00:27:16.240 --> 00:27:22.580
The one other area where HTMX seems like it's just not going to work is if you want to build offline progressive web apps.

00:27:22.580 --> 00:27:26.280
Because offline is like the antithesis of HTMX.

00:27:26.280 --> 00:27:26.500
Yeah.

00:27:26.600 --> 00:27:38.800
So what I thought we could do for our conversation here would be to focus on just a bunch of tools that people can bring to bear on making working mostly with Django,

00:27:38.800 --> 00:27:44.520
but also some of the other web frameworks like other Python web frameworks and HTMX together make that more seamless.

00:27:44.520 --> 00:27:48.500
And we worked together to put together quite a list here, didn't we?

00:27:48.500 --> 00:27:51.320
So there's two awesome lists we'll talk about.

00:27:51.320 --> 00:27:57.540
So the 95% of what we're talking about, we found sourced off of these two curated lists.

00:27:57.540 --> 00:27:59.820
The first one's called awesome HTMX.

00:27:59.820 --> 00:28:04.240
And the second one is called awesome Python HTMX.

00:28:04.240 --> 00:28:07.740
The first one is a collection of all languages.

00:28:07.740 --> 00:28:09.900
So it's got a section on Python.

00:28:09.900 --> 00:28:13.960
But, you know, as we were saying, if you're right there, HTMX from Rails.

00:28:13.960 --> 00:28:19.700
So if you're coming from somewhere else and you want to use HTMX, there's a whole lot of pieces in here.

00:28:20.280 --> 00:28:25.140
And it ranges from things like tools and articles and that kind of stuff.

00:28:25.140 --> 00:28:30.140
The second one is a Python specific one, which is awesome Python HTMX.

00:28:30.140 --> 00:28:32.140
They call themselves PyHat.

00:28:32.140 --> 00:28:35.480
A little bit overlap between the tool sets.

00:28:35.480 --> 00:28:44.340
But again, this is just sort of some master lists for the places you can go and get content and examples and all that kind of good stuff.

00:28:44.680 --> 00:28:52.800
And in fact, one of the first white papers that I wanted to talk about a little bit is on the awesome Python HTMX list.

00:28:52.800 --> 00:28:55.560
As I mentioned, there's a link to it on this list.

00:28:55.940 --> 00:29:00.520
And as I mentioned, this is actually a case study off of HTMX.org.

00:29:00.520 --> 00:29:04.020
It was presented at a Django con in 2022.

00:29:04.020 --> 00:29:07.160
So if you don't feel like reading, you can go off and see the video.

00:29:07.160 --> 00:29:08.820
But it's about a conversion.

00:29:09.300 --> 00:29:16.680
And it took them about two months to completely convert from a React based site to HTMX.

00:29:16.680 --> 00:29:19.900
They had zero reduction in functionality.

00:29:19.900 --> 00:29:23.160
67% reduction in the size of the code base.

00:29:23.160 --> 00:29:24.740
So that's significant, right?

00:29:24.800 --> 00:29:28.960
Like that's two thirds of your code you no longer have to maintain because it's gone.

00:29:28.960 --> 00:29:32.560
Increase the Python code by 140%, right?

00:29:32.560 --> 00:29:33.980
So that's sort of the tradeoff, right?

00:29:33.980 --> 00:29:37.220
We were moving some of that JavaScript stuff onto the server side.

00:29:37.220 --> 00:29:43.900
They reduced their total JavaScript dependencies by 96%, which essentially means it's almost gone.

00:29:43.900 --> 00:29:49.500
As a result of that, they had shorter web build times, shorter page loads, less memory.

00:29:49.500 --> 00:29:54.020
And because of the less memory, they were also able to handle larger data sets.

00:29:54.020 --> 00:29:59.960
So they were able to put more content on the page at a time using HTMX than React

00:29:59.960 --> 00:30:06.080
because the amount of overhead React put on the page meant it was eating up space and it just couldn't handle it.

00:30:06.080 --> 00:30:07.100
It's one white paper.

00:30:07.100 --> 00:30:09.640
And of course, it's on the HTMX.org site.

00:30:09.640 --> 00:30:12.440
So of course, it's going to be biased towards you should use HTMX.

00:30:12.440 --> 00:30:16.980
It does show that this is being used in the real world and with a lot of success.

00:30:16.980 --> 00:30:19.460
It's definitely something that you kind of want to look at.

00:30:19.460 --> 00:30:25.100
I can't remember if I sent you the link, but there's another one recently that showed up on ByteCode.

00:30:25.100 --> 00:30:30.100
This is a site that frequently linked to in the PyCoder newsletter.

00:30:30.100 --> 00:30:33.420
A lot of really good content with the ByteCode guy there.

00:30:33.420 --> 00:30:36.020
He's done something called...

00:30:36.020 --> 00:30:36.640
Nope, that's not it.

00:30:36.640 --> 00:30:43.100
It's three in real life use cases for Python and HTMX.

00:30:43.100 --> 00:30:44.160
It's Byte with an I.

00:30:44.160 --> 00:30:44.640
That's why.

00:30:44.640 --> 00:30:46.520
It's the other kind of Byte.

00:30:46.520 --> 00:30:47.540
He's a little cranky.

00:30:47.540 --> 00:30:50.700
This is more of an anecdote than case study.

00:30:50.700 --> 00:30:58.760
But essentially, he's gone through three kinds of projects that he's recently done with Python that are web-based and went,

00:30:58.760 --> 00:31:00.340
oh, let's use HTMX instead.

00:31:00.340 --> 00:31:02.040
And it's made his life easier.

00:31:02.040 --> 00:31:06.340
And so essentially, he's just saying, hey, here are some cases where I've actually done this and it's been useful.

00:31:06.860 --> 00:31:12.240
To the question we got earlier, really, it is that sort of, hey, I've got a form and I want the form to be slightly more dynamic.

00:31:12.240 --> 00:31:15.660
So, hey, it would be an awful lot easier if I just stick this in and go.

00:31:15.660 --> 00:31:19.560
And if I remember correctly, he's using FastAPI with this as well, right?

00:31:19.560 --> 00:31:21.640
So it's not just Django or Flask.

00:31:21.640 --> 00:31:23.860
There's lots of choices out there.

00:31:23.860 --> 00:31:24.620
Yeah, it works really well.

00:31:24.780 --> 00:31:26.260
Yeah, he's using FastAPI.

00:31:26.260 --> 00:31:28.780
FastAPI works equally well with it.

00:31:28.780 --> 00:31:31.920
And some of the tools we'll talk about are relevant as well.

00:31:31.920 --> 00:31:33.260
So very cool.

00:31:35.560 --> 00:31:38.280
This portion of Talk Python is brought to you by Sentry.

00:31:38.280 --> 00:31:44.360
You've heard me sing the praises of Sentry for their error tracking and performance monitoring plenty of times on the show.

00:31:44.360 --> 00:31:46.080
But this time is different.

00:31:46.080 --> 00:31:55.800
They have a special live event, like a mini online conference, where you can connect with the team and take a deep dive into different products and services every day for a week.

00:31:55.800 --> 00:32:03.160
Join them for launch week, new product releases, exclusive demos, and discussions with experts from their community on the latest with Sentry.

00:32:03.340 --> 00:32:07.500
You'll see how Sentry's latest product updates can make your work life easier.

00:32:07.500 --> 00:32:13.280
New announcements will be released every day on YouTube at exactly 9 a.m. Pacific time.

00:32:13.280 --> 00:32:16.200
On Monday, November 13th, performance.

00:32:16.200 --> 00:32:18.880
Tuesday, user feedback and session replay.

00:32:18.880 --> 00:32:21.440
Wednesday, data resiliency and platform.

00:32:21.440 --> 00:32:24.520
Thursday, frameworks, community, and integrations.

00:32:24.520 --> 00:32:28.160
And finally, Friday, November 17th, open source sustainability.

00:32:28.160 --> 00:32:29.960
I'm already signed up.

00:32:29.960 --> 00:32:33.320
Join me at talkpython.fm/sentry.fm.

00:32:33.320 --> 00:32:34.740
Dash launch dash week.

00:32:34.740 --> 00:32:36.860
The link is in your podcast player show notes.

00:32:36.860 --> 00:32:37.960
I'll see you there.

00:32:37.960 --> 00:32:41.880
Thank you to Sentry for their continued support of Talk Python To Me.

00:32:44.180 --> 00:32:47.800
Some other things on the list I'm just seeing on the screen right now is like there's an IntelliJ,

00:32:47.800 --> 00:32:51.080
aka PyCharm, plug-in for HTMX.

00:32:51.080 --> 00:32:56.060
So it gives you autocomplete for all your HTMX stuff and probably for VS Code as well.

00:32:56.060 --> 00:33:00.740
So if you're going to use one of those editors and do HTMX, you know, be sure to install that

00:33:00.740 --> 00:33:04.220
so you get autocomplete and validation for the different things.

00:33:04.220 --> 00:33:04.940
So cool.

00:33:04.940 --> 00:33:05.220
All right.

00:33:05.240 --> 00:33:10.460
Well, let's talk about maybe the big first one, Django dash HTMX.

00:33:10.460 --> 00:33:14.200
Just brought under extensions for using Django with HTMX.

00:33:14.200 --> 00:33:15.560
So this is the go-to.

00:33:15.560 --> 00:33:20.520
This is not only is this the right way to do things, but this is also, in fact, talk about

00:33:20.520 --> 00:33:22.960
this in the Django version of the course.

00:33:23.120 --> 00:33:27.420
There's also about a half dozen libraries out there that all said, oh, we're just going to

00:33:27.420 --> 00:33:30.360
do what he did, but we're going to do it for our library.

00:33:30.360 --> 00:33:32.740
So this has been an inspiration to other folks as well.

00:33:32.740 --> 00:33:38.840
It's by a gentleman named Adam Johnson, and it's essentially some Django middleware and some

00:33:38.840 --> 00:33:39.700
utility classes.

00:33:39.700 --> 00:33:43.200
So in Django, each view gets a request object.

00:33:43.200 --> 00:33:47.480
This library adds a member to that request object called HTMX.

00:33:47.480 --> 00:33:51.120
You can use that member as a Boolean.

00:33:51.120 --> 00:33:55.500
And if it evaluates to true, then it was there's an HTMX header.

00:33:55.500 --> 00:33:56.820
So it was an HTMX call.

00:33:56.820 --> 00:33:58.820
And if it's false, it wasn't.

00:33:58.820 --> 00:34:03.380
So this is what I was referring to earlier about that idea of being able to have one view

00:34:03.380 --> 00:34:07.960
manage multiple things, because essentially you just check this Boolean and either I'm

00:34:07.960 --> 00:34:10.700
feeding out the full page or I'm feeding out the partial.

00:34:10.700 --> 00:34:11.000
Right.

00:34:11.000 --> 00:34:15.760
Because the big concept in HTMX is there'll be a request for the page, which shows you the

00:34:15.760 --> 00:34:16.140
whole thing.

00:34:16.140 --> 00:34:18.440
But an interaction won't want all the page content.

00:34:18.440 --> 00:34:22.640
They just want the fragment that the new version of the fragment, like the new table

00:34:22.640 --> 00:34:25.220
row that has been edited or something like that.

00:34:25.220 --> 00:34:25.360
Right.

00:34:25.360 --> 00:34:25.680
That's right.

00:34:25.680 --> 00:34:25.920
Yeah.

00:34:25.920 --> 00:34:29.300
On the server, you got to decide what version do I give them?

00:34:29.300 --> 00:34:30.600
This answers that question.

00:34:30.600 --> 00:34:31.180
Exactly.

00:34:31.180 --> 00:34:35.840
And this is so, you know, to take it back to the click to edit example that we talked about

00:34:35.840 --> 00:34:36.380
at the top.

00:34:36.480 --> 00:34:39.300
You know, the first call to the page, no HTMX.

00:34:39.300 --> 00:34:43.820
It shows the content of the page, including the person's name and email address or whatever

00:34:43.820 --> 00:34:44.240
it is.

00:34:44.240 --> 00:34:48.200
And then when somebody clicks the link and that needs to be replaced by the form, you can use

00:34:48.200 --> 00:34:49.060
the same view.

00:34:49.060 --> 00:34:53.080
And that view then just returns the form as a partial rather than the whole thing.

00:34:53.080 --> 00:34:57.880
And so checking this Boolean allows you to tell which mode am I in and how do I want to

00:34:57.880 --> 00:34:58.340
do that?

00:34:58.620 --> 00:35:00.540
There's other information on as well.

00:35:00.540 --> 00:35:03.560
So you can check things like the target and the triggers.

00:35:03.560 --> 00:35:04.840
So these are other attributes.

00:35:04.840 --> 00:35:07.660
Didn't mention the triggers when I sort of explained things at the top.

00:35:07.660 --> 00:35:11.600
The trigger is that event management piece that I was talking about with like searches

00:35:11.600 --> 00:35:12.760
you type.

00:35:12.760 --> 00:35:18.180
So the trigger says a key press or there's another one that allows you to do on scroll down.

00:35:18.180 --> 00:35:18.400
Right.

00:35:18.400 --> 00:35:21.860
So when the tag is revealed, then trigger the call.

00:35:22.480 --> 00:35:27.520
So the Django HTMX will give you information about what the event was, what triggered, how

00:35:27.520 --> 00:35:28.320
it worked, et cetera.

00:35:28.320 --> 00:35:33.420
So if you need to make decisions or if you've got multiple HTMX things happening inside the

00:35:33.420 --> 00:35:35.900
same page, you can suss it out that way.

00:35:35.900 --> 00:35:40.980
Quite frankly, the Boolean mechanism is enough for me to want to install this library.

00:35:40.980 --> 00:35:47.000
The rest of it I don't use very often, but just being able to check which mode I'm in and

00:35:47.000 --> 00:35:50.400
not have to check that header myself is worth installing the library.

00:35:51.060 --> 00:35:56.820
And it feels very, very Django-esque because it essentially just replaces that get post pattern

00:35:56.820 --> 00:36:00.000
that I was talking about earlier, but instead with HTMX.

00:36:00.000 --> 00:36:02.900
There's also some other utilities in here.

00:36:02.900 --> 00:36:09.120
The way that HTMX works, if a URL is hit, that's a 404, it just eats it.

00:36:09.120 --> 00:36:13.400
There's a chunk of debug JavaScript that comes with this library that you can put in so that

00:36:13.400 --> 00:36:15.460
you actually get the Django 404 page.

00:36:15.460 --> 00:36:22.140
So it essentially overrides the response back from the view and spits out an actual debug

00:36:22.140 --> 00:36:23.460
page that you're used to.

00:36:23.460 --> 00:36:26.460
So it allows you to debug your HTMX a little better.

00:36:26.460 --> 00:36:32.080
And then there's some classes and functions for things like polling and controlling redirects

00:36:32.080 --> 00:36:35.960
and a few other things that are also useful for typing as well.

00:36:35.960 --> 00:36:36.220
Right.

00:36:36.220 --> 00:36:40.780
So if you're doing a type check that you want to replace, that this call comes back

00:36:40.780 --> 00:36:45.940
with HTMX, then you can put it inside of your typing that this is this kind of class that

00:36:45.940 --> 00:36:46.400
comes back.

00:36:46.400 --> 00:36:48.280
So very, very handy library.

00:36:48.280 --> 00:36:53.360
Very strongly recommended that if you're doing Django and HTMX, this is the place to go.

00:36:53.360 --> 00:36:53.760
Okay.

00:36:53.760 --> 00:36:55.040
This is the big one.

00:36:55.040 --> 00:36:55.360
All right.

00:36:55.360 --> 00:36:56.120
Next up.

00:36:56.440 --> 00:36:59.600
This is from the multilingual awesome list.

00:36:59.600 --> 00:37:02.480
Django JS lib HTMX.

00:37:02.480 --> 00:37:04.120
So this one's pretty lightweight.

00:37:04.120 --> 00:37:08.520
It pretty much allows you to use tags to drop the library in.

00:37:08.520 --> 00:37:13.340
So it essentially just means you're scriptifying some of the things that you're using in the

00:37:13.340 --> 00:37:13.700
library.

00:37:13.700 --> 00:37:15.360
I haven't used it myself.

00:37:15.360 --> 00:37:19.380
I think a lot of it depends on how deep your pages have to go.

00:37:19.380 --> 00:37:22.200
Personally, I would just stick this in and hard code it myself.

00:37:22.200 --> 00:37:23.420
It's there if you want it.

00:37:23.420 --> 00:37:23.660
Yep.

00:37:23.660 --> 00:37:24.440
Sounds good.

00:37:24.440 --> 00:37:25.940
HTMX Flask.

00:37:25.940 --> 00:37:27.500
This one, I think, is really interesting.

00:37:27.500 --> 00:37:29.300
And you might be saying, like, well, why do I?

00:37:29.300 --> 00:37:30.440
It's Django we're talking about.

00:37:30.440 --> 00:37:31.200
Why do I care about Flask?

00:37:31.200 --> 00:37:35.520
But we already went through two of the examples on the HTMX.org site.

00:37:35.520 --> 00:37:37.740
And what you see is the client side.

00:37:37.740 --> 00:37:41.720
But there's no visibility to what the server side looks like in that example code.

00:37:41.720 --> 00:37:43.740
But this, this will help maybe.

00:37:43.740 --> 00:37:49.240
There are three things called HTMX Flask, Flask HTMX, and Flask HTMX with a capital.

00:37:49.240 --> 00:37:53.800
So they all start to blur together.

00:37:53.800 --> 00:37:53.960
There.

00:37:53.960 --> 00:37:54.620
Yes.

00:37:54.620 --> 00:37:59.340
This one is essentially if you at the top, if you're not listening, if you were watching,

00:37:59.340 --> 00:38:03.300
Michael showed the HTMX site and a couple of the examples.

00:38:03.780 --> 00:38:06.440
This is a Flask S.

00:38:06.440 --> 00:38:09.440
They've redone all of those examples from the server in Flask.

00:38:09.440 --> 00:38:17.720
So if you're looking for how to implement these things rather than just in pure HTML and you want to see them in the Flask server, you can go that here.

00:38:17.720 --> 00:38:27.160
And because it ties back to the actual HTMX.org page, it allows you to sort of see how all the pieces fit and look your code up as you go.

00:38:27.320 --> 00:38:34.840
Yeah, I think the examples are really awesome and simple on HTMX.org, but they don't, they don't tell the whole story if you're trying to actually implement it.

00:38:34.840 --> 00:38:38.180
And if you're like, I just don't really know how to do that with my web framework.

00:38:38.180 --> 00:38:41.420
Here's at least a Python set of examples that'll get you pretty close.

00:38:41.420 --> 00:38:41.740
Yeah.

00:38:41.740 --> 00:38:43.240
There's a few of these as well.

00:38:43.240 --> 00:38:50.680
Near the tail end here, we'll talk about a couple others that there's one which is actually a board game, which is a nice top to bottom full example.

00:38:51.160 --> 00:38:56.000
But this one essentially relates the example content off the HTMX site to your Flask server.

00:38:56.000 --> 00:38:56.360
Nice.

00:38:56.360 --> 00:38:56.960
All right.

00:38:56.960 --> 00:38:58.680
Server sent events.

00:38:58.680 --> 00:39:04.240
If you're using Starlette, this is a tech demo essentially by Jan Vlasinski.

00:39:04.240 --> 00:39:09.440
And essentially he's using FastAPI, HTMX and Starlette.

00:39:09.440 --> 00:39:12.760
And pages, the example is actually quite simple.

00:39:12.760 --> 00:39:14.740
There's almost no content on it.

00:39:14.740 --> 00:39:16.900
It's just a little bit of, it almost looks like debug.

00:39:17.480 --> 00:39:22.360
So there's a few variables which are randomly generated inside of an asynchronous call on the server.

00:39:22.360 --> 00:39:24.060
You run it using Yuvacorn.

00:39:24.060 --> 00:39:28.240
And essentially when you visit the page, the values update on the fly.

00:39:28.240 --> 00:39:31.700
So the sleep in the server code is pretty short.

00:39:31.700 --> 00:39:33.040
It's about a third of a second.

00:39:33.040 --> 00:39:36.220
So the debug messages go flying by rather quickly.

00:39:36.220 --> 00:39:36.980
I bet they do.

00:39:36.980 --> 00:39:40.940
But it gives you an idea essentially how to wire these kinds of things together.

00:39:40.940 --> 00:39:42.760
I've never used Starlette myself.

00:39:42.760 --> 00:39:44.020
Have you played with it at all?

00:39:44.020 --> 00:39:49.000
Only by way of using FastAPI and LightStar.

00:39:49.000 --> 00:39:49.500
Okay.

00:39:49.500 --> 00:39:52.700
So they're both built on top of it, but not directly.

00:39:52.700 --> 00:40:00.980
But, you know, server sent events are interesting because we've had traditional web interaction, which we kind of talked about already.

00:40:01.360 --> 00:40:06.320
And then you've got web sockets for super dynamic bidirectional communication.

00:40:06.320 --> 00:40:14.040
But a lot of times people use web sockets because they just want to receive stuff that happens on the server on the client, like a dashboard, right?

00:40:14.040 --> 00:40:16.620
The dashboard doesn't need to update the server and broadcast.

00:40:16.620 --> 00:40:19.000
It just wants all its pieces update live.

00:40:19.380 --> 00:40:22.540
And so servers and events are like a lightweight web socket type thing.

00:40:22.540 --> 00:40:25.700
And it's really cool to be able to plug that in with HTMX, I think.

00:40:25.700 --> 00:40:26.080
Yeah.

00:40:26.080 --> 00:40:29.280
I haven't played with it myself, but HTMX also has a polling mechanism.

00:40:29.280 --> 00:40:34.780
So if you're not using technology on the server side that can enable this, you can get around it the other way.

00:40:35.240 --> 00:40:39.400
Obviously, an event from the server is far less noisy than polling.

00:40:39.400 --> 00:40:42.240
But by using, it basically gives you a couple different options.

00:40:42.240 --> 00:40:53.020
So if you happen to be using something that isn't asynchronous and you don't want to go all the way down that path, you could also look at the polling techniques inside of HTMX to get you to solve similar kinds of problems.

00:40:53.020 --> 00:40:53.360
Yeah.

00:40:53.360 --> 00:40:57.820
If you're not building a massively busy website, maybe it's totally fine to just pull it, right?

00:40:57.820 --> 00:40:58.120
Yeah.

00:40:58.120 --> 00:41:00.660
Well, some of it also has to do with the frequency, right?

00:41:00.660 --> 00:41:07.140
Like if it's data that only needs to update, you know, once every 30 seconds or so, then while somebody's on a page, that might be the right way to go.

00:41:07.140 --> 00:41:07.400
Yep.

00:41:07.400 --> 00:41:08.120
All right.

00:41:08.120 --> 00:41:12.780
Now, we'll start pulling some items off the Pi Hat.

00:41:12.780 --> 00:41:13.220
Sure.

00:41:13.220 --> 00:41:14.440
Pi Hat example on here.

00:41:14.440 --> 00:41:14.680
Yeah.

00:41:14.680 --> 00:41:15.660
Another list here.

00:41:15.660 --> 00:41:17.560
We started talking a little bit about this.

00:41:17.560 --> 00:41:18.580
I've been hopping around a bit.

00:41:18.580 --> 00:41:24.680
So that white paper that I talked about is on here and a bunch of some of the other tools that we've got as well.

00:41:24.680 --> 00:41:32.080
Good overall list has some sort of a nice breakdown that it's got sort of the resources as in like, here are some articles you can read.

00:41:32.080 --> 00:41:34.880
They've got a link to your Flask course.

00:41:34.880 --> 00:41:36.880
So I think we need to do a PR here.

00:41:36.880 --> 00:41:38.500
And we definitely got to do a PR.

00:41:38.500 --> 00:41:40.920
And I appreciate the Jenga one in there.

00:41:40.920 --> 00:41:41.960
We do.

00:41:41.960 --> 00:41:43.840
I appreciate however this got here.

00:41:43.840 --> 00:41:44.820
Thank you, people.

00:41:44.820 --> 00:41:45.160
Yep.

00:41:45.160 --> 00:41:46.400
But yeah, we got to do a PR.

00:41:46.400 --> 00:41:50.440
So some good links in here to some obviously to some quality content.

00:41:50.440 --> 00:41:52.760
That's right.

00:41:52.760 --> 00:41:53.620
That's right.

00:41:53.980 --> 00:41:54.380
Yeah.

00:41:54.380 --> 00:41:56.220
So there's a bunch of different ones in here.

00:41:56.220 --> 00:42:05.120
I think probably the helper libraries is the section that has like really what people are imagining when they're thinking awesome lists, at least awesome lists for programming.

00:42:05.120 --> 00:42:07.700
So make a like.

00:42:07.700 --> 00:42:08.100
Yeah.

00:42:08.100 --> 00:42:14.500
In fact, so there's three on here that I think I'm going to want to sort of cover back to back because they're all essentially the same idea.

00:42:14.500 --> 00:42:20.420
So I mentioned that Django HTMX is like is sort of the go to way of doing the Django stuff.

00:42:20.420 --> 00:42:22.240
And it inspired a bunch of other people.

00:42:22.240 --> 00:42:26.960
Well, there's ASGI HTMX, Starlette HTMX and HTMX Flask.

00:42:26.960 --> 00:42:28.880
And all three of these.

00:42:28.880 --> 00:42:31.060
Sorry, I'm flapping around as we go along.

00:42:31.060 --> 00:42:32.240
You're trying to keep up.

00:42:32.800 --> 00:42:39.260
So all three of these are essentially like the Django HTMX library, but for those appropriate other libraries.

00:42:39.260 --> 00:42:46.760
So they essentially add that meta information to the requests or in the case of ASGI to the scope.

00:42:46.760 --> 00:42:48.300
And it's the same kind of thing.

00:42:48.300 --> 00:42:51.100
It gives you an idea of what the header is there and what the other information is.

00:42:51.180 --> 00:43:01.720
So if you're if you're not on Django, if you're on Flask, then HTMX Flask or ASGI HTMX will work and essentially solve the same kind of problems that Django HTMX does.

00:43:01.840 --> 00:43:04.820
And all three of those are listed on that pie hat piece.

00:43:04.820 --> 00:43:08.640
So that's ASGI HTMX is by Flormon Monka.

00:43:08.640 --> 00:43:11.580
Starlette HTMX is by Felix Ingram.

00:43:11.580 --> 00:43:16.820
And HTMX Flask is by Sergey Ponsfrixis.

00:43:16.820 --> 00:43:18.540
Not sure how to say his last name there.

00:43:18.540 --> 00:43:18.900
Yeah.

00:43:18.980 --> 00:43:20.840
A lot of good work going on in this space.

00:43:20.840 --> 00:43:21.300
All right.

00:43:21.300 --> 00:43:23.160
How about Django HTMX patterns?

00:43:23.160 --> 00:43:24.340
Ah, yes.

00:43:24.340 --> 00:43:25.620
Good old spooky Lukey.

00:43:25.620 --> 00:43:28.620
So he's got an awesome GitHub handle here.

00:43:28.620 --> 00:43:35.560
This is Luke Plant, who is or was, I'm not sure the time frame on that, but was heavily involved with Django.

00:43:35.560 --> 00:43:36.900
He was a core developer for a while.

00:43:36.900 --> 00:43:43.520
And essentially, he's written up a article here on good ways of interacting with Django and HTMX.

00:43:43.520 --> 00:43:45.780
There's some code examples to go with it.

00:43:46.080 --> 00:43:49.660
We're going to talk in a minute about the block, render block library.

00:43:49.660 --> 00:43:51.340
He's a fan of that approach.

00:43:51.340 --> 00:43:55.980
Essentially, this has got good reasons for how you group your snippets together.

00:43:55.980 --> 00:44:02.920
That idea of having your code and all your code in the same view, as well as keeping your snippets, possibly even the same file.

00:44:02.920 --> 00:44:10.100
He talks about these kinds of things, as well as sort of hands you off to some of the toolkits that we're talking about as well to help you do this.

00:44:10.100 --> 00:44:11.140
I'm a fan.

00:44:11.140 --> 00:44:14.980
He's also got a great article called Django views the right way, which is,

00:44:15.280 --> 00:44:17.920
He tends to write fairly opinionated pieces.

00:44:17.920 --> 00:44:21.040
And of course, when you agree with his opinion, that's fantastic.

00:44:21.040 --> 00:44:21.820
He must be brilliant.

00:44:21.820 --> 00:44:25.180
So he's very...

00:44:25.180 --> 00:44:26.840
Finally, someone's standing up for our way of thinking.

00:44:26.840 --> 00:44:27.460
Exactly.

00:44:27.460 --> 00:44:29.840
So he's very pro-function-based views.

00:44:29.840 --> 00:44:34.640
And for folks who aren't Django people, that's a Coke versus Pepsi thing versus class-based views.

00:44:34.640 --> 00:44:36.120
But because I tend to...

00:44:36.120 --> 00:44:37.600
My bias heads in that direction.

00:44:37.600 --> 00:44:38.400
He must be right.

00:44:38.540 --> 00:44:40.820
So everything else he's written is brilliant as well.

00:44:40.820 --> 00:44:50.180
So I've got a lot of good information in here to dig around some best practices, as well, as I said, to some references to the kinds of libraries we're talking about to make your life easier.

00:44:50.180 --> 00:44:50.440
Yeah.

00:44:50.540 --> 00:44:57.240
I think these kinds of things, like these pattern ideas, really help you think about, how am I going to add that into my application?

00:44:57.240 --> 00:44:57.900
Right.

00:44:57.900 --> 00:45:01.840
Instead of just, here's some libraries, and here's HTMX, and here's...

00:45:01.840 --> 00:45:03.560
How does it look right?

00:45:04.040 --> 00:45:08.180
How do you make your Django code better and cleaner by putting this stuff together?

00:45:08.180 --> 00:45:08.560
Yeah.

00:45:08.560 --> 00:45:14.960
Well, and honestly, like my tongue planted firmly in my cheek with the whole function versus class thing, notwithstanding.

00:45:14.960 --> 00:45:23.880
One of the things I love about these kinds of opinion pieces is it allows you to help sort of formulate, oh, does that fit in my version or does it not fit in my version?

00:45:23.880 --> 00:45:26.240
And how does this map to what I'm doing?

00:45:26.240 --> 00:45:30.280
It allows you to sort of think more deeply about the patterns that you're using as you're coding.

00:45:30.460 --> 00:45:36.840
You might leave an article like that and go, oh, now I understand more about why I chose what I did, and I'm going to stick with it.

00:45:36.840 --> 00:45:42.020
It might be the opposite of what that article is there, but it opens you up to other ways of thinking about these things, right?

00:45:42.020 --> 00:45:47.580
It comes from that practice of doing it rather than, like you said, just a couple quick examples.

00:45:47.580 --> 00:45:59.040
Another thing about patterns that I've always loved, design patterns, programming style, is when you think about a problem, if you just think about kind of the idea of the pattern, like what are the steps?

00:45:59.040 --> 00:46:00.740
It's hard to think about it.

00:46:00.740 --> 00:46:02.480
You're really down in the details.

00:46:02.480 --> 00:46:10.920
But if you can think about as the whole thing that the pattern applies to and what of its benefits and trade-offs, you can think at a much higher level.

00:46:10.920 --> 00:46:14.360
And sort of it lets you not think in detail, right?

00:46:14.360 --> 00:46:20.840
Like you could say, well, I want to have, you know, outside the web, you can say, I want to have a way where we just have one variable, just copy of it.

00:46:20.880 --> 00:46:25.120
It's just one and everybody shares it instead of passing it around like, okay.

00:46:25.120 --> 00:46:26.580
Or you could say, we have a singleton.

00:46:26.580 --> 00:46:27.140
Like, boom.

00:46:27.140 --> 00:46:31.020
Like that one statement, just what are the benefits?

00:46:31.020 --> 00:46:31.860
What are the drawbacks?

00:46:31.860 --> 00:46:32.720
What are the use cases?

00:46:32.720 --> 00:46:33.980
Like it's testing hard.

00:46:33.980 --> 00:46:36.560
It makes reuse really easy because you just grab it.

00:46:36.800 --> 00:46:39.940
And it's sort of like that for HTMX, right?

00:46:39.940 --> 00:46:41.880
As you think like, oh, this pattern applies right here.

00:46:41.880 --> 00:46:42.440
Let's go.

00:46:42.440 --> 00:46:44.260
Or it doesn't because of.

00:46:44.260 --> 00:46:46.900
And it becomes some of it's a vocabulary thing as well, right?

00:46:46.920 --> 00:46:53.360
So there's this concept we're going to spend a little bit of time talking about in a minute that is the partials, which is those little snippets that I was talking about.

00:46:53.360 --> 00:46:57.560
And in fact, if I remember correctly, the term partials has been stolen.

00:46:57.560 --> 00:46:59.260
It's something Rails uses, right?

00:46:59.260 --> 00:47:05.800
By using that same vocabulary, it allows you to sort of talk about these things, like you said, at that higher level concept, right?

00:47:05.800 --> 00:47:14.280
So that the patterns help with the vocabulary, help with you communicate about those concepts rather than spending the first 10 minutes of your conversation trying to establish whether or not you're talking about the same thing.

00:47:14.280 --> 00:47:15.020
Yes, exactly.

00:47:15.020 --> 00:47:15.540
Exactly.

00:47:16.020 --> 00:47:18.840
Speaking of, we have fragments and we have partials.

00:47:18.840 --> 00:47:23.820
And this is a little bit of an alternate, like this is a Coke versus Pepsi as well.

00:47:23.820 --> 00:47:29.360
Considering you're the maintainer of a sister library to this, maybe this one should be you.

00:47:29.360 --> 00:47:31.620
Maybe you want to talk a little bit about Jinja partials.

00:47:31.620 --> 00:47:43.160
Well, so my understanding here with the Jinja partials one is you can express parts of your page to contain the template data that you want.

00:47:43.240 --> 00:47:46.520
So for example, here's a whole thing, you know, with a HTML and a head and a body.

00:47:46.520 --> 00:47:49.940
And then it has one thing that says, this is a block and it says just a paragraph.

00:47:49.940 --> 00:47:51.700
This is the magic number with that value.

00:47:51.700 --> 00:47:59.480
With this thing, what you can do is you can say, just grab that thing we called content and provide the data over to it.

00:47:59.720 --> 00:48:00.720
Because I don't want to show the whole page.

00:48:00.720 --> 00:48:03.160
I want to show just this section of it.

00:48:03.160 --> 00:48:11.600
And there's an essay over on HTML.org, something about the locality of behavior and things like that.

00:48:11.600 --> 00:48:14.000
I believe it's something titled like that.

00:48:14.000 --> 00:48:20.220
And the idea is I have my entire HTML listed all in one as if it was a static page.

00:48:20.440 --> 00:48:26.980
And I can use the server side to grab pieces out of the HTML and make them dynamic sections, right?

00:48:26.980 --> 00:48:33.620
Like I described, like grab this block, render it using the template engine, the Jinja2 fragments.

00:48:33.620 --> 00:48:34.140
Okay.

00:48:34.140 --> 00:48:36.040
So that's the, I don't know, Coke?

00:48:36.040 --> 00:48:37.620
Coke or Pepsi?

00:48:37.620 --> 00:48:39.200
Who gets, which one does it get?

00:48:39.200 --> 00:48:41.520
Let's call this one the Coke style.

00:48:41.640 --> 00:48:43.080
And that, I think, is really useful, right?

00:48:43.080 --> 00:48:44.640
Because what is your alternative?

00:48:44.640 --> 00:48:46.620
Have that HTML in two places?

00:48:46.620 --> 00:48:48.640
That's not a great option, right?

00:48:48.640 --> 00:48:50.960
You don't want to have, it's just like you wouldn't duplicate code.

00:48:50.960 --> 00:48:55.520
You don't want to duplicate the design and the HTML and stuff that makes up the part of the page

00:48:55.520 --> 00:49:00.240
and have inline for the main one and then a second copy just so you can make it dynamic.

00:49:00.240 --> 00:49:01.660
So I'm not against this.

00:49:01.660 --> 00:49:07.700
I think this is really a neat idea here to be able to grab that section and render that.

00:49:07.700 --> 00:49:08.520
Pepsi side.

00:49:08.980 --> 00:49:14.660
Michael's library called Jinja Partials, which says, instead of putting it all into one big place,

00:49:14.660 --> 00:49:17.980
let's treat it more like function-based programming.

00:49:17.980 --> 00:49:26.300
So what you can do is you can say, I'm going to define an HTML partial or piece that just has

00:49:26.300 --> 00:49:28.860
that section that you're interested in, right?

00:49:28.860 --> 00:49:35.840
So maybe you might have like one part that displays a particular video in our example from the course,

00:49:35.840 --> 00:49:36.160
right?

00:49:36.240 --> 00:49:41.520
And that thing has to be past certain bits of information, like what the video is,

00:49:41.520 --> 00:49:43.260
so you can get the ID and so on.

00:49:43.260 --> 00:49:46.840
And then when you use it, you kind of, instead of putting the HTML inline,

00:49:46.840 --> 00:49:49.300
you call it like a function in the HTML.

00:49:49.300 --> 00:49:53.520
So you would say like div, here's the thing that contains it, you know, render partial,

00:49:53.520 --> 00:49:54.820
here's the thing.

00:49:54.820 --> 00:49:55.740
And you call it.

00:49:55.740 --> 00:50:00.160
So it's kind of two sides of the same coin, but like very much Coke, Pepsi is a good analogy

00:50:00.160 --> 00:50:00.400
here.

00:50:00.400 --> 00:50:05.620
Like this one says, I would like to maybe be able to reuse that across different pages,

00:50:05.620 --> 00:50:08.040
just like you would a function in Python.

00:50:08.040 --> 00:50:10.040
I might want to use it in more than one place.

00:50:10.040 --> 00:50:14.040
And so it makes sense to have it in its own separate thing, right?

00:50:14.040 --> 00:50:18.420
Like in this example, you might want to show a video, but you might want to do it on like a list

00:50:18.420 --> 00:50:18.880
of videos.

00:50:18.880 --> 00:50:22.120
And you might want to do it on a profile page where you have favorites, right?

00:50:22.120 --> 00:50:26.060
And those wouldn't, the fragment style, you would have to duplicate that HTML.

00:50:26.060 --> 00:50:32.840
So this one allows you to have like a nice, simple way to do that, right?

00:50:32.840 --> 00:50:36.200
And then on the server side, it makes it simpler because I don't know if there's any examples

00:50:36.200 --> 00:50:36.460
here.

00:50:36.460 --> 00:50:37.340
I'm sure there is.

00:50:37.340 --> 00:50:42.440
But on the server side, all you do is you just say the template response is the partial

00:50:42.440 --> 00:50:46.640
and you just provide the data and you don't have to do like, if it's the full thing or

00:50:46.640 --> 00:50:49.780
if it's a partial thing, I'm going to do different stuff on the server.

00:50:49.780 --> 00:50:50.380
Right.

00:50:50.380 --> 00:50:53.100
So that's the Jinja partials.

00:50:53.100 --> 00:50:59.660
I don't have a Django partials, but you know, this, this applies for Flask, FastAPI and others.

00:50:59.660 --> 00:51:08.200
So on the Django template library, the include tag is either slightly more powerful than the

00:51:08.200 --> 00:51:10.180
Jinja one or just better documented.

00:51:10.180 --> 00:51:15.360
A lot of the reasons you wrote this library, I can do with the existing Django include tag.

00:51:15.460 --> 00:51:19.180
So there's like a tiny little use case where it doesn't overlap, but like everything,

00:51:19.180 --> 00:51:23.020
everything in the course, for example, I was able to do quite simply with just using the

00:51:23.020 --> 00:51:23.620
include tag.

00:51:23.620 --> 00:51:28.160
There is a library out there that is the, what did you say it was the Coke version?

00:51:28.160 --> 00:51:30.860
And that is the Django render block.

00:51:30.860 --> 00:51:32.860
This is by Patrick cloak.

00:51:33.100 --> 00:51:37.520
And essentially he's using very, something very similar to the Jinja2 fragments.

00:51:37.520 --> 00:51:43.400
And it essentially allows you to pull out a template block from a page.

00:51:43.400 --> 00:51:46.820
This has actually spooky lookies preferred approach.

00:51:46.820 --> 00:51:47.920
It's in his patterns.

00:51:47.920 --> 00:51:50.160
I think in this case, I'm a Pepsi guy.

00:51:50.160 --> 00:51:50.660
I'm with you.

00:51:50.660 --> 00:51:53.580
I would rather have the piece inside its own file.

00:51:53.640 --> 00:51:59.800
But I think the reason behind having it in the blocks is essentially you can turn conditionals

00:51:59.800 --> 00:52:02.640
on, have that one page, the whole thing gets rendered.

00:52:02.640 --> 00:52:07.060
And then the snippets are always using the same library and you can just flag, hey, I want

00:52:07.060 --> 00:52:09.220
this partial piece coming out of it.

00:52:09.220 --> 00:52:11.940
Essentially, these are very, very similar concepts.

00:52:12.160 --> 00:52:18.140
Just the Django versus the Django templating, because of course, Django is in Django as well.

00:52:18.140 --> 00:52:21.160
So the Django native templating versus the Django piece.

00:52:21.160 --> 00:52:24.500
And you can take either approach depending on what works for you.

00:52:24.500 --> 00:52:24.740
Yep.

00:52:24.740 --> 00:52:29.300
And just to wrap this up before I get a lot of email, a lot of email, there's a whole section

00:52:29.300 --> 00:52:32.200
that says, why not just use include or macro from Django?

00:52:32.200 --> 00:52:35.900
And there's a great long discussion here with lots of examples.

00:52:36.400 --> 00:52:42.300
The short version is with macro, if you want to render the template alone, you have to

00:52:42.300 --> 00:52:49.320
have a third page that just calls the macro, that just embeds the macro and then calls it

00:52:49.320 --> 00:52:50.700
in an empty page for the template.

00:52:50.700 --> 00:52:52.200
Why not use include?

00:52:52.200 --> 00:53:00.120
Well, with include, you have to have the thing, the variable names in the partial match the consumer.

00:53:00.120 --> 00:53:05.640
So it's as if you had to say, I want to function, I want to call a function, but your local variable

00:53:05.640 --> 00:53:11.320
names have to match exactly the parameter names in every use case that you can't say like

00:53:11.320 --> 00:53:13.140
user where there was a username.

00:53:13.140 --> 00:53:13.440
Nope.

00:53:13.440 --> 00:53:16.660
You can't call this function that you're supposed to call your variable local variable user.

00:53:16.660 --> 00:53:21.360
You know, it's, it's, so there's a look at that discussion and then, then email me if

00:53:21.360 --> 00:53:21.800
you have to.

00:53:21.800 --> 00:53:26.480
And that's, that's why the Django one doesn't have this problem is because the include tag

00:53:26.480 --> 00:53:31.920
in Django has a with keyword, which allows you to essentially say, I want this, this bit

00:53:31.920 --> 00:53:33.900
of context passed in as that value.

00:53:33.900 --> 00:53:39.080
So you can essentially, the equivalent there would be with video equals V email equals user

00:53:39.080 --> 00:53:43.700
dot email to accomplish the same thing, which is why I could get away with not needing the

00:53:43.700 --> 00:53:44.320
extra library.

00:53:44.320 --> 00:53:44.680
Nice.

00:53:44.680 --> 00:53:49.200
There is somebody down here who said, I'm not sure what their name is, but I think they

00:53:49.200 --> 00:53:56.700
found an internal, like a deeply internal function from within Jinja.

00:53:56.920 --> 00:54:00.940
I think I'm not sure if it's in Jinja or Flask, but you're able effectively to do the

00:54:00.940 --> 00:54:02.640
same thing, but it's like, I don't know.

00:54:02.640 --> 00:54:06.020
I'm not a fan of like grabbing some random internal thing and going, I think we'll probably

00:54:06.020 --> 00:54:06.580
just use that.

00:54:06.580 --> 00:54:09.980
You know, I also just, there's a chameleon's partial.

00:54:09.980 --> 00:54:13.900
If you're a chameleon template person that does the same thing, it's a Jinja partial as

00:54:13.900 --> 00:54:14.020
well.

00:54:14.020 --> 00:54:14.320
Yeah.

00:54:14.320 --> 00:54:17.720
When you first showed this to me, I looked it up in the Jinja docs because I don't use

00:54:17.720 --> 00:54:18.400
Jinja as often.

00:54:18.400 --> 00:54:23.680
And it kind of hints that this is there, but it was really, really unclear.

00:54:23.680 --> 00:54:26.300
It just sort of gave one example and didn't explain it.

00:54:26.300 --> 00:54:32.680
And so, yeah, it doesn't surprise me that there's something that can be done, but maybe

00:54:32.680 --> 00:54:34.340
it's, maybe it's publicly available.

00:54:34.340 --> 00:54:38.280
And if they got documented a little better, it might solve the problem and you could, you

00:54:38.280 --> 00:54:40.980
know, close up that chunk of code you had to maintain.

00:54:40.980 --> 00:54:41.260
Yeah.

00:54:41.260 --> 00:54:43.460
I mean, I'm not necessarily in love with it.

00:54:43.460 --> 00:54:45.980
I just, I created it because I want to have really nice clean code.

00:54:45.980 --> 00:54:46.220
Right.

00:54:46.220 --> 00:54:46.920
Yeah, exactly.

00:54:46.920 --> 00:54:47.680
Of the problem.

00:54:47.880 --> 00:54:49.800
You know, pull up the Django render block.

00:54:49.800 --> 00:54:51.100
You already really talked about that one.

00:54:51.100 --> 00:54:54.860
That's on the similar side as to the Jinja fragments.

00:54:54.860 --> 00:54:55.520
Partial.

00:54:55.520 --> 00:54:56.620
To fragments.

00:54:56.620 --> 00:54:56.900
Sorry.

00:54:56.900 --> 00:54:57.780
That's what we talked about.

00:54:57.780 --> 00:54:58.160
That's right.

00:54:58.160 --> 00:55:00.160
Where the, all the stuff is together.

00:55:00.160 --> 00:55:05.080
And I think that's a good idea if you're never, ever going to use that block of that

00:55:05.080 --> 00:55:07.960
bit of HTML and dynamic bit anywhere else.

00:55:07.960 --> 00:55:11.520
But as soon as you are, then it's like, well, it's starting to get, I don't know.

00:55:11.520 --> 00:55:12.240
That's my philosophy.

00:55:12.240 --> 00:55:12.840
Yeah.

00:55:12.840 --> 00:55:17.360
One of the reasons I use the include template, even for, I use it even just to shrink this

00:55:17.360 --> 00:55:18.900
shrink the size of the HTML file.

00:55:18.900 --> 00:55:20.680
Like I don't even care if it's not reused.

00:55:20.680 --> 00:55:24.140
Sometimes I just find it easier to read because HTML is so verbose.

00:55:24.140 --> 00:55:30.100
I sometimes just find it easier to read something that goes, oh, include row from this row file.

00:55:30.100 --> 00:55:30.820
I'm like, oh, okay.

00:55:30.820 --> 00:55:32.780
I don't have to think about how many divs are in the row.

00:55:32.840 --> 00:55:34.020
I understand what's in that row.

00:55:34.020 --> 00:55:35.220
And it allows me to read it easier.

00:55:35.220 --> 00:55:40.700
So obviously the cost of that is a performance of compiling the template, but I'll take that

00:55:40.700 --> 00:55:42.380
for code readability every day of the week.

00:55:42.380 --> 00:55:43.760
Just throw more CPU at it.

00:55:43.760 --> 00:55:44.060
Yeah.

00:55:44.060 --> 00:55:45.240
I'm a hundred percent with you.

00:55:45.240 --> 00:55:50.060
And yeah, you don't have to worry about whether the 17th div is matching or not.

00:55:50.140 --> 00:55:50.440
Yeah.

00:55:50.440 --> 00:55:51.200
All that stuff.

00:55:51.200 --> 00:55:51.400
Yeah.

00:55:51.400 --> 00:55:51.920
Yeah.

00:55:51.920 --> 00:55:52.220
Yeah.

00:55:52.220 --> 00:55:55.820
You talked about Flask HTML, the ASGI one.

00:55:55.820 --> 00:55:57.240
HX requests.

00:55:57.240 --> 00:55:58.860
What's this one about?

00:55:58.860 --> 00:56:00.380
This is similar, right?

00:56:00.380 --> 00:56:03.260
It solves the same problem, but in a different fashion.

00:56:03.680 --> 00:56:06.300
So this is by a gentleman named Yakov Lundsen.

00:56:06.300 --> 00:56:12.660
And essentially he's using a lot of the class-based view philosophy, not that he's actually using

00:56:12.660 --> 00:56:19.380
class-based views, but essentially you are building out your requests, HX request handling

00:56:19.380 --> 00:56:20.840
as classes.

00:56:20.840 --> 00:56:27.540
And he's gone to the level of defining custom tags that you use instead of the attribute, and

00:56:27.540 --> 00:56:29.840
it will automatically wire that together.

00:56:29.840 --> 00:56:31.900
So you don't even have to declare your URLs.

00:56:32.540 --> 00:56:35.400
And this is, and again, you know, back to that Coke versus Pepsi thing.

00:56:35.400 --> 00:56:40.540
This is that sort of that, the definition between function-based and class-based, the contrast

00:56:40.540 --> 00:56:41.720
between function and class-based.

00:56:41.720 --> 00:56:45.180
Class has always made me a little uncomfortable because they're a little bit magic.

00:56:45.180 --> 00:56:50.580
It often means writing less code, but if for someone who isn't used to it, they have to

00:56:50.580 --> 00:56:52.120
go digging to understand what's happening.

00:56:52.120 --> 00:56:55.220
He's definitely taken a bit of a magic approach here.

00:56:55.220 --> 00:57:02.000
There's less code, but you can, you've got this magical wiring of change email as you've

00:57:02.000 --> 00:57:06.760
got up on the screen, getting wired to the actual HX change email underneath and being

00:57:06.760 --> 00:57:07.920
able to find all that code.

00:57:07.920 --> 00:57:12.660
So if you're a class-based view person, this will probably feel very, very natural and a

00:57:12.660 --> 00:57:13.500
good approach to take.

00:57:13.500 --> 00:57:18.860
If you're not already intimately familiar with class-based views, this wouldn't be somewhere

00:57:18.860 --> 00:57:19.860
where I would send you.

00:57:19.860 --> 00:57:24.080
I'm going to add more overhead to figure out how to put all that together than just to use

00:57:24.080 --> 00:57:24.740
the other libraries.

00:57:24.740 --> 00:57:24.980
Yeah.

00:57:24.980 --> 00:57:25.400
That's right.

00:57:25.500 --> 00:57:28.140
Well, we have a lot of things we've been going through, but I think we're getting close

00:57:28.140 --> 00:57:29.360
to the end of the list here.

00:57:29.360 --> 00:57:31.340
Django dashboards.

00:57:31.340 --> 00:57:31.820
Yeah.

00:57:31.820 --> 00:57:37.640
Actually, why don't we just skip down to a Wella Club and maybe we can cap it out right

00:57:37.640 --> 00:57:37.920
there?

00:57:37.920 --> 00:57:39.800
Because I thought it's probably a really good example.

00:57:39.800 --> 00:57:41.880
Multilingual version, the original.

00:57:41.880 --> 00:57:48.080
So this is, if you want to go one place to see everything working together, this is the

00:57:48.080 --> 00:57:48.720
place to go.

00:57:48.720 --> 00:57:50.740
So this is also by Adam Johnson.

00:57:50.740 --> 00:57:53.380
So he's the same guy who does Django HTMX.

00:57:53.380 --> 00:57:58.880
A Wella is a Nambian game that is kind of similar to another game called Hus.

00:57:58.880 --> 00:58:03.460
I will admit I couldn't fully wrap my head around the rules of the game.

00:58:03.460 --> 00:58:08.200
It's essentially like a little board with holes in it and there's stones in the board.

00:58:08.200 --> 00:58:09.780
There's a good picture up there.

00:58:09.780 --> 00:58:10.040
Good.

00:58:10.040 --> 00:58:14.220
And the rules are you on your turn, you have to move some of your stones.

00:58:14.220 --> 00:58:16.840
And if you move them correctly, you're done.

00:58:16.840 --> 00:58:17.560
Your turn is done.

00:58:17.560 --> 00:58:20.400
If you don't move them correctly, you can take other people's stones, whatever.

00:58:20.400 --> 00:58:24.120
So it's one of those very simple games with a lot of strategy.

00:58:24.120 --> 00:58:28.240
And like I said, I didn't quite fully wrap my head around the game, but that's not what

00:58:28.240 --> 00:58:28.940
I was here for.

00:58:28.940 --> 00:58:34.040
He's written a HTMX based version on the web here.

00:58:34.040 --> 00:58:37.480
You've got a fully automated computer opponents.

00:58:37.480 --> 00:58:38.860
You can play against the computer.

00:58:38.860 --> 00:58:43.160
It has the layout of the board with the number of rows and stones.

00:58:43.160 --> 00:58:46.620
And then there's a number for how many stones are in each hole.

00:58:46.620 --> 00:58:49.980
And if you click one of the links, the one of the numbers,

00:58:50.060 --> 00:58:53.360
it automatically moves the stones according to the rules.

00:58:53.360 --> 00:58:57.700
And all of this, of course, as you can imagine, is updated through HTMX.

00:58:57.700 --> 00:59:04.620
It even has the base version of this ships with the Django debug toolbar on so you can watch

00:59:04.620 --> 00:59:05.980
what is going on.

00:59:06.040 --> 00:59:10.860
And then in the background, because it will host multiple games at a time, we were talking

00:59:10.860 --> 00:59:12.600
a bit about that polling concept.

00:59:12.600 --> 00:59:15.280
It's using the HTMX's polling mechanism.

00:59:15.280 --> 00:59:19.440
And in the top right hand corner, there's a little report of how many games are in progress

00:59:19.440 --> 00:59:20.020
at the moment.

00:59:20.380 --> 00:59:22.340
So I really, really liked this example.

00:59:22.340 --> 00:59:25.600
So there's other examples that are good on the list, but most of them are toys.

00:59:25.600 --> 00:59:30.140
They either show off something like an event coming from the server and, you know, no cleanliness.

00:59:30.140 --> 00:59:33.360
One of the other examples I played with was like a little book database.

00:59:33.360 --> 00:59:34.620
And, you know, it worked.

00:59:34.620 --> 00:59:38.680
But if you typed in a number in a place that was a name in a place where it was supposed to

00:59:38.680 --> 00:59:39.640
have number, it would crash.

00:59:40.020 --> 00:59:41.880
This is actually a working application.

00:59:41.880 --> 00:59:47.080
And so you've got a nice solid example to how everything works, all the different attributes

00:59:47.080 --> 00:59:47.540
and go.

00:59:47.540 --> 00:59:52.260
So if you're comfortable enough with, if you're new to Django, then maybe this isn't where you

00:59:52.260 --> 00:59:52.560
start.

00:59:52.560 --> 00:59:56.800
But if you're comfortable with Django and you really just want to see a one place where

00:59:56.800 --> 01:00:01.400
all the HX parts are working together and it's a fun way to learn something, this would

01:00:01.400 --> 01:00:02.840
definitely be the example I would use.

01:00:02.840 --> 01:00:03.220
Excellent.

01:00:03.220 --> 01:00:08.140
Yeah, it looks like quite a cool way to build things with HTMX.

01:00:08.140 --> 01:00:12.500
I'm not even sure I would have thought HTMX totally applies to this level of kind of

01:00:12.500 --> 01:00:17.220
interactivity because it says you can do player versus player games with the polling trigger

01:00:17.220 --> 01:00:18.080
and stuff like that.

01:00:18.080 --> 01:00:19.400
It's a pretty deep example.

01:00:19.400 --> 01:00:23.440
But of course, you kind of expect it out of the HTMX, Django HTMX guy, right?

01:00:23.440 --> 01:00:29.920
So and actually, so as an aside, there's also a relatively decent demo inside of that library

01:00:29.920 --> 01:00:30.300
as well.

01:00:30.300 --> 01:00:36.520
So if you grab, if you git clone Django HTMX, there's an examples directory that also has not

01:00:36.520 --> 01:00:40.200
quite as comprehensive this, but that's another good place to start as well if you're looking

01:00:40.200 --> 01:00:40.940
for sample code.

01:00:40.940 --> 01:00:46.260
So plenty of good stuff out there with good real world purpose.

01:00:46.260 --> 01:00:46.660
Cool.

01:00:46.660 --> 01:00:50.360
Well, quite the look inside of HTMX, Christopher.

01:00:50.360 --> 01:00:50.860
Thank you.

01:00:50.860 --> 01:00:52.000
Yeah, it's been fun.

01:00:52.000 --> 01:00:52.320
Yeah.

01:00:52.320 --> 01:00:55.020
So many things these days to make it work with Django.

01:00:55.020 --> 01:00:58.480
When I started out, like many of these libraries didn't exist.

01:00:58.640 --> 01:01:02.460
I would have probably just grabbed one and used it had I had it at the time, you know?

01:01:02.460 --> 01:01:04.140
It definitely makes a big difference.

01:01:04.140 --> 01:01:09.100
And the HTMX community is, I accidentally found out very, very vibrant.

01:01:09.100 --> 01:01:16.400
Somebody found the future table of contents of my book and posted on, as you said, the artist

01:01:16.400 --> 01:01:17.360
formerly known as Twitter.

01:01:17.820 --> 01:01:20.540
Hey, there's an HTMX chapter coming in this Django book.

01:01:20.540 --> 01:01:25.880
And my feed just exploded for the next three days of everybody going, yay, HTMX.

01:01:25.880 --> 01:01:30.620
So there's a very strong and excited community out there that's playing with this tool.

01:01:30.620 --> 01:01:35.800
And as I said, it makes a real big difference in your ability to build stuff quickly and effectively.

01:01:35.800 --> 01:01:36.400
Sure does.

01:01:36.400 --> 01:01:41.460
And speaking to the long-term sustainability, right at the top of the HTMX.org page, it says,

01:01:41.460 --> 01:01:46.500
we're excited to announce that HTMX has been accepted into the first class of the GitHub

01:01:46.500 --> 01:01:47.840
open source accelerator.

01:01:47.840 --> 01:01:50.080
So more momentum for HTMX.

01:01:50.080 --> 01:01:50.540
Excellent.

01:01:50.540 --> 01:01:51.040
All right.

01:01:51.040 --> 01:01:51.980
Final call to action.

01:01:51.980 --> 01:01:53.420
People want to get started with this stuff.

01:01:53.420 --> 01:01:55.140
They want to dive into it a little bit more.

01:01:55.140 --> 01:01:55.760
What do you tell them?

01:01:55.760 --> 01:01:58.920
Start with the page you've got up right now, for sure.

01:01:58.920 --> 01:02:01.200
HTMX.org is a good place to go.

01:02:01.200 --> 01:02:05.640
And, you know, at risk of sounding like an infomercial, we have a couple of really high

01:02:05.640 --> 01:02:07.660
quality courses that you could also check out.

01:02:07.660 --> 01:02:08.120
Yeah.

01:02:08.120 --> 01:02:11.840
It would definitely be places to go with things.

01:02:11.840 --> 01:02:15.800
And of course, you know, we'll link in the show notes to all those lists.

01:02:15.800 --> 01:02:18.900
But there's a lot of content there if you just kind of want to go digging and play around.

01:02:18.900 --> 01:02:19.220
Yeah.

01:02:19.220 --> 01:02:21.440
We only just touched on a little tiny bit of it.

01:02:21.440 --> 01:02:23.300
So plenty more to go into.

01:02:23.300 --> 01:02:24.360
Lots of interviews.

01:02:24.360 --> 01:02:25.220
Lots of examples.

01:02:25.220 --> 01:02:28.840
Lots of blog posts and articles that you can go check out.

01:02:28.840 --> 01:02:29.620
And your book.

01:02:29.620 --> 01:02:30.660
Your book will be out in the spring.

01:02:30.660 --> 01:02:31.880
So people can check that out as well.

01:02:31.880 --> 01:02:32.520
Appreciate it.

01:02:32.520 --> 01:02:32.840
Yes.

01:02:32.840 --> 01:02:33.240
Yeah.

01:02:33.240 --> 01:02:34.760
Thank you so much for being on the show.

01:02:34.760 --> 01:02:36.080
Always nice to catch up with you.

01:02:36.080 --> 01:02:36.880
Glad to be here.

01:02:36.880 --> 01:02:37.140
Yeah.

01:02:37.140 --> 01:02:37.740
See you.

01:02:37.740 --> 01:02:37.880
Bye.

01:02:37.880 --> 01:02:41.640
This has been another episode of Talk Python To Me.

01:02:41.640 --> 01:02:43.460
Thank you to our sponsors.

01:02:43.460 --> 01:02:45.080
Be sure to check out what they're offering.

01:02:45.080 --> 01:02:46.500
It really helps support the show.

01:02:46.500 --> 01:02:53.340
When it comes to artificial intelligence, AI, what's good for trillion dollar companies isn't

01:02:53.340 --> 01:02:55.000
necessarily good for people.

01:02:55.000 --> 01:03:00.940
That's the theme of season seven of IRL, Mozilla's multi-award winning podcast hosted by Bridget

01:03:00.940 --> 01:03:01.240
Todd.

01:03:01.240 --> 01:03:04.680
Season seven is all about putting people over profit in AI.

01:03:05.180 --> 01:03:09.000
Check them out and listen to an episode at talkpython.fm/IRL.

01:03:09.000 --> 01:03:10.900
Century.

01:03:10.900 --> 01:03:15.700
They have a special live event like a mini online conference where you can connect with the team

01:03:15.700 --> 01:03:20.280
and take a deep dive into different products and services every day for a week.

01:03:20.440 --> 01:03:21.940
Join them for launch week.

01:03:21.940 --> 01:03:27.680
New product releases, exclusive demos and discussions with experts from their community on the latest

01:03:27.680 --> 01:03:28.160
with Century.

01:03:28.160 --> 01:03:32.260
You'll see how Century's latest product updates can make your work life easier.

01:03:32.260 --> 01:03:38.260
Visit talkpython.fm/century dash launch dash week to register for free.

01:03:39.260 --> 01:03:40.600
Want to level up your Python?

01:03:40.600 --> 01:03:44.760
We have one of the largest catalogs of Python video courses over at talkpython.

01:03:44.760 --> 01:03:49.820
Our content ranges from true beginners to deeply advanced topics like memory and async.

01:03:49.820 --> 01:03:52.500
And best of all, there's not a subscription in sight.

01:03:52.500 --> 01:03:55.400
Check it out for yourself at training.talkpython.fm.

01:03:55.720 --> 01:03:57.480
Be sure to subscribe to the show.

01:03:57.480 --> 01:04:00.240
Open your favorite podcast app and search for Python.

01:04:00.240 --> 01:04:01.560
We should be right at the top.

01:04:01.560 --> 01:04:06.720
You can also find the iTunes feed at /itunes, the Google Play feed at /play,

01:04:06.720 --> 01:04:10.920
and the direct RSS feed at /rss on talkpython.fm.

01:04:11.320 --> 01:04:13.880
We're live streaming most of our recordings these days.

01:04:13.880 --> 01:04:17.280
If you want to be part of the show and have your comments featured on the air,

01:04:17.280 --> 01:04:21.720
be sure to subscribe to our YouTube channel at talkpython.fm/youtube.

01:04:21.720 --> 01:04:23.780
This is your host, Michael Kennedy.

01:04:23.780 --> 01:04:25.060
Thanks so much for listening.

01:04:25.060 --> 01:04:26.220
I really appreciate it.

01:04:26.220 --> 01:04:28.120
Now get out there and write some Python code.

01:04:28.120 --> 01:04:49.180
I'll see you next time.