Learn Python with Talk Python's 270 hours of courses

#484: From React to a Django+HTMX based stack Transcript

Recorded on Tuesday, Oct 29, 2024.

00:00 Have you heard about HTMX? We've discussed it a time or two on the show.

00:03 We're back with another episode on HTMX, this time with a real-world success story and lessons

00:09 learned. We have Sheena O'Connell on to tell us how she moved from a React Django app to pure

00:16 Django with HTMX. This is Talk Python to Me, episode 484, recorded October 29th, 2024.

00:23 Are you ready for your host?

00:27 You're listening to Michael Kennedy on Talk Python to Me. Live from Portland, Oregon,

00:32 and this segment was made with Python.

00:34 Welcome to Talk Python to Me, a weekly podcast on Python. This is your host, Michael Kennedy.

00:42 Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython,

00:47 both accounts over at fosstodon.org, and keep up with the show and listen to over nine years of

00:53 episodes at talkpython.fm. If you want to be part of our live episodes, you can find the live streams

00:59 over on YouTube. Subscribe to our YouTube channel over at talkpython.fm/youtube and get notified

01:05 about upcoming shows. This episode is sponsored by Posit Connect from the makers of Shiny. Publish,

01:12 share and deploy all of your data projects that you're creating using Python. Streamlit, Dash,

01:17 Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs. Posit Connect supports all of

01:24 them. Try Posit Connect for free by going to talkpython.fm/Posit, P-O-S-I-T.

01:30 And this episode is brought to you by Bluehost. Do you need a website fast? Get Bluehost. Their AI

01:36 builds your WordPress site in minutes, and their built-in tools optimize your growth. Don't wait.

01:42 Visit talkpython.fm/Bluehost to get started. Sheena, welcome to Talk Python to me.

01:48 Thanks so much. Happy to be here.

01:50 I'm happy to have you here. We've got an awesome topic queued up, one that I just, I don't know if

01:56 I'll ever get tired of coming back to this because I'm just such a fan of simplicity and getting stuff

02:01 done and not like, let's see how many layers of things we can pile on. And by that, I mean,

02:07 HTMX as a success story for going from a whole bunch of front-end stuff, a bunch of different

02:14 multi, multiple apps, you know, JavaScript front-end, Django back-end talking to each other,

02:19 but kind of being separate as well. Oh, yeah.

02:21 And just switching to HTMX. And you wrote up a really cool essay on this that we're going to dive into.

02:26 So, and share your experience.

02:27 Pretty fantastic experience overall. I was really surprised by HTMX when I came across it the first

02:33 time because there are so many fashionable front-end libraries and frameworks. So when I heard about it,

02:39 I was like, oh, it's another one of those, whatever. And then I went to a DjangoCon, I think it was 2022,

02:46 and I saw a talk from Chris May, who's in the audience, and that's got me excited about it. And

02:52 yeah, that's, that's kind of when my, my whole story started. What I had been doing before was

02:58 working with, so I had this team and we were building a thing and we had a React front-end.

03:04 So on the front, that's a normal thing. Like if you wanted a, like a modern front-end application,

03:09 you'd use something like React or Vue or one of the many competitors. And then on the back end,

03:15 we had Django. And I think that's like a fairly normal, fairly accepted way to do things, or it

03:21 has been for a long time. But I think it's like, I think it's a little faulty. I think that front-end

03:28 web development has been in a little bit of a complexity death spiral for the last little while.

03:33 And like, sometimes it's useful. Sometimes it's really helpful, but like for some things you need

03:38 certain tools in the front-end, I think. But yeah, I think it's, things have been going in,

03:43 in the complexity for, or direction for a long time. And HTML solves a lot of problems.

03:48 Right. Well, you think back, you know, think back to the jQuery days. How did you use jQuery?

03:53 You included a CDN, or if you're wild, you might download it and include it in your own static

03:59 content. And then you just started using it, right? And just layers and layers have just been

04:04 building. And JavaScript of 2024 era looks nothing like 10 years ago, 15 years ago, JavaScript.

04:11 Yeah.

04:12 I would say it's one of the more complicated programming environments compared to something

04:16 like C++, right? Because there's so many steps in there, so many implicit linkings and stuff.

04:21 Yeah. There's a lot of dark magic under the hood. It's very hard to know what's going on. And

04:25 I think like one of the challenges is that a lot of people used to get into web dev as their gateway

04:31 drug to programming. Like they'd start off with web dev and then branch out from there. But now web dev

04:36 is like this magic weird box with so many layers. And I think it's, it's sort of messed a lot of people

04:42 up. It's a challenge to, to get started in the way that people used to get started. And it's like the

04:47 barrier to, I don't know, entry level programmers used to need to be here. And now,

04:51 it's here and does a lot of key things to the ecosystem as a whole. But yeah, like all the

04:57 build steps, all the magic things that happen under the hood. And the fact that you have to like

05:01 tasks switch between completely different applications and completely different like ways of thinking.

05:07 So for me, I've always loved Django. It's so good. So with the thing that I was building,

05:12 I wanted Django because I needed to build a thing really, really fast. And so my efficiency was

05:19 important. And then it was like, I need a good front end and React was, was a clear choice at the time.

05:24 But it means like switching, like, like for me to work on this thing, I need to keep holding the

05:30 Django application and the React application in my head and how they talk. And it's not just React,

05:34 it's like Redux and Saga and side effects and asynchronous goodies. And, and then on the

05:39 Django side, it's all of that. And Django is, I think, much simpler to get your head around than

05:44 React, actually. It's a tricky thing.

05:47 It definitely is a tricky thing. And one thing I would just like to put out early before we get too

05:51 much mail is this is not necessarily a hate on JavaScript.

05:55 Oh, no, no.

05:56 There are people in the node space that are super fans of HTMX. And I think what is not obvious

06:04 about the benefits of HTMX, as we get into it, we'll, we'll talk about some of these things,

06:08 but you were just touching on then, like you've got this React front end, it has its own state.

06:12 It also has its own capability. So it's running on the client side. So it can't talk to file systems

06:17 or the database. It can only talk to APIs. On the other hand, you've got the Django app,

06:21 which probably is not talking to APIs, but talks to the database, talks to, you know,

06:25 the server levels things. And you've got to, as you're working on this app, think, okay,

06:30 I'm in this context. That means no database. I'm in this context. That means primarily just database.

06:34 Right. And it's just, you have these two worlds. And if you could say, can I just write in one of

06:39 them?

06:40 Yes.

06:40 And the JavaScript people might even pick, like, I just want to stay in JavaScript, but always node

06:44 or always at least, you know, pick one of the styles of programming and not just constantly

06:49 switch back and forth between these. You have browser capabilities, you have server capabilities,

06:54 you have browser information, like just, that is just not productive. It's not the best.

06:58 Right. And so as much as you can avoid that, and as we'll see, HTMX is super easy about keeping it

07:05 in one place. Right. So that's, I think that's one of the big things that people should, should be

07:09 honing in on as we talk about this. What do you think?

07:11 If I came across as hating on JavaScript, I dig JavaScript and I use it a lot where it's needed.

07:16 I think it is a fantastic tool in the toolbox that I'm on sides with you, that it's just the

07:21 complexity of switching contexts all the time. It slows you down and it's a lot to keep in your head.

07:26 And so it's like, for me, when I was working on this application and needing to switch contexts

07:31 all the time, it's like, like, you can't just make a thing. Like you have to like do the dance

07:36 to make the thing. And it's...

07:38 Instead of four different chained file watchers to do their things and stuff, right?

07:43 So it just like adds a little bit of a, like, you're slower than you would like to be. There's like more tedium

07:50 than there should be. It'd be nice if you could just like build the thing quickly in a simple way and it just works

07:54 and it's beautiful. And HTMLX kind of allows that along with other tools. Yeah. So for me, that context

08:01 switching was like a painful, painful thing. And for the team I was working with as well, like I had a

08:06 bunch of juniors on my team and it was so hard to get them productive because it was like, okay, do you

08:11 want to be productive on the back end? Or do you want to be productive on the front end? And then on the

08:15 front end, like that was complicated because of the, again, React, Redux, Redux saga. So,

08:20 so they were all just like suffering. And then... To put real features into place,

08:26 you've got to do a vertical slice, right? Which hits most, if not all, you know, you probably,

08:30 you probably have to touch the React front end. Yeah. You probably need some new tiny bits of UI design.

08:36 So CSS and maybe some SaaS build step there. And you know, like then you're doing the server side

08:43 bits and then you're doing a database migration and it's just like, it's end to end, right?

08:47 Yeah. And for some people, it's not even reasonable to expect them to have all of those skills,

08:52 those end to end skills. And then it's like, you have to make your team complicated. You have to

08:56 have a back end team and a front end team and they need to now integrate with each other. And so,

09:01 like the team resembles the team stack. Yeah.

09:04 Yeah. That's interesting. Yeah. We have a group for this later, a group for that later. And,

09:08 you know, look, if you're a huge company, maybe that actually makes tons of sense. Maybe.

09:12 I'm not, I'm not saying it does, but it may, but when you're a small company,

09:16 it just doesn't. Right.

09:17 When you're building something, you do need to think about the team that's going to be building

09:21 it. Their skills right now, the skills that they're going to have in the future,

09:24 the skills that you're going to need to pull into the team in the future. And so it's,

09:28 I don't know if it makes sense to, to just, well, in my context, it didn't make sense to,

09:33 to split up the team. If I had the tools to allow everybody to be in the same place from the

09:38 beginning, that would have been freaking fantastic. Yeah, absolutely. That would be awesome.

09:41 Let's talk a bit about HTML. So we, we said, Hey, we've been talking about this, but I,

09:46 and it's sort of broad terms, but let's be a little bit specific and maybe you could tell us

09:50 what is this HTML and why is it, why is it not just a different flavor of reactor view or something?

09:58 And then maybe we could talk to you a few examples.

10:00 The way I explain HTML to myself is that like, imagine looking at HTML, HTML is with us. It's,

10:08 it's going to be with us forever, maybe not forever, but for a very long time. What, what if we like

10:13 There've been many, there've been many attempts to replace it and they were all bad.

10:16 Yeah. Yeah. So it's, it's probably going to stick around for the foreseeable future and it's everywhere.

10:22 And what if we could just augment it slightly so that it could do what we needed it to do in the

10:28 modern web? Like we, like since HTML got invented, like it's quite a simple tool, but now we need to

10:34 do all this extra stuff because people expect all sorts of like interactivity in the user interfaces.

10:40 They expect asynchronous workloads and things like that. And what if HTML could do that? And it can do that.

10:47 And it's not actually that hard to make it do that. You just need to add a few extra attributes.

10:52 And so what HTML is, is a really, really small JavaScript library. And you just include it as

11:00 a script tag in your page and then it's there and it's available and it's installed just like the old,

11:05 the good old days of jQuery. And yeah, you could just go back and throw it in a CDN if you wanted,

11:11 couldn't you? That's right. I hadn't really thought about it.

11:13 From there, you just have these extra attributes on your HTML tags that do different things.

11:18 So for example, like so HTML has a lot of different stuff, but if you were to like 80,

11:23 20 years and look at the parts that are the most used, then basically the stuff you'll use the most are

11:30 like tying into events, like click event handlers or whatnot. And then when you click on the thing or

11:37 whatever, it'll send in a request to a back end and the back end responds with an HTML fragment.

11:44 And then you swap that fragment into your page somewhere. So if you were to look at the,

11:51 the HTML documentation, the, the hello world of HTML is a button and the button says,

11:57 has the attributes HX post clicked. So it's saying like, when you click on the button,

12:02 then send a post request to a URL that's like forward slash click. So you can decide where,

12:08 like what HTTP method you're using and where it's going and what event you're tying into. And then

12:16 when the response arrives, then you do something with it. And the response is HTML. It's not a JSON

12:21 response that you then need to like turn into HTML. It's, it's plain old normal HTML. So it's super

12:28 simple to write. And then you, you take that HTML and you put it somewhere on the page. So maybe you

12:33 swap the current button that you just clicked with, with the HTML that was returned, or maybe you take

12:38 it and you put it like at the end of another element. You can, you could append stuff. You can pre-pend

12:45 stuff. You can replace entire elements. You can replace the internals of elements. And that little

12:50 pattern is actually really, really powerful. And you can tie into all sorts of different events. So there's

12:55 like interacting with individual elements, like a click or a form submission, you can say like on

13:00 load or like on scroll or all sorts of different things. So, so events. Yeah, absolutely. So one of

13:07 the motivations that Carl Carson Gross puts there is why should a and forum only be able to make HTTP requests?

13:14 Why should you only be able to click and have click and submit events, trigger them, right? And all these

13:20 things, you know, so it's kind of like just extending some of these niche features. Like you can click a button,

13:26 but not an image in HTML to, to all the pieces. And then like you said, exchanging fragments of HTML,

13:33 right? Like just instead of sending JSON back and then having the client side, turn that into HTML, just

13:38 do it on the server and stick it where it goes. Right? Basically that's it. It's, it's dead simple to code as well,

13:43 which is, which is fantastic. So it's a simple, you're just server side rendering some HTML like we

13:50 used to a long time ago. So it feels, it feels very familiar to people who got into web dev a long time

13:55 ago. The code itself is very, very easy to write. Like initially you might like scratch your head. It's

14:00 unfamiliar, but give yourself a couple of hours and it'll start to feel familiar. It's yeah,

14:06 it's lovely to work in. Yeah. I would also encourage people that want to get started with this and play

14:11 with this. The examples that they have on the website are pretty comprehensive, right? If you scroll

14:16 through, I don't know how many there are, maybe 20 or so. Yeah. More than that. It's a lot. Yeah.

14:20 There's a lot of them here. And then, so if you go into each one of them, it'll show you basically

14:25 some interesting things. So if you go to the first one, the click to edit, it says, here's a

14:30 bit of static HTML, like a label and a div and then a button that says click to edit. And all it has is

14:36 HX get, and it says, edit this thing. Right. And when you go and click it, like there's a little

14:42 example at the bottom, you click it, that's all fun. But if you open up the bottom, there's like a little

14:48 history of interactions and like a, I don't know what you call it, but like a web history that shows

14:54 what's transferred. So when you, you click edit, here's what the response was. And it shows the

14:58 HTML fragment, which in itself is a, a new HX has HX events. And then when it saves it, it goes back

15:05 to the static and so on. And I think it's a really pretty easy way to get a sense for what it is.

15:10 What do you think? Yeah. Yeah. Yeah. I think so. I think so. Those examples are great.

15:14 I think like one thing that I like to do is use HTML and the thing called Alpine JS together.

15:21 So for me, HTML is great for when the data needs to be passed back and forth,

15:26 but like for something like this, I'd probably use something like Alpine just to say like show and

15:30 hide, hide the form. Yeah. It's also fantastic. So you don't like strictly need it, I suppose,

15:37 but it does save on like some back and forth and it does make things a little bit more like in one

15:43 place, a little bit more like locality of behaviors, a useful thing. So now we're looking at Alpine

15:49 JS hello world. And this is cool because it also, it's, it's like HTMX in that it just adds a couple

15:55 of extra attributes to your HTML tags. And the 80, 20 of this is that you can define variables and those

16:04 variables are like this, like a state and they are defined within the scope of the place where you

16:12 defined it. So if you, if you have like div x data equals open false as a JSON object, then it's like,

16:17 within the scope of the stiv, we have this thing called open and its initial value is false.

16:22 And then you can do things like click on a button to, to change open to true or to toggle,

16:28 to toggle open. So you can have it like show form true or false. And then you can say,

16:32 then you can like say, yeah, it says span extra equals open. So we only show that under certain

16:37 circumstances. And you can also have like not open or you can have like, it speaks JavaScript. So you can do

16:43 some interesting things in there as well. Yeah, this looks pretty interesting. This is,

16:46 yeah, this is something I have not really used, but I do hear Alpine and HTMX mentioned together

16:52 frequently. They do have a similar vibe. Yeah, yeah, they do. They do. Yeah. I've, I've enjoyed a lot.

16:56 I tend to just use it for like small, simple things, but those small, simple things add up.

17:01 So for example, if you have menus that open and close and things like that, you might,

17:05 you might want to use something like this. Yeah. Or event, event handling. Like if you click this button,

17:11 change the state to this, and then it triggers the binding to open and close sections and so on.

17:16 Yeah. Yeah. Okay. Interesting.

17:17 This portion of Talk Python to Me is brought to you by Posit, the makers of Shiny, formerly RStudio,

17:25 and especially Shiny for Python. Let me ask you a question. Are you building awesome things? Of course

17:31 you are. You're a developer or data scientist. That's what we do. And you should check out Posit Connect.

17:37 Posit Connect is a way for you to publish, share, and deploy all the data products that you're building

17:43 using Python. People ask me the same question all the time. Michael, I have some cool data science

17:48 project or notebook that I built. How do I share it with my users, stakeholders, teammates? Do I need to

17:54 learn FastAPI or Flask or maybe Vue or React.js? Hold on now. Those are cool technologies, and I'm sure you'd

18:01 benefit from them, but maybe stay focused on the data project. Let Posit Connect handle that side of

18:06 things. With Posit Connect, you can rapidly and securely deploy the things you build in Python.

18:11 Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, ports, dashboards, and APIs. Posit Connect supports all

18:19 of them. And Posit Connect comes with all the bells and whistles to satisfy IT and other enterprise requirements.

18:26 Make deployment the easiest step in your workflow with Posit Connect. For a limited time, you can try

18:32 Posit Connect for free for three months by going to talkpython.fm/posit. That's talkpython.fm/posit.

18:40 The link is in your podcast player show notes. Thank you to the team at Posit for supporting Talk Python.

18:47 One example that I can give from over that stuff that I'm working on is I'm definitely using HTMX over

18:53 at Talk Python training, right, for our courses. And I added this little tag cloud. It's not quite a cloud,

18:58 but a bunch of different things you can explore. So when you load this page, actually, one of the

19:02 things that's really challenging is it has the price in your local currency. So it figures out where your

19:07 IP, where you live. In that currency, the prices of those things, you know, outside of the US change a

19:13 lot. It's super, sometimes it can be really slow to figure out what the price of every course is,

19:18 if there's sales and you're in this country and that applies in this way. So all these prices are

19:22 all calculated with HTMX. So it loads normally without the prices, then probably by the time you

19:28 get to it, the prices are already there automatically. And then as you click around, you get, this is all

19:34 like, as you click these little tags up here, you can even click on the HTMX tag and see you have

19:38 three HTMX courses, right? With last Django and one that's just kind of uses it. But all of this

19:43 stuff, this is no JavaScript on this page, at least not doing any of that is all just HTMX, right?

19:48 Yeah, that's great.

19:49 It's beautifully good. It's so good. I've certainly enjoyed working with it. But let's talk a bit about

19:55 your writer. Like, let's talk about, you know, spend the rest of time on your story, how you started

20:00 using HTMX. I mean, you've given us some of the sense, but let's talk about the app that you were

20:06 building, right? You had this team of fairly junior developers. What's the story?

20:10 At the time I was working for a nonprofit training provider in South Africa, and we used to have

20:17 everybody on premises in this place called JP's town, which is really a dodgy place. And it was great.

20:23 It was, it was a lot of fun, but then COVID happened. And so we had to figure out how to support

20:27 everybody remotely. And so it built an LMS. So initially we like looked around that LMS means

20:34 learner management system. We had a whole lot of learners. We had, I think there were about 150 at

20:39 the time. And we needed to figure out like how to support them from home. We couldn't just be like,

20:44 come back next year because the, like partially we couldn't let them down. Partially the funding

20:49 model wouldn't work and all sorts of things. So we need, it was an insane time. It's kind of normalized

20:53 in our history because it's, we've moved past it, but we got to remember that's an

20:57 experience. That was a disturbing time.

20:59 So many people have horror stories from, from then I was like, this was hard. It was like super,

21:04 super stressful, but in the end we ended up with this cool thing. So like a lot of LMSs exist. You

21:11 can get one off the shelf and they're a lot like very clever textbooks that track learners over time.

21:16 But for us, we're training, we are training software developers. And so we wanted something more

21:22 than a textbook. We wanted to train professionals. And so we ended up building this thing from the

21:27 learners perspective. It was a Kanban board and then they could move cards around on the board to

21:31 do different things. They could like start a project and then we'd create a repo for them and

21:36 make, add them as a collaborator and protect the main branch and all of that good stuff. And then we could

21:41 get them to review each other and we could track all that and display it in the front end.

21:44 Right. Try to teach them get and GitHub and PRs and all that. Yeah.

21:49 Yeah. It was so cool. Like by the time they got to work, like they're always very nervous getting

21:53 into their first job. And then they'd say like, this is familiar. Like we know how this, and that was

21:58 really cool.

21:58 I'm teaching people stuff here actually. That's weird.

22:00 Yeah. It was great.

22:03 Exactly. That's cool.

22:04 Yeah. So I built this thing out and managed to keep training the people and it worked. And then it was like,

22:10 okay, this thing is pretty rough around the edges because we built it in self-defense and

22:15 like, I hope this works. So we needed to build more on it. And we were hiring a lot of junior

22:24 developers because we were training like very, very beginner stuff. So if you want to teach a person

22:31 what a return statement is or what a loop is or anything like that, then you don't need a senior

22:35 developer or like a senior lecturer. You need somebody who understands what a loop is and what a return

22:40 statement is. So we had like all these juniors running around, like helping out and they needed

22:46 to build stuff for their own growth as well. And their own, like if they don't build stuff and then

22:51 built and it's sad. So, so yeah, they were trying to get them productive on the stack, but it was

22:58 very, very difficult. So for me, I'd been working on react applications and I've been working on Django.

23:03 And so for me, it was fine. I could just like, I could keep the whole thing in my head,

23:07 but yeah, it was just, it was just really tough for them. I think there is a little bit of an art to

23:13 making a junior developer productive, but like, I just was not figuring it out. So I tried this for a

23:19 while. And then one day went to a DjangoCon US and I saw Chris May's talk that spoke about

23:25 HTMLX. And I was just like, maybe this is worth a try. I was like, okay, I'm just going to proof of

23:30 concept it and see if I can build the weirdest parts of our application in HTMLX.

23:35 If you're asking, will it work? You're like, this is the most crazy interactive bit. And if it can do

23:40 this, the other stuff is easy. Like switching from logged in to log out or whatever. It's like,

23:46 yeah, okay, that's nothing, right?

23:47 Most of our functionality was around this Kanban board. So I was like, all right, let me just

23:51 make some cards and make some columns and see if I can shift stuff around. And it all worked out

23:57 really well and it wasn't super hard. Like I think one of the challenges with HTMLX is that it's very

24:03 easy to build like spaghetti templates because you have like the main template and all these partials

24:09 and you need to, and then all these URLs that are pointing to the partial. So it is possible to get

24:14 yourself in a bit of a tangle there. So you need to arrange things nicely. But yeah, the process was so

24:20 smooth that I was like, let me try this. So our application was this Django app on the back,

24:25 exposing a bunch of APIs with Django REST framework. And so the idea was to just, instead of like,

24:31 we'd leave the React app as is and would keep on working. Meanwhile, we'd, we just build out some

24:36 like perfectly normal Django views to do the HTML stuff. And then we could move everybody over to the

24:42 new, the new application. So the new front end was part of the original Django app. So we didn't,

24:48 we didn't rebuild absolutely everything. We just rebuilt that part. And generally speaking,

24:53 if somebody suggests rebuilding a thing, I worry, like, usually it's a bad idea. Usually it's like,

24:59 yeah, a fool or something. Yes. I've had to stop myself many times.

25:05 Do you know that David, Dylan BD it is? Yeah. Check. I'll put a link in here. He's got some,

25:12 some amazing parodies and one's it's a six and a half minute parody of American Pie. We're going to do the

25:18 big rewrite and it's, it's glorious. So I'll link it, but you should be afraid, right? This is

25:23 something that like, we're going to rewrite it. And basically the song is here's the eight version,

25:27 the eight different languages. This thing's previously been written in, you know, it's

25:32 with some things working times, even if it's not perfect, you just.

25:35 Yeah. And it was also like rewriting it in order to optimize for this team that was mostly juniors.

25:40 And so I was like, is this like, is this me being crazy? Like there was a lot of,

25:45 yeah, I was, I was very unsure. So I tried everything out and it, and it worked and it was

25:50 fun and it was like, like straightforward to write for this like small thing. And then I was like,

25:55 let me see how the team works on this. So I gave them a bunch of little tasks to do. I was like,

26:01 implement this, try that, and everybody was productive.

26:05 How did they receive it? When you, when you introduced this idea to them after they'd been

26:09 living in react and redux and all these things, they were happy with it. I think at first a little

26:14 bit skeptical, but then once I started going, like I did get feedback from them. I make a point of

26:20 getting feedback from them and they were like, this HTMX thing is way better. So that's great.

26:26 Like, wait, what's the trick? Why does this work?

26:29 So they went with it, but, and then they succeeded and they were happy and productive,

26:34 which is great. And like, even people who needed like way too much of my support,

26:37 like people who I had to like really sit with and pair with, like just to do like anything,

26:42 they were suddenly able to do stuff that was meaningful. So I think for me, that's one of

26:47 the things that's so exciting about HTMX. It's like, I've been working and training for so long

26:52 and I've been like fighting the fight of like getting junior developers job ready for so long that

26:59 I'm aware of many problems in the tech education ecosystem and the junior hiring ecosystem. And

27:04 like the fact that entry level positions are like too hard for people, like it's a problem. And now we

27:12 have tools that make web developments approachable again. So like I'm singing this HTMX song because I

27:18 think it's going to change the industry in, in some pretty big ways. I think it's already making waves,

27:23 but I'd like them to happen faster and bigger. Yeah.

27:27 I think it will as well. And you know, I think the current web frameworks are really good and work

27:33 really well with it. But I wonder if I wouldn't be surprised to see kind of like FastAPI came along

27:38 and just said, Pydantic is the essence of this thing. And Pydantic changed a lot of data exchange,

27:43 a lot of data validation. I'd wonder if some framework comes along and just says,

27:47 HTMX is just ground up part of this thing. All right. That'd be interesting to see what that looks

27:53 like. It would be interesting. I think there are definitely useful patterns and how to,

27:57 how to do different things. And people are building tools around it or tools that complement it in

28:02 useful ways. So we spoke about Alpine JS. There's another thing called template partials from

28:07 Carlton Gibson and he, and that's really, really great. Something like this is super needed to make

28:14 the code go from like, all right, we can do this too. Oh, that's nice. Yeah. Yeah. Yeah.

28:18 That's really unspaghetti fires it, which is fantastic. Like this is one of my favorites at

28:23 the moment. I have a one that I created for a Jinja card Jinja Jinja partials and also a chameleon

28:30 one. So since I'm, I wasn't using for that, that a course example, this is actually chameleon. So I

28:36 use the chameleon partials, but something like this is required in, you know, Carlton does great work,

28:41 right? Yeah. Known for it. So you're using this as part of, as part of your, your site. So not that

28:46 original site. I only heard about this later on, but now I use it on everything. Yeah. On all of my

28:53 HTMX things, I use this. Right. Tell the Django people, what does this do? Like why, why do you

28:58 need Django template partials instead of just Django templates? So it's just about organizing your code

29:04 in a way that's a bit cleaner. So if you think about how you would render templates from your different

29:08 views. If you had like a main page and then that page had a bunch of HTMX things happening that

29:16 made calls to the backend to different views and those different views use different templates,

29:21 then even though all those templates are associated with the same page, it kind of ends up being a bit

29:27 of a mess. You've got like a lot of different like partial templates. So you need a cool naming convention for

29:32 that. Like, is this a page? Is this a template? And it gets just a little bit, a little bit messy.

29:38 And you need to switch between files all the time to see, to see what things are associated with each

29:43 other. Let's say you've got like five pages and each of them have like five different partials

29:48 associated with them. Suddenly it's a lot of files and you need to organize things somehow.

29:53 So what Django template partials does is it allows you to like, like say you've got like a main page

30:00 file to-do list, right? You could define a partial template for a to-do item within that same file,

30:07 and it won't get rendered until you say render this thing. So you can like, when you render your

30:12 template for the first time, you can just say, okay, loop over the to-do items and use this partial in

30:18 place and render the things. And that's great. But then the other thing that you can do is that you

30:24 can like in a view, you can choose to render a template, but you can choose to render a partial

30:30 within that template as well. And so let's say you've got a, like a little form that says,

30:35 add a new to-do list item. Then you'd submit that form. And then the view would look for the partial

30:44 to-do list item within the page that you care about and it'll render that. And so it just ends

30:48 up being that like everything is tidy and together. And it makes sense because like the to-do list items

30:54 are only used in this page and those items are only used in that page.

30:57 One of the big challenges that you'll quickly run into with this style, this HTMX partial exchange

31:04 style is when you show the page originally, you want just the server rendered version, which includes,

31:10 let's say your to-do items. So you need the HTML for the to-do items in the main page. But then when

31:15 you make changes to it, you need a little fragment of that same HTML to put a new to-do item in there

31:22 or to edit one or something. And if you're not careful, well, then you have multiple copies of those

31:27 laying around and somebody updates the design for one. And then it doesn't update the partial one that

31:33 you wrote, which is a copy. It's not pretty. So finding a way for reuse like this Django templates

31:38 partials, it's pretty required. I think if you're going to stay sane, it's like functions are required

31:44 to write code. You know, it's pretty much like that. Right?

31:46 I think so. Like you can get away with just using like lots of files and you could keep things dry with

31:52 lots of files, but it gets like, it's very spaghetti unless you're, you put a lot of effort into organizing

31:58 it and then keeping it organized because people will make PRs that do like all sorts of weird things.

32:03 So yeah, it's, it's not good to have to like monitor that everything's organized. It would be better if

32:10 it was just there done by default. Like the read next to the default behavior is correct. Yeah.

32:14 Yeah. So, so grab, grab a file, a library for that.

32:17 This portion of Talk Python to Me is brought to you by Bluehost. Got ideas, but no idea how to build a

32:25 website. Get Bluehost with their AI design tool. You can quickly generate a high quality,

32:31 fast loading WordPress site instantly. Once you've nailed the look, just hit enter and your site goes

32:36 live. It's really that simple. And it doesn't matter whether you're a hobbyist entrepreneur or just

32:41 starting your side hustle. Bluehost has you covered with built-in marketing and e-commerce tools to help

32:47 you grow and scale your website for the long haul. Since you're listening to my show, you probably know

32:52 Python, but sometimes it's better to focus on what you're creating rather than a custom built

32:57 website and add another month till you launch your idea. When you upgrade to Bluehost cloud,

33:01 you get a hundred percent uptime and 24 seven support to ensure your site stays online through

33:07 heavy traffic. Bluehost really makes building your dream website easier than ever. So what's stopping you?

33:13 You've already got the vision. Make it real. Visit talkpython.fm/bluehost right now and get started today.

33:20 And thank you to Bluehost for supporting the show.

33:23 Let's talk about the before and after stack. So before you talked about React, but tell us all the

33:31 pieces involved and then what does it look like today?

33:33 Redux was for state management and then I used Redux Saga mostly for data fetching stuff so that I could

33:40 handle loading spinners and I could see the status of different requests over time and that kind of

33:47 thing. Then I used Material UI because my front-end make pretty skills aren't the strongest. I wanted a

33:56 component library that would just work and that was the chosen one. Then on the back end, it was Django.

34:02 Django REST framework is fairly well known. Then I used a thing called Django Guardian because I needed

34:08 object level permissions on the different model instances. So for example, we had this Kanban board

34:14 and there were cards on this board that people could move around and different people would have

34:18 different permission to different cards. So we had things like one learner would be working on a card

34:24 and then they'd ask for a review and then another learner should be able to review that. But we wouldn't want

34:30 to let just any learner look at their code because then it would cause all sorts of problems. So it's

34:36 like, okay, this person has finished this project so we can add them as a reviewer on this card. And so we

34:42 needed to be pretty particular about which of our users could see different things. It wasn't super

34:48 straightforward in that this person can see this. It was like, this person can for these reasons. Django

34:54 Guardian is really, really cool. And then Postgres.

34:56 That's a cool library. Maybe people could find a nice use for that one. That's the one that's new

35:02 to me. Yeah.

35:02 That's really nice. And you can even do things like when you query a database and you say,

35:08 fetch me all the cards, you can do something like, fetch me all the cards that Bob can see. And so

35:13 long as it's configured well, then it can do that sort of thing, which is very, very helpful.

35:19 Wow. That's really cool. So you don't have to go get all the cards and then,

35:23 yeah, who have all these different permissions and then construct some query that comes up with it.

35:29 Yeah. Very nice. I love it.

35:30 And that plugs into DRF as well. So like your serializer or your view set, I haven't worked

35:37 in it in a while, but the query that gets used when you access like a list API endpoint, you could just

35:45 apply that automatically as well. So you don't need to build it in that case either. So it plugs into all

35:52 of the things. It's a little bit weird at first to get used to, and then it's just fantastic.

35:56 And now I'm guessing much of the front end stuff is probably not there.

36:00 The old application still exists, but it's not, but it's like the HTMX based version would just

36:06 be a drop in replacement. It's like, go to this URL instead kind of thing.

36:10 Yeah.

36:11 Now that it's done, you said you used to work there, but you don't work there anymore. Is that right?

36:16 Oh yeah. Not anymore. As of a few months ago.

36:18 I guess that's recent enough to say sort of, how is it going now? Right? How are,

36:22 how's it being used? How are people, you know, is it still going strong as the technology?

36:26 I hope that they're still building on it. There was some, some weird things happening

36:31 at the organization before I left. So yeah, I expect, I hope that everything is still going

36:36 smoothly, but I haven't been plugged in for a while.

36:38 Let's give a, maybe a quick shout out to this video, this other Django con talk. Gosh, why is,

36:46 I need to sign into my YouTube premium on this browser, but this real world SaaS product example

36:53 from this guy in France, David Gilead. Yeah. That, that one you said was a pretty good example. If you

36:59 need like a walkthrough case.

37:00 Yeah. So that one, I didn't see it live. I saw a video of it after the fact, but it is

37:05 like the ultimate HTMX demo. It shows this guy really makes it dance. It's, it's quite an amazing

37:11 thing to see. So highly recommend that. Yeah. This guy, David goes through and says, you know,

37:16 here's our complex SaaS product. And let me walk you through all the features. I feel like this would

37:22 be a pretty good one. Your article as well. And then this video, if, if you want to say,

37:27 make a case to your team, like, Hey everyone, can we consider doing this? And yeah, I'm sure

37:33 right off the bat, you'll get some folks say, well, no, we have to use react because it's interactive.

37:37 This, you interact with that part and it changes that part. How are we going to possibly pull that

37:41 off? It's like, yeah, no, that's, that's totally possible. Yeah. I think the main arguments people have

37:45 against it are like scale, but that argument doesn't make super a lot of sense to me. I think it might

37:50 be complexity scale that they're concerned about, but I think things like template partials solve

37:54 a lot of that problem. And then there's, can it do the things and this solves that problem. And then

38:01 is it really, is it really so much better for the team is the other question. Is it just another

38:06 fashion? Is it just another fad? And that's something that's sometimes hard to get across.

38:11 I think that my article will do a good job of explaining why it's a good idea. Because I had to explain

38:17 this to non-technical stakeholders. So I was like, okay, I I'm making this crazy decision and this is

38:22 why. And so I think I've got the argument down. Go, go read that article if you need to convince someone.

38:28 But I think the other thing to mention is the, the full stack that I've moved to in the end.

38:33 Yeah. So HTMX, we spoke about Django. We spoke about an Alpine. We spoke about now,

38:38 if you are running a, a react front end or whatever you would test the front end in a react way,

38:44 like you would use tools that are appropriate for that. So, and so you need to think about

38:48 different ways to, to test things.

38:49 Would that be like Selenium or something? Or what are we talking?

38:53 So I like Playwright quite a lot. So you could do it with Selenium, but that would be a,

38:57 like, it would include some pain. Playwright is very, very lovely to, to work with. So it's like Selenium,

39:04 only with all sorts of useful test goodies built in. So like, you can get it to take videos of your

39:11 failed tests and it's got useful flags for like running your tests on different browsers and you

39:18 can like keep a trace of things. It's got interesting debugging stuff built in and you can just run it

39:24 with pytest. And so yeah, Playwright is a big part of it as well.

39:27 Yeah. Playwright is really nice. You know, one thing that just occurred to me around the testing,

39:31 if you've got a rich JavaScript front end sort of thing, you have to use something like Playwright

39:36 or Selenium where it does a full browser request render of the page to interact with it. Right. And

39:42 you can also do that with HTMLX, but a lot of these web frameworks, you can just in your, your web test

39:49 code, you can say, create like a, a testing instance of my server. Right. And then make it do this request

39:56 and then see what the response came back without nearly the same overhead. And because this stuff all happens

40:01 on the server, I guess you could just write a unit test, like a web test against a fragment response. Right.

40:08 Yeah, you can. So you can, you can write little unit tests that check different things like that.

40:13 But since a lot of the interactivity is defined within the HTML tags, your unit tests won't,

40:18 they won't be able to cover like if the unit clicks this and that happens. And so that's where,

40:24 that's where something like Playwright will come in. Yeah. You'll still need that to,

40:27 but maybe less Playwright is needed than otherwise is what I was thinking. Yeah.

40:31 Definitely. I think one of the, the anti-patterns I've seen is too much Playwright where they're just

40:35 like, why don't you use Playwright for everything? And then your tests are ridiculously slow. And it's

40:39 like, you could have just, you don't even need to test the view. There was this function that you

40:44 wanted to test. Exactly. You're not Shakespeare. You don't need that much Playwright. Come on.

40:47 Yeah. Yeah. Playwright is a cool thing. I definitely recommend it. Yeah. Yeah. And it plugs into Django,

40:53 really smoothly as well. So you don't actually, so Playwright, it spins up a browser and points it at

40:58 a running instance of an application in order to like test the things. But with Django and pytest,

41:05 you can use a fixture to spin up like a test version of your, of your application. It's kind of like

41:10 run servers running there in your tests anyway. So it integrates very, very smoothly. Yeah. Makes it

41:16 very convenient. Yeah, absolutely. You know, one of the things you wrote a lot about, and you,

41:21 you mentioned this, but you kind of flew past it a little bit was you said, am I crazy for optimizing

41:27 for junior developers? Right. On the other hand, optimizing for simplicity, even if you're,

41:34 you're an expert, right? You don't just cause you can do all the steps and all the complexity doesn't

41:39 mean you should constantly be doing those steps. Right. Yeah, definitely. I think there's a case for

41:44 optimizing for simplicity here. What do you think? I completely agree. I mean, if you,

41:48 if you can just like take the, the cognitive load of developing your app and then make it like simple,

41:54 so you can focus on actually solving problems instead of wiring, I suppose, and life gets a lot,

42:00 gets a lot easier. So yeah, simplicity rocks. It's fast to develop, but things like, like HTMX make

42:06 your code way, way smaller than, than it would otherwise be. So it's not just simple. It's not just that

42:11 it's less convoluted. There's also less of it. And so there's less to test. There's, there's less stuff

42:16 that can, can cause bugs. And most of the like front end interactivity is handled by another library

42:23 that's really well tested. And you're just doing these like tiny little things that are easy to reason

42:27 about. And so it's just, it's robust and clean. So yeah, I do think it's worth optimizing for simplicity.

42:36 I mean, it made it, it made everybody more productive, the juniors and me as well. So

42:41 top notch. I'm constantly in pursuit of, of trying to keep things simple. You know,

42:47 if you go over to the HTMX site, I don't know if you've, you've looked at this section, but they've

42:52 got a, you know, Kirsten has this essay section, which, you know, it's not quite a blog, but it's

42:58 kind of a blog, you know, it does. It's not, not in order. It's in sort of category, whatever.

43:03 And these are all nice. One thing that's nice is he has a, on the other hand, here's a couple of

43:07 examples why people didn't pick it. Right. But he's got a whole section on complexity. Very, very bad.

43:12 Yeah. But if you keep going, there's a bunch of memes. The memes are so good, aren't they?

43:18 They are fantastic.

43:19 And one of these super definitely applies is, you know, there's one that says HTML plus a backend for

43:27 like the, you know, it's got this bell curve for the beginners. Like, oh, this is what I want.

43:31 That as you get a little bit better, you're like, oh, I need all this, all this complexity,

43:35 all these layers. And then, you know, sort of the, the Jedi Knight at the end is yeah.

43:40 HTML in the backend, right? Going, going through this path and like, you don't waste any.

43:44 You do exactly.

43:45 These two ends. Yeah. I don't necessarily want to characterize beginners to look like this,

43:49 this character in this meme, but you know, I think the meme still speaks, speaks to this somewhat. Right?

43:55 Yeah. Yeah, definitely. Definitely. Yeah. I think it's about like when I, when I teach people to code,

44:01 when I teach people like the very basics of code and like something I see with very junior developers,

44:06 is that they try to show off and be like, look how fancy I can make my code. I can do all of these

44:11 complicated things. And then you get them to think more like Jedis and say, like, don't waste any moves.

44:16 Like, like how you wouldn't be flailing about like, this is kind of like flailing.

44:22 And HTML, HTML does that for you. It just lets you like move directly towards your goal instead of

44:29 having to like move around it. Yeah. It's pretty glorious. So I know that you do a lot of teaching.

44:35 Maybe you said you work for this local company that was, you did the Kanban board app for and so on.

44:42 Now, what are you up to? Still teaching just differently. It was really cool working there.

44:46 I was there for a long time, like five years in total, which is really long. And it was super

44:51 successful. So like since 2020, basically everybody who passed our courses ended up getting good jobs,

44:58 like very, very close to a hundred percent of the people who passed. And the people who didn't pass

45:02 was like actually kind of small, like 7%. And then there's lots of reasons for that. But yeah, I learned a ton

45:10 from being there. That was in person, but pre-COVID, right? Yeah. So post-COVID, we actually got way,

45:14 way better because we had better monitoring of individuals and we could do things like track

45:19 people's cards on their board, moving around. And then from that, you can say like, oh, this piece

45:24 of content is dodgy. Like it would give us as educators, a lot of feedback about what we were

45:29 doing. Because if a person was stuck and you're like, I explained this thing great. And then they're

45:34 still stuck. You're like, I didn't explain this thing great. And so like the way that the teaching

45:38 mechanism was built was like really good for the students. But like, if we as educators didn't do

45:45 a good job on something, we'd know about it and we'd have to fix it. And I think that honed the craft

45:50 quite a lot. So I learned a bunch there. Now what I'm doing is I want to spread those skills in different

45:56 ways. So there's a whole lot to what I'm doing. One thing I want to do is help educators themselves.

46:02 So I've got this thing called the Guild of Educators, because I always wanted to guilt.

46:06 And it's got a whole lot of people in there who are like, it's a free community. Come and join.

46:12 It's a bunch of education nerds who talk about education with each other. It's a support structure,

46:18 because I think educators need support structures. And it's a place to share, share learnings and

46:25 share resources and opportunities and things like that. So it's still very new, but that's one part of it.

46:31 I want to offer teacher training and things like that. But I also...

46:34 Just like we have junior developers, you have people got to start somewhere with teaching and

46:39 teaching online is different, all that.

46:40 It's hard because there aren't really good resources for tech educators. There's

46:45 like, if you dig into the literature on how learning works and how teaching works, it's

46:51 like, it's all either very academic. And so it's a little bit hard to pass and it's not

46:56 like, it's just not packaged well for the people who need it, or it's packaged in the wrong way.

47:01 So I came across a code school recently who I was like, how do you handle your teacher training? And

47:06 they're like, we outsource it to these guys. And they showed me this other organization that does

47:10 teacher training. And it's like, I dug through their courses and one of their selling points was like,

47:16 our teacher training courses are so versatile that they can be used for florists and personal trainers.

47:22 So I was like, yeah, maybe not appropriate for what we're up to here. But that's what people are relying

47:29 on. And that's like the best that the industry has to offer. So I think there's a big hole in the

47:35 education space and I want to work to fill that. Yeah. So that's part of what I'm doing. And the other

47:40 part is offering technical training. And this is partially because you've got to practice the craft,

47:47 partially because I want to create opportunities for educators to get good, partially because I

47:53 really like teaching this stuff. So there's all different reasons why I'm teaching. So right now,

48:00 I'm building out a bunch of small workshops that cover different skills and are fairly standalone.

48:05 And those are Lego blocks that will combine into something much bigger in the future. But for now,

48:11 the first workshop that I have on offer is all about Django and HTMX. So it's pretty exciting.

48:18 So it talks about the stack that we just spoke about. And we didn't mention Tailwind, but Tailwind is great

48:23 as well. It means that I can make front ends that look reasonable. So long as they're in-

48:27 That's right. You said you had used Material UI previously to make it good-ish. And Tailwind is what used

48:33 in the new version? Yeah, I'm really enjoying Tailwind. Yeah. So the idea with this little workshop,

48:38 I ran it as part of DjangoCon US recently, it was super cool. I got, I don't know,

48:44 there were way too many people there, which was great, but also it was a lot to solve. It was like,

48:50 whoa, all of you. So that was super cool and went really well. The basic idea is that I want to show

48:57 how to build a CRUD application using the stack of tools in a way that sets people up to be able to

49:04 build their own stuff. And part of the workshop is in fact, taking these tools and building your own

49:09 thing. And so for people who are kind of early on their career, in their career, they can get some,

49:15 like the starts of decent portfolio projects out of it. People built all sorts of interesting things.

49:20 So like the one person built this, their own personal learner management system for like their own

49:25 learning, which was really lovely. Somebody built a music store. Somebody else built a, what was it?

49:31 Like a chore manager for, for their family so that they don't fight so much. It was great.

49:37 Oh, that's interesting. Yeah.

49:38 Yeah. And all with Django, HTMLX and Alpine JS and the others. And the other thing that's cool about

49:44 this is it's, it's a CRUD application. Like I'm, I'm teaching people the, the bits and pieces that

49:49 build a CRUD app. And like most of the internet is CRUD applications because it's for the audience.

49:55 Like if anybody hasn't heard of CRUD, it's create, read, update, delete. Like that's most of what you

49:59 need to do on the internet. And so if you get the patterns down for like a simple CRUD app, then you

50:04 can do some pretty hardcore things with it. So yeah, this is, so it's covering that. The workshop is small.

50:11 So it's like, I'm, I'm keeping things very, very small intention intentionally because I believe in

50:18 the power of teachers and I want to make sure that everybody gets attention and then gets the support

50:22 that they need. And also because of the people who tend to come to these kinds of things have different

50:27 backgrounds. So some people need help here. Some people need help there. And so you need to keep

50:31 like a good ratio of teachers to students. So yeah, expert led, high support, small group,

50:37 all of that good stuff. Quite exciting.

50:39 That's very cool. I'll, I'll link to this workshop in the show notes. People want to check it out.

50:42 And it's out of time, but it's remote. So people can attend from wherever, right? You don't have to be

50:49 near you.

50:49 Yeah. So you don't need to be in South Africa. In fact, I made it in US Eastern time because

50:55 strangely enough, most of the people who read my blog are in the US. Like, so it's US and South

51:02 Africa and it's, it shifts and changes around. But part of the reason I'm marketing it to the US

51:08 is because I want to be able to fund training Africans and like there, there just isn't as much

51:15 money on the side of the world. So yeah, I want to be able to make doing good in the tech education

51:22 space into something that's financially sustainable. So that's why the US, and that is why it's,

51:28 it's priced in dollars. Yeah. So you guys can have a discount code, talk Python, talk underscore

51:34 Python. I think that was the one I said, let me just share.

51:36 Yeah, I'll put it in show notes. People can find it there.

51:39 Awesome. So you'll get 10% off. And then I also want to give like another 10% to something. So

51:47 Foxley wanted me to give 10% from their discount code to, the DSF. So that's another code that's

51:53 out there. So that's fantastic. I've, I've definitely benefited a lot from the DSF. So that's really,

51:58 really cool. So since this is your podcast, should, should the further 10% go to the DSF or the PSF or

52:05 the DjangoCon Africa event.

52:08 I vote DjangoCon Africa.

52:10 Fantastic. I was hoping that you'd say that. Yeah. I love DjangoCon Africa. It's so freaking cool.

52:15 Speaking of a conference and talks and stuff, Kim out in the audience says,

52:19 in a few weeks, a really good talk Sina gave at South Africa PyCon, a few weeks ago,

52:25 should be online. Power to the people who teach people to code. So that's cool, right?

52:30 Yes. That's the longest title I've had for a talk ever. Thanks, Kim. Yeah. So I did that talk at

52:36 PyCon South Africa and I also did it, I did a longer version of it at DjangoCon US as, as a keynote. So I was

52:43 super, super happy that I got that opportunity. It was so cool. But yeah, it just talks about

52:48 kind of how I think about teaching and how I, that's how I think about teaching and the mechanisms that,

52:54 that we set up. So, so like, how does mastery based learning work and how do you actually get,

53:00 how do you engineer a education system so that it sets people up for success and not like either

53:06 frustration or boredom? Because there's a lot of, a lot of things that are weird about the traditional

53:11 systems. Yeah. So it talks about that, but then it also shares a bunch of lessons for individual

53:18 educators on the ground. So, so that thing that I was talking about earlier about how

53:22 we as educators in the system, we're getting like a ton of feedback about our, our own,

53:27 the quality of our work that gave us space to, to figure out a lot of like hard hitting things.

53:33 So it's, it's kind of the 80, 20 of what teachers or would be teachers should, should focus on.

53:40 And I think it's powerful because a lot of like everybody teaches, I mean, you teach people,

53:44 teach new team members, like there's a lot of volunteer teachers as well, which is great.

53:50 I mean, there's stuff like, I think we, I think doing this kind of a, these presentations,

53:54 this, this kind of teaching is a super cheat code for leveling up your own skills.

53:58 Yeah, definitely. There's this thing called protégé effect, which is a well-studied thing.

54:02 So when people say teaching is a great way to learn, it's, they're not just being squishy.

54:08 Like it's legit. It's really, really legit. And there's, there are a lot of mechanisms behind it.

54:15 It's like one of the simple ones is like teaching is spaced repetition and recall, and that helps you

54:21 remember your stuff. Another one is like, people will ask you weird questions that you wouldn't

54:26 expect. And so you look at your own knowledge from a different direction and you build better mental

54:30 frameworks or more robust mental frameworks. Like some people are good at building mental frameworks

54:36 frameworks and some people aren't as good. And a good way to like get a person to build good mental

54:42 frameworks is to ask them weird, like left side questions about the stuff they know and get them

54:46 to look at things from different angles. So you get that from, from the people you're teaching. It's,

54:50 yeah, it's really, it's a beautiful thing.

54:52 Yeah, it really is. It definitely rounds out your knowledge and makes you think deeply about some

54:57 of these ideas that you just maybe glossed over.

54:59 Yeah, yeah.

55:00 This is probably a good place to leave it. Let's, I want to give out one more resource real quick for

55:04 people is just awesome.htmx over on GitHub. I don't know if you poked around this, but it's got many,

55:10 many examples of tools and libraries for htmx and Python, but also in a ton of other languages. So that's super cool.

55:18 Apparently there's a flask htmx tailwind one and one for sockets or maybe htmx over web sockets.

55:26 I don't know. These are all look pretty cool. So people can check them out, but yeah. And I

55:30 definitely want to recommend people check out your essay and yeah, they could take these ideas and run

55:36 with them. Yeah. Cool. Well, Gina, thanks for being on the show. It's been great to talk to you.

55:41 Yeah, it's been great to talk to you too. This was a lot of fun.

55:43 It was. Bye all.

55:44 Cheers.

55:45 This has been another episode of Talk Python to Me. Thank you to our sponsors. Be sure to check

55:51 out what they're offering. It really helps support the show. This episode is sponsored by Posit Connect

55:56 from the makers of Shiny. Publish, share, and deploy all of your data projects that you're creating

56:01 using Python. Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs.

56:09 Posit Connect supports all of them. Try Posit Connect for free by going to talkpython.fm/posit.

56:16 P-O-S-I-T.

56:16 And this episode is brought to you by Bluehost. Do you need a website fast? Get Bluehost. Their AI builds

56:23 your WordPress site in minutes and their built-in tools optimize your growth. Don't wait. Visit

56:29 talkpython.fm/bluhost to get started. Want to level up your Python? We have one of the largest

56:35 catalogs of Python video courses over at Talk Python. Our content ranges from true beginners to deeply

56:41 advanced topics like memory and async. And best of all, there's not a subscription in sight. Check it

56:46 out for yourself at training.talkpython.fm. Be sure to subscribe to the show, open your favorite

56:52 podcast app, and search for Python. We should be right at the top. You can also find the iTunes feed

56:57 at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on

57:03 talkpython.fm. We're live streaming most of our recordings these days. If you want to be part of

57:08 the show and have your comments featured on the air, be sure to subscribe to our YouTube channel at

57:13 talkpython.fm/youtube. This is your host, Michael Kennedy. Thanks so much for listening. I really

57:19 appreciate it. Now get out there and write some Python code.

57:29 I'll see you next time.

57:41 Bye.

Back to show page
Talk Python's Mastodon Michael Kennedy's Mastodon