Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


Transcript #404: The Lost Episode

Return to episode page view on github
Recorded on Monday, Oct 7, 2024.

00:00 Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:06 This is episode 404, recorded October 7th, 2024.

00:11 I'm Michael Kennedy.

00:12 And I'm Brian Okken.

00:14 And this episode is brought to you by Scout APM.

00:17 We will, of course, tell you more about them later.

00:18 The link is in the podcast player show notes right at the top.

00:21 Brian, I've been looking for this episode for a while and I just can't find it, man.

00:27 I was like, where do I go?

00:30 404.

00:30 Everywhere I go, it's 404.

00:31 What's going on?

00:32 Yeah, I don't know.

00:35 We'll find it.

00:37 Let's make it.

00:38 It's going to be a journey.

00:39 We're going to try to get our way through it.

00:41 Speaking of a journey, you want to stay in touch with us, hit by them by Scout APM.

00:46 Click on newsletter.

00:47 Enter your info there.

00:48 We'll keep you up to date.

00:49 Brian will send you some show notes.

00:50 Find us on Mastodon and other social places.

00:54 And even subscribe right here on YouTube if you're watching the video.

00:58 And with that, were you able to find an item for your first item today?

01:03 Well, I almost did it.

01:04 So, okay.

01:05 The first item, I really wanted to cover Python 3.13.

01:09 Because Python 3.13 is released on October 7th.

01:13 And today is, text notes, October 7th.

01:16 So, it's today, right?

01:18 So, I went to python.org and go, well, the latest, it still says latest is 3.12.

01:24 So, they're working on it.

01:26 Thomas Wooters and others.

01:27 It's a process to get it out.

01:29 But it's really out already.

01:30 So, you just can't see it.

01:31 If you go to downloads, it still says 3.12.

01:33 I'm sure it'll be updated soon.

01:35 However, we've got the link for 3.13.0.

01:39 It's really not that complicated.

01:40 Downloads, release, python-3.1.3.0.

01:45 And then you got it.

01:46 So, it's got a stable release of 3.13.0.

01:49 I've been playing with it this morning and having a lot of fun.

01:53 If you go down to the bottom of this link, there's where the installers are.

01:57 The pre-built installers, if you want to grab those.

02:00 Or you can install it yourself if you want.

02:02 Or build it yourself.

02:03 But I'm on a Mac right now.

02:05 So, I grabbed the Mac installer.

02:07 And I want to cover some of the new stuff in 3.13.

02:11 But I really wanted to play with the multi-threading stuff, which I haven't yet.

02:14 I just wanted to make sure it was enabled.

02:16 And there's a bit of a trick.

02:18 So, if you look in...

02:20 Maybe it's not in here.

02:22 It's in the What's New page.

02:23 So, if you go to the What's New, it does talk about the Python, the macOS, and Windows installers.

02:30 And there's a link somewhere in here.

02:32 But we'll include the link also.

02:35 That when you're installing it, and on the Mac, when I did it, you go through this install process.

02:41 You have to hit customize and click the free-threaded.

02:46 Because free-threading is off by default.

02:49 So, when you install it, you have to turn it on.

02:51 So, just remember that.

02:53 And I will play with the free-threading later.

02:56 So, what do we have new in 3.13?

02:59 I think we've covered this before.

03:00 But now we actually have 3.13.

03:02 So, we can play with it.

03:04 We have the interactive interpreter changes, which...

03:08 Actually, let's back up a little bit.

03:09 This isn't even called out here.

03:11 My favorite feature of 3.13 is exit.

03:14 Oh, I guess it is here.

03:17 Direct REPL support for help, exit, and quit.

03:21 And thank you.

03:23 Thank you.

03:23 Thank you.

03:24 Thank you.

03:24 Whoever worked on this.

03:25 Because it used to say, oh, did you mean to exit out?

03:28 You have to type exit with the parans or quit with the parans.

03:31 And if you know what I want to do, just do it.

03:35 So, you know what it does.

03:36 It's really cool.

03:36 I can imagine somebody was like, well, what if we have a variable named exit and you want

03:41 to see its value?

03:42 But if there's no variable defined, just quit.

03:45 I love it.

03:46 So, exit and quit now work.

03:49 I didn't know quit worked.

03:50 That's neat.

03:51 So, the other couple things in interactive, there's a lot of stuff in the interactive REPL

03:57 that's changed.

03:58 Multi-line editing, amazing.

04:00 So, you type in a multi-line thing and you get the three dots, which is great.

04:05 But when you want to go and type something wrong and you want to go change that, now you

04:10 can go back and you can just hit the up arrow and it works.

04:14 It's great.

04:16 So, I'm really enjoying that.

04:17 There's F1 for command history.

04:20 History is, we've had history before, but now if you exit and then start the REPL again,

04:26 history is still there.

04:27 It preserves all of your history from the session.

04:29 Oh, that's nice.

04:30 Super nice for when you're debugging something, trying it out.

04:33 And the colors are amazing.

04:35 So, they've turned on colors by default.

04:37 So, in prompts and tracebacks.

04:40 So, even just having the little prompt be in a color, it's nice.

04:43 It helps.

04:44 So, love that.

04:45 We've also got improved error messages.

04:47 Like, before, if you named, like, random is built in, one of the built-in things.

04:53 But if you named a module named random, it would just mess up.

04:56 And it would, like, it would say stuff like, you know, module random has no attribute.

05:01 But now it says, hey, you've already considered renaming your own module something else because you're messing up.

05:08 So, if you rename them.

05:09 If you name a module or a script, the same thing as a built-in or now as one of your installed third-party libraries, Python will tell you that you've messed up, which is nice.

05:20 There's other improvements, too.

05:22 Like, if you misspell a keyword argument, it will suggest that maybe you had the correct spelling.

05:30 It will suggest that.

05:31 That's pretty cool.

05:32 And then, of course, there's lots of changes in 3.13.

05:35 But the REPL, I'm excited about.

05:37 I'm also excited about the error messages and free-threaded Python.

05:42 So, there's a lot of other stuff, too.

05:43 So, check out the What's New.

05:45 But I really am looking forward to playing with the free-threading.

05:48 Yeah, this is amazing.

05:50 I'm really excited to see this here.

05:51 I actually can't believe that free-threaded Python is a thing.

05:54 I know.

05:55 It's like.

05:56 It's been so long.

05:56 The journey's been so long.

05:58 I mean, I was walking this morning and I saw a pig flying through the sky.

06:01 It had imported free-threaded Python, rather than imported anti-gravity.

06:07 That's what it did.

06:08 Yes.

06:09 Yeah.

06:09 So, I know that a lot of people have worked a lot, long and hard, to make that work.

06:14 So, I'm looking forward to it.

06:16 Now, free-threading is still officially experimental.

06:19 So, I don't know what that means.

06:22 If they're going to take it back from.

06:23 Please don't take it away from us.

06:25 But we'll see.

06:26 Yeah.

06:27 The original PEP that got it accepted, 703 or something like that, said,

06:31 we are allowing this in.

06:32 But if it causes too much trouble, we're taking it back out.

06:35 Which I've never seen in a PEP.

06:36 Maybe it's happened before.

06:37 But we approve it.

06:38 But we might unapprove it.

06:40 Might unapprove it.

06:41 We'll turn this car around.

06:43 If you keep fighting, we'll turn it around.

06:45 Yeah.

06:45 That's right.

06:46 Don't make me turn this car.

06:47 Don't make me pull over.

06:48 Speaking of pulling over, this was supposed to be out a week ago, Brian.

06:54 Yeah.

06:54 Yeah.

06:55 And apparently, it was pushed back due to performance issues or some kind of issue with the incremental GC.

07:03 Right.

07:04 And I'll put the Python, the discuss.python.org link in my extras.

07:08 But I'm not going to cover it separately.

07:10 But it's kind of irrelevant.

07:12 Things are out now.

07:13 But yeah.

07:14 Very cool.

07:14 All right.

07:15 Well, what do you got for us next, Python?

07:16 Michael?

07:17 Well, let's stick with some core language topics and stuff like that.

07:22 I want to talk about PyPI bandwidth and PEP 759 external wheel hosting.

07:30 So right now, when you pip install, UV pip install, whatever, you go to get something and you,

07:37 as a publisher of a package like Flask, you send that to pypi.org, maybe as a wheel, maybe

07:44 as a multi-platform variations of different wheels, if it's got to compile differently or

07:48 something.

07:48 And then people pip install that and it downloads from there.

07:51 That results in an insane amount of traffic.

07:54 I actually want to talk a little bit more about that later in general.

07:57 But it's an insane amount of traffic.

07:59 Over 66 petabytes a month, which is six-figure level of bandwidth costs.

08:05 And luckily, Fastly, the CDN company, is basically donating all that bandwidth at reasonably high

08:13 expense for them.

08:14 Probably not the same as retail, but whatever wholesale that is in bandwidth, I'm sure it's

08:18 still a lot.

08:19 And they announced a five-year plan or five-year commitment to the PSF to do that at PyCon.

08:25 All right.

08:26 They're on the big keynote stage.

08:27 That was nice.

08:28 Thank you, Fastly.

08:29 However, there's still problems with this, even though they're covering it.

08:33 What if Fastly changes their mind eventually?

08:35 But more importantly, there's hard limits on how large your project's overall usage on

08:43 pypi.org can be.

08:45 It gets no individual package can be bigger than 100 megs.

08:49 You can't have 10 gigs total across all platforms, across all releases, things like that, right?

08:55 You can't apply for exceptions, but it's not great.

08:57 What if you could just say, here's my wheel, but when you actually download it, download it

09:02 from over there.

09:02 Download it off of Microsoft.com if it's a Microsoft package.

09:06 Or download it off of explosion.ai if it's some sort of spacey package.

09:13 Those things have to be quite large.

09:14 A lot of their models that you pip install.

09:16 I think they have to get an exception to be even uploaded in the first place.

09:19 All right.

09:20 So that's what this is about.

09:20 It's by Barry Warsaw.

09:21 Ethan Smith.

09:22 Delegate is Donald Stufft, who is a person largely behind the rewrite of pypi.org.

09:29 So here's the deal.

09:31 Brian, if you had a wheel, which is the metadata about a package and all of its binary details

09:38 and its source code and all that, and you ripped off a lot of the wheel stuff, like the binary

09:44 bits, what would you be left with?

09:46 I don't know.

09:46 A rim.

09:47 A wheel rim, you know?

09:49 Oh.

09:50 So this PEP literally defines a new package format called a rim file.

09:58 And the rim file is basically the wheel without the binary.

10:00 Instead, it's got a URL to where the binary lives.

10:02 And a checksum of the binary, which may already be there anyway, but it's left in the rim file,

10:07 if not added to it.

10:09 Okay.

10:09 Interesting.

10:10 So basically, you upload just the metadata if you want to participate in this.

10:15 And then you point somewhere else.

10:17 And there's a lot of motivation, things they tried, things that didn't work, limits.

10:22 You can see in this pep, they list the limits that I talked about.

10:26 And all the details, but most importantly, there's a security section way down here.

10:35 I was worried about that.

10:36 So, yeah.

10:36 Yes.

10:37 Here.

10:37 As well as stability constraints.

10:39 But so for example, the wheel checksum must be included in rim files.

10:44 Once it's uploaded, just like current wheels, it can't change.

10:47 Yeah.

10:48 So here's my metadata.

10:49 That's where the thing lives.

10:50 Here's the hash of it.

10:52 So it can't be tampered with.

10:53 It must be served over HTTPS.

10:56 Okay.

10:57 And you're only allowed to do this if you get pre-approved by the PyPI admin.

11:01 So it's not just all sorts of chaos.

11:04 People just upload and stuff everywhere.

11:06 All right.

11:07 But a lot of consideration about like malware and things like that.

11:10 And also a bunch of stuff about stability.

11:12 Like external wheels must be hosted over SSL.

11:16 And not just that, but it actually must be signed by Mozilla's root certificate store, which

11:21 is interesting.

11:22 And they should use CDNs.

11:24 They must be stable, et cetera.

11:26 What do you think?

11:26 So who would do this?

11:28 I mean, because then the person with the package doing this, they'd have to pay the hosting fees.

11:34 Or get it on GitHub and point to it as a raw or something, you know?

11:37 Oh, yeah.

11:38 Something like that.

11:39 I don't know.

11:40 Oh, okay.

11:41 Or if you're a big company and you want to ship ML models and you'd rather have more control

11:47 over that and how it works, right?

11:50 You could set that.

11:51 I don't think small individuals are going to be like, hey, I'd love to cover a terabyte

11:55 of bandwidth charges a month for no reason.

11:57 Yeah.

11:58 Right.

11:58 Well, also, like you said, it's somebody that's got a, it's going to be a large one.

12:04 You're not going to do this for just a little Python only package.

12:08 Yeah, exactly.

12:09 It's very unlikely.

12:09 Right.

12:10 It's very unlikely.

12:11 So they said this is only about hosting the binary downloads, not packages, package indexes,

12:18 package listings, none of that stuff.

12:20 Because that's already supported through having just a separate private white label.

12:25 You run it yourself.

12:26 PyPI, mirror, something like that, right?

12:29 Yeah.

12:29 I think this is cool, actually.

12:30 Neat.

12:31 Yeah.

12:31 Flexibility is good.

12:32 I think it's, I think it's all right.

12:34 So anyway, very cool.

12:35 That's, that's what I wanted to cover.

12:37 And before we move on, how about a quick shout out to our sponsor?

12:41 Yep.

12:41 Let me tell you real quick about Scout APM.

12:45 They're big supporters of Python Bytes.

12:47 So we appreciate that very much.

12:49 So if you are tired of spending hours trying to find the root cause of issues impacting your performance,

12:55 then you owe it to yourself to check out Scout APM.

12:58 They're a leading Python application performance monitoring tool, APM, that helps you identify and solve performance abnormalities faster and easier.

13:07 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.

13:17 And then you say, oh no, why is it so slow?

13:20 Why are you doing 200 database queries for what should be one?

13:22 So you can find out things like that.

13:24 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.

13:31 And you'll love it because it's built for developers by developers.

13:34 It makes it easy to get set up.

13:36 Seriously, you can do it in less than four minutes.

13:38 So that's awesome.

13:39 And the best part is the pricing is straightforward.

13:42 You only pay for the data that you use with no hidden overage fees or per seat pricing.

13:47 And I just learned this, Brian.

13:50 They also have, they provide the pro version for free to all open source projects.

13:55 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.

14:02 So you can start your free trial and get instant insights today.

14:06 Visit pythonbytes.fm/Scout.

14:09 The link is in your podcast player show notes as well.

14:11 And please use that link.

14:12 Don't just search for them because otherwise they don't think you came from us.

14:16 And then they'd stop supporting the show.

14:18 So please use our link pythonbytes.fm/Scout.

14:20 Check them out.

14:21 How about the next one for you?

14:23 I feel like, just give people a little heads up.

14:25 We've got some, that's a pie test coming up here.

14:27 What do we got?

14:28 If you didn't know it, Python 3.13 is out.

14:30 So we already covered this.

14:34 However, it's got the free threading thing going on.

14:38 How do you know if your project supports it?

14:40 So that's the question that Anthony Shaw and others at, where was this at again?

14:46 Was that PyCon JP?

14:48 I think that's PyCon Japan.

14:50 Is that right?

14:51 I think so.

14:52 Okay.

14:52 So it was one of their sprints.

14:54 Looks like seven or eight people, Anthony, Mike, a bunch of people worked on this.

15:00 And the idea is that you'd like to be able to test that your project and your code works on the free threaded, right?

15:08 So if you're like, especially support libraries and packages.

15:13 So what, how do you do that?

15:15 And one of the thoughts was to just test, just run it.

15:19 But with the free threading turned on.

15:23 But pytest normally runs in single thread mode by default.

15:26 So how about XTest?

15:28 Because that's multiprocessing, right?

15:30 Yes, it's multiprocessing.

15:31 It's not multithreading.

15:32 So Anthony and others made this plugin.

15:36 It's called pytest-FreeThreaded.

15:39 And link in the show notes, of course.

15:41 But they made the plugin to be able to run the tests in a thread pool with the guild disabled and help identify that your tests are thread safe.

15:52 So, you know, as long as your tests possibly are testing your code in such a way to test that, great.

15:59 But at least your tests will be free thread safe compatible.

16:03 Anyway, they tested the first library that was marked as compatible with free threading.

16:10 I don't know how to do that.

16:11 So I guess that's a to-do item to look that up.

16:14 Okay.

16:15 So you think it might go in the classifiers of the package metadata?

16:18 I'm not sure.

16:19 Oh, okay.

16:20 All right.

16:20 Well, we'll take a look at that.

16:22 Anyway, they tested one and it caused a segfault in CPython.

16:27 So not really compatible if you're segfaulting.

16:30 So I haven't tried this out yet, but I'm going to try it on a few projects anyway.

16:36 So Python free threaded will help test this.

16:39 Well, I think this is awesome.

16:41 And some people might perceive this like, oh, it just means a performance boost.

16:45 But if you're writing code that's meant to be supported for free threaded Python, you should test it in that style as well.

16:52 Not just in some limited way, right?

16:54 Yeah.

16:56 And even if your tests pass, I think it would make sense to look at the different parts of your library to make sure that it really makes sense that your tests are actually testing your library in such a way that you have fairly good confidence.

17:13 But, you know, mileage may vary.

17:15 But this is a good step in the right direction.

17:18 So thanks to Anthony and others for doing this.

17:21 Yeah, that's awesome.

17:22 Speaking of Anthony, I was not going to point this out, but now that you mentioned it, just published an episode on Talk Python with him designing effective load tests for your Python app.

17:33 Nice.

17:33 Yeah, that's a really fun one.

17:35 So people can check that out.

17:36 But what I'm actually talking about for this section is more pytests.

17:40 Ryan, how did you not get this one?

17:42 pytest edit.

17:43 Do you know this?

17:44 No.

17:44 Okay, so here's the deal.

17:46 You're on the terminal CLI sitting there running something and you run into an error and you're like, ah.

17:52 My test crashed or my test failed rather.

17:54 I just want to see what's up.

17:56 So one way to do that is to see what test failed.

17:59 Go open your editor, find your project, load it up, search around until you find it.

18:03 Or the other way is to install pytest-edit from Mr. Minnow.

18:08 That's the GitHub name.

18:09 And then just type pytest-edit and it'll open a pre-configured editor to the line of the failing test.

18:17 Oh, wow.

18:18 Yeah, so you can say pytest-edit and it'll show you the last one.

18:21 Or you can say some index.

18:23 So for example, you can say edit equals two.

18:25 And it'll open the third failing test because, of course, it's zero-based.

18:28 Or negative two will open the second to the last one.

18:31 So you can kind of hone in on it with this number here.

18:34 And then you just set up your editor.

18:35 If you don't set it up, you get VI or Vim or even Windows.

18:40 On Windows, you get notepad.

18:42 So I recommend picking a better editor.

18:47 But anyway, you just set an environment variable to what you want your editor to be.

18:51 And I got a ton of extras to cover, so I don't want to go too deep on this one.

18:54 But there it is.

18:55 Neat.

18:56 Speaking of extras, what do you got for us?

18:58 Any?

18:58 I've got zero extras this week.

19:01 I must have stolen them all.

19:03 Look at my tabs.

19:03 All right.

19:06 Well, let's just jump into the extras then.

19:07 Extra, extra.

19:09 So I got a bunch here, but they're all pretty quick.

19:11 Last week, you spoke about Jade, D-J-A-D-E, for formatting Django templates, right?

19:21 Kind of like black or rough, but instead of being for Python, it's for Django templates and

19:26 HTML and so on, which is awesome.

19:27 So I'm linking to something from Adam Chains, Django pre-commit hook.

19:32 Or sorry, Jade pre-commit hook.

19:33 So if you want this to just happen automatically, there you go.

19:36 Super easy, right?

19:37 Cool.

19:37 Yes.

19:38 This one is really fun.

19:39 And remember I talked about Polyfill, Polyfill.js and somebody took over the domain.

19:45 I don't remember.

19:45 It was, I think it was sold even, but if it wasn't sold, it was taken over because it lapsed

19:50 or whatever.

19:50 However, it got into some nefarious hands and they took over polyfill.io, boot CDN, boot

19:56 CSS, static file.

19:58 And they had basically rewritten a whole bunch of CDN served JavaScript to hundreds of thousands

20:04 of websites with malware that would then go on to the visitors of those websites.

20:08 It's bad.

20:09 The only reason I'm bringing this is a quick follow-up.

20:20 How do they know?

20:21 That person had published, they accidentally published their Cloudflare secret keys.

20:30 And so then the security researchers will, you know, they basically logged into Cloudflare

20:37 and just looked at their cloud setup, which I think this is awesome.

20:41 Yeah.

20:44 And then, yeah, funny thing out in the audience.

20:47 We'll share that in a second.

20:48 All right.

20:48 This one is also really cool.

20:50 Over at pythonbytes.fm, created that site seven years ago.

20:55 How long have we been there?

20:55 Eight years?

20:56 Well, when I created it, I created it with Bootstrap, okay?

20:58 Because Bootstrap was probably the nicest way at that time to get a good looking site that's

21:04 consistent, responsive, all those things up in Atom, right?

21:07 Well, if you look at the Bootstrap CSS file, it's about 140 kilobytes, which is a lot to

21:14 just be serving as one of your static resources on every web request, right?

21:18 But it's pretty gnarly.

21:20 You don't want to mess with it, right?

21:21 Like, what are you using?

21:22 I don't know.

21:23 And what's the knock-on effect?

21:24 So I ran across this thing called Purge CSS, which is a Node.js CLI tool, but it doesn't

21:30 really matter how it's implemented, right?

21:31 It's just a CLI tool.

21:32 And you can run this thing against your CSS file, and you can say, hey, this CSS file,

21:39 I would like you to look at all the styles that I'm using, look at the CSS file, and if

21:44 there's any styles in there I'm not using, take them out of the CSS file.

21:48 Oh, wow.

21:48 Yeah.

21:49 So, and it doesn't have to work on just HTML.

21:53 I pointed at chameleon templates, or it could be Jinja templates, or we just talked about

21:57 Django templates.

21:57 You just give it a, like a star, star, slash, star, whatever your template extension is,

22:03 like .j, or if it was Jinja, or whatever.

22:06 And then it'll go through and look at all of those that are being used, and then it'll

22:10 rip them out, rip out all the stuff that wasn't.

22:12 So now, for example, if you go to pythonbytes.org, and you click on the CSS file, it's like 20k,

22:20 25k, something like that.

22:22 So it's six, seven times smaller, and all I had to do is run a command line thing against

22:26 it.

22:27 So maybe you're not using enough bootstrap.

22:30 I feel like that's still 20kb of bootstrap.

22:33 That's a lot of bootstrap.

22:34 I love your attitude, but there we go.

22:38 Last week, on the first go-round of 3.13 release, there's also Python 3.12.7 released.

22:47 So just so you know, if you're not ready for 3.13, there's also a new version of 3.12.

22:52 I want to give a quick shout-out to a video by Henick.

22:55 It says, UV is the future of Python packaging.

22:58 Snake box emojis.

23:00 Anyway, this is a really good video.

23:02 Henick is getting his YouTube game on quite well, and he's fun to watch.

23:07 So check that out.

23:08 I'll link that as well.

23:09 And I still got some more.

23:11 We're just tabs bumping around.

23:13 Chris over on Faucet On pointed out, hey, love all this UV talk, grouping these together

23:18 on 4.3 and others and so on.

23:19 It's interesting to be seeing it show up just broadly now.

23:23 And things like Home Assistant is now using it to reduce download and setup times.

23:27 Oh, yeah.

23:28 Cool.

23:28 Yeah, kind of cool.

23:29 Over here, Brian, do you think people are getting tired of LLMs and hearing about AI tools?

23:34 Yes.

23:35 I feel like there's a lot of AI fatigue out there.

23:38 I'm like, ah, but is that just me projecting this onto people?

23:41 Is this real?

23:42 So I posted on Faucet On and on Twitter and said, hey, just thinking about topics, how

23:49 do you guys feel about LLM topics and spending time talking about them?

23:52 Only 4% said, more LLMs, please.

23:55 22% said, ah, they're fine.

23:57 38% said, I've had enough.

24:00 And 36% fully said, if you say AI one more time, I will pile drive you.

24:04 Well, you just said it like four times.

24:07 Oh, no.

24:07 It's going to hurt so much, but I had to say it.

24:09 But that's 74% of people saying, oh, man, I've had enough.

24:12 Yeah.

24:12 So anyway.

24:13 One of the things that would have been funny is if you'd have added, do you want us to start

24:17 talking about blockchain again instead?

24:19 Oh, my gosh.

24:21 Yes.

24:22 That would definitely do it.

24:23 All right.

24:23 A couple real quick ones here.

24:26 JetBrains and the PSF have now released or opened up the Python developer survey 2024.

24:33 So check that out.

24:34 I'll link to how you can go and take it.

24:36 But yeah, everyone participate.

24:38 This is super important.

24:39 We really value all the information that we get in the spring or whenever we get the answers,

24:43 the responses and the write up.

24:44 But it's time to submit your notes.

24:47 Okay.

24:47 A couple real quick things.

24:49 I added a really cool way to explore courses over at Talk Python.

24:54 So there's a big tag cloud up at the top here.

24:57 And we get all the courses.

24:58 But now if you just click around, like if you want to find stuff about test, right, I just

25:03 click on testing and it'll show like your test course.

25:06 And this thing is super neat.

25:08 This is all implemented with HTMX.

25:10 All dynamic.

25:11 No page refreshes, but no JavaScript.

25:13 Love it.

25:14 Cool.

25:14 Anyway, go check that out.

25:16 And very last extra, extra, extra.

25:18 I wrote an article that says, let's go easy on PyPI, okay?

25:22 And I got some nice feedback from people on Updated.

25:25 But basically, it talks about a bunch of different steps that you can take to not keep that number

25:31 at 66 petabytes a month hitting PyPI.org, right?

25:36 Yeah.

25:37 I don't know how you feel, but my assessment is fully 75% or more of that has to be Docker

25:42 builds, continuous integration, all that crap, right?

25:45 It just, it has to be so over the top, just like machines talking to machines like, hey,

25:52 here's a requirements file with 200 things in it.

25:54 We're going to build a Docker container on it.

25:56 So let's start with this base one, like the Python one or whichever one, it doesn't really

26:00 matter and just build from it.

26:02 Every single time you want any kind of code change published or tested, it's going to download

26:08 all 200 over and over, right?

26:10 Yeah.

26:10 And then you're testing it against multiple versions of Python.

26:13 So it downloads it that many more times.

26:15 That's a really good point.

26:16 Yeah.

26:16 So this article talks you through different steps you can take to cache it over and over

26:22 faster and faster.

26:22 So basically, almost, unless a requirement changes, it will not ever, ever touch PyPI.org.

26:30 Ever.

26:30 Right?

26:31 So it starts out just saying, oh yeah, you just pip install your requirements.

26:34 What's wrong with that?

26:35 You know, every code change causes a download.

26:37 And then maybe you could run the requirements, copy just the requirements file over and run

26:43 it first and then do it.

26:45 That way, only if a requirement changes, does it get them all?

26:48 And then you could pre-list some of your top level requirements.

26:52 That would cache it in the Docker image.

26:54 And then after a lot of conversations with a lot of people, there's this mount command

26:58 that you can say for cache on a per command basis.

27:02 And this will cache the output to somewhere on the machine that does the building of the

27:08 Docker container.

27:09 So it'll cache either the UV or the pip cache.

27:12 So that way, if you get it again, it'll just go using cached version, even if it's a completely

27:16 fresh image, long as the machine has seen that download before, right?

27:20 That dependency.

27:21 And then finally, if you're on probably one of the biggest offenders in the sense of CI

27:26 on GitHub, over at GitHub, they actually have this thing called, maybe you know it, this

27:31 thing called a cache action or actions slash cache.

27:36 And you can set up a cache for your CI so that subsequent CI builds don't download and install

27:42 it again as well.

27:43 This will not just make it lighter on PyPI, but also every one of these things makes it faster

27:48 for you.

27:48 So it's like incentives are aligned.

27:50 Do you know what I mean?

27:51 Yeah.

27:51 Yeah.

27:51 That's pretty cool.

27:52 It's almost too bad that like GitHub itself can't notice that like multiple packages or

27:58 multiple builds on different projects are using the same version of something and caches.

28:03 Right.

28:04 Just have a universal pip cache or something like that.

28:07 One of my questions is, and I don't know if you know the answer to this, is I know that

28:11 UV does a lot of caching.

28:13 Will just using UV help with reducing hitting PyPI?

28:18 That's an interesting question.

28:20 I don't know if it'll make it less traffic.

28:22 It'll definitely make it faster.

28:24 There's no doubt about that.

28:25 But it might be the same traffic.

28:27 Okay.

28:27 Yeah.

28:28 Yeah.

28:28 Yeah.

28:28 Cool.

28:29 All right.

28:31 Henry says, set up dash UV has a cache option.

28:34 Excellent.

28:35 Excellent.

28:35 That's awesome to hear.

28:36 All right.

28:36 And then Jay Miller dropped in to say that he assumed he wouldn't be able to find this episode.

28:41 But like us, he eventually found his way.

28:44 And also, Tony out in the audience says, I was literally working on caching in CI while listening.

28:49 UV does support caching in CI too.

28:52 Yeah.

28:52 And by the way, if you're checking out these notes on the GitHub CI stuff down here for

28:57 the pip example, somewhere, pip, are you here?

29:00 If you just say this patch of .cache slash pip, if you just change that to .cache slash UV,

29:07 I'm pretty sure everything else will just flow from there.

29:10 So awesome.

29:11 Nice.

29:12 Indeed.

29:12 All right.

29:14 Let's be ready for a joke.

29:16 Well, I was hoping you didn't have a lost the joke.

29:18 So let's see if I can find it.

29:20 Let's see what I can find.

29:21 All right.

29:21 So, you know, when you go to a page, that's bad.

29:25 Like if you go to Python bytes slash blah, blah, blah, and it's not there, should it just

29:30 say 404?

29:30 No, you should have something amusing and interesting.

29:33 Like for us, we have a big empty microphone in a stage with nobody at the microphone that

29:38 just says 404.

29:39 Try our episodes listing instead.

29:41 And you can click on it and it takes you to our episodes, right?

29:43 That's all fun.

29:44 So my joke, which I think I'll just let people link to, but maybe we can find one or two just

29:49 give people a sense, is 28 clever and funny 404 pages.

29:53 So I love this.

29:55 These are so good.

29:56 It almost makes me want to like mess up a website just to see what they've got, right?

30:01 Like one of them is for a blue path.

30:03 I don't know what that is, but there's a big map with tons of little dots of like, here's

30:07 all the distribution of where people live around the city or things happening.

30:10 It says, this is everyone else.

30:11 And then like way over somewhere else, it has a little dot says, this is you way off

30:15 the map.

30:15 Please go find.

30:16 Some of them are not that great, but some of them are real good.

30:22 So anyway, if this kind of stuff amuses you, Pixar has one with a crying inside out person.

30:29 It's sad emotion.

30:30 Yeah.

30:31 Yeah, exactly.

30:32 Exactly.

30:32 Others are just weird.

30:34 One has a bear wearing like a gold 404 baller type.

30:38 Anyway, check it out.

30:42 Lego has a unassembled disconnected sort of thing.

30:45 So I thought that would be pretty good for our episode 404.

30:49 People can scroll through that and enjoy it.

30:51 Yeah.

30:51 And also, I love watching the, looking at these.

30:54 So if anybody has a, has some good 404 pages that they, that they want to share with us,

30:59 head on over to Mastodon and, or our show notes page and send us, send us a link to your favorite

31:05 404.

31:06 That'd be fun.

31:06 Yeah.

31:07 Awesome.

31:07 All right, guys.

31:09 Thank you.

31:09 Thank you everyone for listening.

31:11 Brian.

31:12 Thanks for being here as always.

31:13 Thanks.

Back to show page