Transcript #406: What's on Django TV tonight?
Return to episode page view on github00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
00:05 This is episode 406, recorded Monday, October 21st, 2024.
00:11 I'm Michael Kennedy.
00:12 And I'm Brian Nockin.
00:14 And this episode is brought to you by Scout APM.
00:17 We would love to tell you more about them later.
00:20 If you want to stay in touch with us, send us show ideas.
00:23 We love it when people send us ideas like, hey, you should check out this because...
00:28 Brian, usually it starts with, I'm sure you've heard of this, but here it is.
00:32 I'm like, I've not heard of that.
00:33 And I really appreciate you sending it.
00:34 So keep that kind of stuff coming.
00:36 It helps us a lot, right?
00:37 Definitely.
00:38 And even if we have, we at most get a couple duplicates.
00:42 That's fine.
00:43 Yeah, yeah, exactly.
00:44 If you want to stay in touch with us or send us things, find us on Mastodon or shoot us an email.
00:48 Links at the top of the show notes.
00:51 And do consider signing up for the newsletter.
00:56 The newsletter that Brian sends out every week just after the show comes out with everything
01:01 we've talked about written down there.
01:03 So you have it.
01:03 Just get an email if you don't have a time to listen.
01:06 Although we prefer people to listen.
01:07 That's always fun.
01:08 Yeah.
01:09 I just think it's nice that people don't have to like write notes down while they're listening.
01:13 They can just get it from the email later.
01:14 Yeah.
01:15 So pythonbytes.fm, click the newsletter button, enter your email.
01:18 Everything will be good.
01:19 Brian, I want to listen to what you want to tell us about first.
01:22 What's up?
01:23 I think people should pay more money to open source.
01:25 So I'm going to cover open source pledge.
01:29 And I'm going to hop over to the Django site to begin with, because that's where I found out about it.
01:35 Because the Django community, Django Software Foundation announced that they are supporting the open source pledge.
01:43 And what does this mean?
01:45 Well, the open source pledge is really simple to do.
01:48 All you have to do is you have to say that you're going to pay open source maintainers.
01:54 Minimum to participate is $2,000 per year per developer at your company.
02:00 So you don't have to count your salespeople.
02:02 You don't have to count the janitor.
02:05 Stuff like that.
02:06 But how many devs you have, $2,000 per year seems like more than reasonable, because you know you're getting that much value out of open source.
02:12 So you self-report.
02:15 So you pledge this, and then you self-report annually, click a blog or make a blog post to say how you've paid.
02:22 Well, there's a whole bunch of, if you take a look, there's a list of members already.
02:28 And I'm not sure how long this has been out, but the list of members includes people like Sentry, have 135 devs.
02:38 And they're pledging 3,704 per dev, which is pretty cool.
02:44 Laravel's in there, so it's not just Python people.
02:47 And yeah, a bunch of great names in here.
02:50 So what is this?
02:52 Oh, button down.
02:52 That's nice.
02:53 Even one dev.
02:54 They're doing 5K per developer, but it's just nice.
02:58 Anyway, so Django says, let's do that also.
03:01 And to help make the Django community more sustainable.
03:06 And I think this is great.
03:09 So they're pledging it.
03:10 I don't know how many devs the Python Software Foundation has now.
03:15 We know they have at least two full-time, but I think it's growing.
03:20 So that's pretty cool.
03:21 So I think this is a great idea.
03:23 And it's neat.
03:24 I pledge your support for open source.
03:26 It's an interesting time for money and open source.
03:29 And I do think it's a good idea as well.
03:31 But there's some crazy stuff.
03:32 Yeah.
03:33 See WordPress.
03:34 It's so insane.
03:36 But that's not pledging money to open source.
03:38 That's something else entirely.
03:40 I do want to put this up there, but I do want to point out there's a cool post by Armin Roeneker
03:47 who talked about the inevitability of mixing open source and money.
03:50 And also just give a shout out to Sentry, who I believe this open source pledge was their idea.
03:55 And Armin was behind the launch of it.
03:57 So well done, Armin.
03:59 Well done, Sentry.
04:00 You know, Sentry's a big sponsor.
04:02 Yeah, a big sponsor of Talk Python.
04:04 So, and I believe they sponsored Python Byte some as well, but certainly Talk Python.
04:08 But there's, if you want to see a bunch of interesting reading, I'll put that article in there as well.
04:13 But moving on, let's talk about TV.
04:17 Let's watch some TV, Brian.
04:18 Okay.
04:19 What's on tonight?
04:20 Catch the nightly news, Three's Company, Four, maybe some Django.
04:25 So I believe this project is put together by Jeff Triplett.
04:30 So well done, Jeff.
04:31 And it's called Django TV at DjangoTV.com.
04:34 And the idea here is these are videos from, it's like a kind of a little mini YouTube-like thing, sort of,
04:41 but for all the conferences.
04:42 So, you know, you want to see the conferences at DjangoConUS of 2023.
04:49 Boom.
04:49 There they all are.
04:50 You want to find all the videos about HTMX.
04:53 There are many because HTMX is awesome and so on.
04:56 Search for it and see friends of ours up there speaking and doing things like that.
05:02 So not a big, deep thing to go into.
05:04 However, it's nice, right?
05:06 Basically, it's a curated list with the descriptions.
05:09 You know, you always want to know, like, when is something published, right?
05:13 That's often the thing with conferences.
05:15 Like, I saw there was going to be a cool talk.
05:17 It happened three months ago.
05:19 Eventually, somebody's going to put it on the internet.
05:21 Probably, we think.
05:23 We're not entirely sure.
05:24 So you can come down here and just hit the RSS feed and subscribe to that.
05:29 And it'll just, all the Django videos start popping up when you subscribe.
05:34 Pretty cool.
05:34 Yeah, it's pretty cool.
05:35 And this is pretty new.
05:36 So if you've got old videos or new conference videos that are not listed here, especially Django-related.
05:43 Yeah, fix it.
05:44 Fix it.
05:44 Fix it indeed.
05:45 All right.
05:46 Well, that is my main one.
05:49 Now, before we move on, let me tell you real quick about Scout APM.
05:55 They're big supporters of Python Bytes.
05:57 So we appreciate that very much.
05:59 So if you are tired of spending hours trying to find the root cause of issues impacting your performance, then you owe it to yourself to check out Scout APM.
06:07 They're a leading Python application performance monitoring tool, APM, that helps you identify and solve performance abnormalities faster and easier.
06:16 Scout APM ties bottlenecks such as memory leaks, slow database queries, background jobs, and the dreaded N plus one queries that you can end up if you do lazy loading in your ORM.
06:27 And then you say, oh, no.
06:28 Why is it so slow?
06:29 Why are you doing 200 database queries for what should be one?
06:32 So you can find out things like that.
06:33 And it links it back directly to source code so you can spend less time in the debugger and healing logs and just finding the problems and moving on.
06:40 And you'll love it because it's built for developers by developers.
06:43 It makes it easy to get set up.
06:45 Seriously, you can do it in less than four minutes.
06:48 So that's awesome.
06:48 And the best part is the pricing is straightforward.
06:52 You only pay for the data that you use with no hidden overage fees or per seat pricing.
06:57 And I just learned this, Brian.
06:59 They also have they provide the pro version for free to all open source projects.
07:04 So if you're an open source maintainer and you want to have Scout APM for that project, just shoot them a message or something on their pricing page about that.
07:12 So you can start your free trial and get instant insights today.
07:16 Visit pythonbytes.fm/Scout.
07:18 The link is in your podcast player show notes as well.
07:21 And please use that link.
07:22 Don't just search for them because otherwise they don't think you came from us.
07:26 And then they'd stop supporting the show.
07:27 So please use our link, pythonbytes.fm/Scout.
07:30 Check them out.
07:31 It really supports the show.
07:33 Brian, over to you.
07:34 Yep.
07:34 So I'd like to talk about dependencies a little bit.
07:38 So projects have dependencies.
07:40 We often stick them in requirements.txt files or PyProject.toml files.
07:45 But there's a new PEP that just came out.
07:48 Well, it's been out for a bit.
07:50 It was created in 2023, November, but it just got resolved.
07:54 And so I think it just got accepted recently.
07:56 So the resolution date of 10th of October.
07:58 So PEP 735 is dependency groups in PyProject.toml.
08:04 And my first glance at this, I'm like, don't we already kind of have that in extras?
08:09 But that's addressed by this PEP.
08:14 So the idea is that we have other dependencies, not direct project dependencies, but extra stuff,
08:22 like when you're building your docs or you're running your tests or things like that.
08:26 So how do we specify those?
08:28 And there's a couple of ways that people have done it in the past.
08:31 One of them is the extras in PyProject.toml.
08:35 But preceding that, even before we had that, there were extra requirements.txt files.
08:40 So some projects have a main requirements.txt file.
08:43 And then some of them have a requirements.dev file or requirements.doc file or something or several.
08:51 And the problem with that really is that there's no standardization around it.
08:58 And then also there's not really a standardization about the requirements.txt file.
09:04 It's just whatever you can pass to pip install.
09:07 And so like even flags and stuff, which is actually kind of fun.
09:11 Anyway, tangent.
09:13 But so that's, I don't think a bunch of requirements files is the right answer.
09:19 How about extras?
09:20 Well, I was surprised to find out that the extras that you can put in extra dependencies
09:26 or optional dependencies, these are, these might not, I learned that they're, they're using,
09:33 they're, they might not be resolved.
09:36 What am I trying to say here?
09:38 They, they're not guaranteed to be statically defined.
09:42 They could be dynamically defined.
09:44 And, and that I just didn't even know.
09:46 So we do need it to be statically defined so that, so that, you know, tools can read it easily.
09:52 And there's other limitations around using the extras as well.
09:57 Also, I think it's just, I think extras confuses people.
10:00 I know it's a feature of pyproject.toml, but I was confused by it at first, had to like, like
10:06 study it for a bit.
10:07 And it just somehow doesn't, doesn't fit right away with a lot of people's mindset.
10:12 But these dependency groups look pretty good.
10:14 So let's take a look at one example.
10:16 So their example in the PEP just shows you get a block of dependency groups section.
10:22 And then there's stuff like test with a list of, a list of things like pytesting coverage.
10:27 Docs might have Sphinx and, and the Sphinx read the docs theme.
10:31 Typing for doing type checking, like my py and type requests.
10:35 So these all totally make sense.
10:37 And then there's a, there's an extra bit about being able to group others.
10:41 So you could have a dependency group that includes other groups.
10:44 That's pretty cool.
10:45 And then there's some details around like, well, what happens if they conflict with each other
10:49 and stuff?
10:50 So that's well-defined, which is good.
10:52 But I just think like having something like this, like a small block that say, Hey, for tests,
10:57 we use pytesting coverage for docs.
10:59 We use these and have that be nice and succinct in a dependency group section.
11:03 I like it.
11:04 So this has been accepted.
11:05 I'm not sure when it's going to come to a pip near you.
11:09 But it's pretty cool.
11:11 There, there's an example of how it might work at the end.
11:14 Like how, I don't know, reference implementation, how it might work of like saying maybe pip install
11:21 dependency groups and be able to install that.
11:24 But, but that's up to PIP, the pip maintainers to figure out how, how that's really going
11:29 to be used.
11:29 Other interesting thing is extras are extras.
11:32 Extras are on top of the normal thing, everything needed for the, for the system.
11:37 But for example, like when you're doing the documentation build, you don't actually have to build your
11:42 thing to build the docs.
11:44 So these dependency groups do not, they're not extra, they're independent.
11:49 So you could build the, install the documentation dependencies without installing the project,
11:55 which is pretty interesting.
11:56 So anyway.
11:57 That's, that's one of the differences they highlight is the extras require, they add onto the base
12:03 requirements.
12:04 Whereas this, you can have one set of things installed for one scenario and another for another
12:08 without necessarily overlapping them, which you might think, whatever, right?
12:12 It doesn't matter.
12:13 Just install some extra stuff.
12:14 But there's certain things that say work in production, but won't install on windows.
12:18 For example, right?
12:20 I think last I looked, UV loop didn't work on windows, but it was like a speed up for async
12:25 IO on Linux.
12:26 Well, there also might be a, an incompatibility of a dependent library on like your, if you're
12:32 using Sphinx, maybe Sphinx depends on something that's a different version than what your project
12:37 depends on.
12:37 Yeah.
12:38 Yeah.
12:38 Yeah.
12:38 Good point.
12:39 So indeed Henry on the audience throws in that extras are public.
12:43 These are not, unfortunately we lose the ability to guarantee the package was installed.
12:47 Sometimes you want this.
12:49 Sometimes you don't.
12:49 Thanks.
12:50 Yeah.
12:50 hat tip to a transition.
12:52 You didn't know what's coming.
12:53 So overhead talk by the on training.
12:57 We have a free course called static sites and API docs with Sphinx, Python and Markdown done
13:02 by Paul Everett.
13:03 And he unwittingly introduced me to this next topic through that course on here.
13:09 Live reload as in pip install live reload.
13:13 Do you know this?
13:13 No.
13:14 So it's kind of a generic file watcher, mostly focused on web apps, but you could use it for
13:19 literally anything.
13:20 And it's just, you can say, here's a set of file patterns, multiple ones.
13:26 And it can, you can use the star star slash something to like look at sub directories and
13:32 whatnot.
13:32 You know, the, the file pattern craziness to however much you want.
13:38 And then if something changes, it will just run an arbitrary shell command for you and potentially
13:45 restart your web app as well.
13:46 If you give it a web app, like a flask or Django, a whiskey app type of thing.
13:51 So that's pretty cool.
13:51 If you look at the documentation, you will find it to be sparse.
13:55 Like the description of it literally is about eight words, one sentence.
14:00 It tells you how to install it, but like, well, okay.
14:04 But why would I install it?
14:05 You look at the API reference and it's, it's basically just a signature.
14:08 So if people are looking to contribute to a project, you know, maybe given this a little
14:12 example, a little bit of a, a few paragraphs would be awesome.
14:15 But, I gave you an example that we can all use from Python bytes and from talk Python,
14:21 similar apps.
14:22 So similar use here.
14:23 And so I, I'm sharing a gist with folks that will, if you run it a little file here, you
14:30 can just run this as in your terminal or just however you start it and just leave it running
14:36 while you're working on a project and what it'll do.
14:39 It'll track down using pathlib.
14:41 It'll track down the root folder and then find a CSS folder and a JavaScript folder.
14:45 And then it'll run Python against some file that does bundling.
14:51 So for example, at Python bytes, we take maybe six or seven CSS files and minify and bundle them
14:57 into a single one in a certain order.
14:58 And then share that over a CDN.
15:00 Yeah.
15:01 And so depending on how it's running, you may or may not see those changes if you're doing
15:07 like CSS design stuff, same thing for JavaScript, right?
15:10 So what you can do is you just set this up, pointed the right places on your file system,
15:15 say, watch the CSS folder, watch the JS folder and run a shell command, which is tell Python
15:22 to run that Python script that does the bundling.
15:25 Boom, off it goes.
15:26 And you just run that in the background while you're working.
15:28 What do you think?
15:29 That's pretty cool.
15:30 So with this, if you change the JavaScript and CSS, it just automatically updates then?
15:34 Right.
15:35 It looks for any file change within the search pattern, like star star slash CSS slash dot
15:43 star dot CSS or whatever, you know.
15:44 And then if it sees that, it just runs the command, which the command that I gave it is
15:49 to run Python to rebundle our assets.
15:52 So for whatever reason, because one of the things that can happen is, you know, change something
15:57 about a CSS file, forget to bundle it, publish the site.
16:01 And you're like, huh, why does that look so weird?
16:03 Like, why is that not changed?
16:04 But the, you know, the, the, the, the packed version of that one that runs in production,
16:09 but not in development is out of sync.
16:11 And then it's weird.
16:12 Right.
16:12 So if you just, as long as you have this running somewhere, just chilling, then you're good.
16:16 Cool.
16:17 But it doesn't have to be, I mean, the context is web and it's very focused on static websites,
16:22 which is super annoying.
16:23 Like the way you run it, as you say, server dot serve, and it literally starts up a web
16:27 server at some route you give it.
16:29 But I don't want to look at it.
16:30 I'm not trying to look at the website through it.
16:32 I literally just wanted to run the file.
16:35 So there should be some secondary command, like just start watching or something like that
16:40 in the background.
16:41 But it starts a little web server.
16:42 You can just ignore it and, or point it to nowhere and ignore it.
16:46 And then you could get it to do basically when a file changes, run a shell command of
16:51 your choosing, which is pretty flexible.
16:52 Yeah.
16:53 It does.
16:54 I guess to give them a little credit, they do have pages for how to, how to use this with
17:00 Django and Flask and Bottle.
17:02 I don't know anybody that uses Bottle anymore, but.
17:04 No, no, I know.
17:05 But I mean, the pages for it.
17:07 But unnecessarily the right details.
17:10 Yeah.
17:11 It doesn't like, it doesn't really tell you what happens.
17:13 Okay.
17:14 It just shows you what to do.
17:15 And then you can imagine, well, will it restart the app or will it not restart the app?
17:19 Will it just restart the CSS?
17:21 Will it reload the templates?
17:22 There's options of what could be happening, but it doesn't really say.
17:25 Anyway, it's a cool project.
17:27 I would love to see a little bit more description just so that I can get a little more traction.
17:31 But yeah, there you go.
17:33 Paul was using it for when he changed a markdown file in the course.
17:37 It would run make HTML out of Sphinx to automatically rebuild the website as you just typed in it.
17:44 Oh, that's cool.
17:45 Yeah.
17:45 All right.
17:47 Well, do you want to jump into extras?
17:49 Let's jump.
17:50 Okay.
17:51 Do you want to hit yours first?
17:52 Yeah, I'll go first.
17:53 Mine are super short.
17:54 So, a couple of things.
17:56 First of all, I was looking at our Umami.
17:59 That is Umami Analytics.
18:03 Is it .is?
18:04 I think it is.
18:05 Umami.is.
18:06 Analytics.
18:07 Yeah, perfect.
18:08 And I noticed something unusual, that 14% of our listeners are from Germany.
18:14 Oh, that's cool.
18:15 That's pretty interesting, right?
18:17 Especially given, you know, this is in English.
18:19 It's not their native language.
18:21 But, like, more than Australians, the Germans are listening to our stuff.
18:24 So, thank you, Germany.
18:25 Maybe we should have a competition to try to get the country.
18:29 Exactly.
18:29 Exactly.
18:30 And then, not that I intended this to be a German episode, but here are German extras.
18:37 But, the German company, Hetzner, have you heard of them?
18:40 They're like DigitalOcean, Linode, so on, AWS.
18:43 So, I've heard a few people talk about them.
18:46 And they have really interesting hosting models.
18:49 Like, they'll give you super affordable VMs, lots of bandwidth, so on.
18:54 So, for example, for an 8 gig, sorry, 16 gig, 8 CPU server in DigitalOcean, it's $112.
19:04 And it's hard to tell exactly on AWS and Azure, but I believe AWS is $200 and Azure is $350 per month, okay?
19:12 Okay.
19:13 I go over here to Hetzner, prices, and you pick, say, shared AMD, and you pick your country to be US.
19:21 Come here.
19:23 Oh, where'd you go?
19:24 Same server is $25.
19:26 Wow.
19:26 And it comes with 20 terabytes of bandwidth, which, quick math, I believe that's about $2,000 at AWS.
19:35 Okay.
19:36 And that's included in the $25.
19:37 Cool.
19:38 So, the news is, why am I even mentioning this?
19:40 The news is, they recently came to the US.
19:42 All right.
19:43 They used to be just a European company.
19:46 Now, they're available in the US.
19:48 So, that opens up a lot of interesting hosting possibilities.
19:51 Are you switching anything?
19:53 I'm thinking about playing with it.
19:55 We'll see how it goes.
19:56 I actually asked people in Mastodon, what do you guys think about this company?
20:00 And I got a lot of German folks who said they're having a lot of good experiences with it.
20:05 So, we'll see.
20:06 Okay.
20:06 But I'll let you know if we do.
20:08 I haven't switched anything around.
20:10 But it's pretty interesting, right?
20:11 That you can get so much compute for so affordable.
20:14 Yeah, that's pretty cool.
20:15 Anyway, those are my extras.
20:16 Over to you.
20:16 A couple blog posts that I wanted to highlight that were kind of neat.
20:22 K.J. Miller.
20:23 Personal blogs are no longer personal when AI gets too involved.
20:28 So, I know people are using AI and chat-like things to come up with some ideas and stuff.
20:35 And that's pretty much what K.J. Miller is talking about.
20:39 It's not necessarily terrible to do that.
20:42 But be careful what you're doing and why you're doing it.
20:46 So, for instance, coming up with ideas or if you're stuck on how to phrase something,
20:52 having somebody help with that is great.
20:55 And writing is hard.
20:57 So, getting some advice, fine.
20:59 But it should still be your voice.
21:01 So, I love, I was wanting to hop down to his advice.
21:05 It says, obviously, if you're reading this and not, obviously, if you're reading this and
21:12 not getting ChatGPT to summarize it for you, you care about my words to some degree.
21:18 So, you are reading somebody's blog for their voice.
21:21 So, keep that in mind when writing your own blog.
21:23 So, especially if you're writing a blog to try to get hired later, it doesn't help you
21:28 any to just regurgitate some ChatGPT stuff and copy and paste it.
21:33 We don't need more people like that.
21:35 I mean, if you're doing it to try to fill up your blog for selling something, I still don't
21:41 like that, but you know, your business.
21:43 But if you're trying to do it to highlight what you write like, then you need to write it.
21:49 And also, if you're doing this to help your future self, make it personal.
21:53 Also, like, if you're not writing it or at least rewriting it, writing it in your voice,
21:58 it's not going to stick in your head.
22:00 So, you're not doing yourself any favors.
22:02 There is a bit about, he talks about if you're doing this to create content in another language,
22:08 learn about that community's writing style, which makes sense.
22:12 But I kind of think there's translation tools already built into some browsers.
22:18 And if somebody from another country really want to read your stuff, maybe they probably
22:22 will anyway and translate it if they want to.
22:25 So, I got really no interesting opinion about that.
22:28 But I think I like these ideas about if you're doing it to gain, you know, build your personal
22:34 brand or put yourself up as an expert in an area, using AI to do that's really not helping
22:40 you.
22:40 I think people can figure that out because there'll be an inconsistency in writing styles in different
22:46 posts.
22:47 And then also, it's your personal thing.
22:51 People are trying to reach you.
22:53 So, be you.
22:53 Anyway, that was one extra.
22:56 The other one was something that I just didn't think about, and I probably should, is mind your
23:01 image metadata.
23:01 This is an article from Stephanie Mullen right there at the top.
23:09 She presented at PyCon Estonia.
23:11 Anyway, the talks about the EXIF interchange format.
23:17 Basically, pictures have tons of metadata in it.
23:20 And if you don't want to have that published everywhere, and you might not, you might not want personal
23:27 locations for exactly where your photos are.
23:29 She talks about how to tell using tools to figure out what's in there and also talks about tools
23:36 to rip them out.
23:38 And then even talks about using a pre-commit hook to strip out pictures that you're including as your
23:44 static images or in your Git repo.
23:47 That's cool.
23:48 If you're putting your Hugo static site, just none of it has any of that in there.
23:52 That's a pretty cool idea.
23:53 I like that.
23:54 Those are just my two extras.
23:56 Excellent.
23:58 I'm having Stephanie on Talk Python Thursday.
24:01 Cool.
24:01 Three or four days from now.
24:02 Sweet.
24:03 Yeah.
24:03 All right.
24:04 How about our joke?
24:06 Let's do it.
24:07 Okay.
24:07 How are you?
24:08 This is a dumb joke, but I love it.
24:09 It's an oldie, bitty, goodie.
24:11 I'm linking to a savvy programmer blog, but I've heard it before.
24:17 Essentially, it's, okay, a programmer's partner asked them, hey, would you go get a loaf of
24:24 bread from the store?
24:25 And if they have eggs, grab a dozen.
24:27 So while later, the programmer returns with 12 loaves of bread and says they had eggs.
24:31 So literal.
24:34 I love it.
24:34 Anyway, there's a handful of jokes here.
24:39 Pretty decent.
24:40 Okay.
24:41 I didn't read very many.
24:42 I'm going to go check some of them out.
24:44 That's awesome.
24:44 Anyway.
24:45 Excellent.
24:46 Yeah.
24:47 Very funny.
24:47 Thanks again for the show together.
24:50 And everyone, thank you for listening.
24:51 Talk to you later.