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


Transcript #323: AI search wars have begun

Return to episode page view on github
Recorded on Tuesday, Feb 14, 2023.

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

00:05 This is episode 323, recorded Valentine's Day, February 14th, 2023.

00:11 And I am Brian Okken.

00:12 I'm Michael Kennedy.

00:13 Hi, I'm Pamela Fox.

00:15 So thanks, Pamela, for joining us today.

00:17 So for people that don't know who you are, can you introduce yourself?

00:20 I'm Pamela, and I currently work at Microsoft, where I am a cloud advocate in Python, which means that I figure out how to get stuff working on Azure while using Python and make sure that our code samples are nice and Pythonic and that we're doing things the Python way and just trying to streamline the experience.

00:42 And yeah, that's really fun because it just means I get to write Python all day and actually just means I deploy all day.

00:48 I'm pretty much always deploying something, which I guess is appropriate.

00:53 I once had an ex-boyfriend who named our Wi-Fi network "Don't Stop Deploying" and the password was "I like to ship it" and I guess it was because I deployed so much back then.

01:03 So I guess I've always been a deployer, so it works.

01:07 But yeah, that's what I do now.

01:08 Before this, I was at UC Berkeley teaching Python and then before that was at Khan Academy and Coursera and all sorts of places programming in Python and JavaScript.

01:17 - Ooh, neat.

01:18 - That sounds like such a fun job.

01:20 I've always thought that developer advocate it would be really cool because you get to do all the cool coding tech stuff.

01:26 You don't have to run so much production software, so you're not on pager duty and you get to travel and talk to a lot of people like what else could you want?

01:33 You know?

01:34 Yeah.

01:34 I think for, for you to, it probably would be a really good job too.

01:38 It's, it's an, it's always just a really nice combination of programming and using the other parts of your brain too.

01:44 Yeah.

01:45 Excellent.

01:45 Excellent.

01:46 Well, we're happy to have you on the shows.

01:47 Thanks for being here and unrelated to Himela being here and working for Microsoft.

01:52 This episode is also brought to you by Microsoft for startups, but we'll talk more about that later.

01:57 Brian, should we kick it off?

01:58 Yeah.

01:59 While we all love to be in this tech space and you know, we're all big fans and that's why we're here.

02:06 Sometimes you just want to get away.

02:07 Right.

02:07 And especially in the American West, there's a lot of places that you could get away to.

02:13 The camping sites around here are magnificent.

02:16 There's one that I really like that has free roaming peacocks that just cruise through your camp while you're camping.

02:21 It's, it's really not an eagles flying around.

02:24 However, that and all the other places are super hard to find big for this exact same reason.

02:30 Okay.

02:31 So one of our listeners, I mean, oh gosh, I don't see his name here, but Jephthahn, Jephthahn is the name here.

02:40 Justin Flannery from Denver.

02:42 Also a great place with great camping.

02:44 put together this cool CLI, this terminal app called Camply.

02:49 So Camply is the campsite finder.

02:54 It's a tool to find campgrounds and campsites that are typically sold out through recreation.gov and Yellowstone and other sites, okay?

03:04 - Okay.

03:04 - So, you know, it's all Python.

03:06 So the idea is basically, it talks to all these different APIs.

03:11 You can either run it in Docker or just run it in Python, I believe.

03:13 pipx install camply, which I love it.

03:16 pipx is exactly how CLI tools that are not part of your programming story should be installed coming from Python.

03:24 And so you would say like camply, recreation areas dash, you could do a search like dash dash search, Glacier National Park.

03:31 Or have you ever wanted to stay in a fire lookout tower in California?

03:35 How cool would that be?

03:37 - That'd be pretty neat.

03:39 - Depends if there's a fire or not.

03:41 - Yes, exactly.

03:41 - Well, if there's no fire.

03:43 So maybe, maybe not September.

03:45 I don't know.

03:46 - Yeah, you got a glacier and a fire.

03:48 So maybe you just use this to counter each other.

03:50 - Exactly.

03:51 - Have you ever wanted to go down a really long ladder to use the restroom?

03:55 - Oh, you're so practical, Brian.

03:58 So practical.

03:59 Anyway, these things are not super easy to find potentially.

04:04 So you can say, I'm looking for campsites in some area, start date, end date, and search forever.

04:09 and it'll just sit there and just wait and hang out.

04:13 So it'll search at recreation.gov, Yellowstone, go into camp, Reserve California, some other places.

04:19 And yeah, it'll just sit there and pull that data for you.

04:23 And I think it's just a really cool app.

04:25 It's a cool use of Python and people, if they're interested in going camping.

04:31 - The bit about this that I like is it has configurable notifications for if it finds something.

04:37 So if you're looking for a particular campground and you just got it running in the background, you can have it hooked up to give you a Slack notification or an email or even a text message through Twilio.

04:48 And that's pretty darn cool to be able to just have it text you when you find something.

04:54 - Yeah, just kick it off, let it run, let it keep watching.

04:57 - Is it a cron job?

04:59 How does the Search Forever work?

05:02 - I think you leave it, I don't know for sure, but I think you just leave your terminal running.

05:06 - It must have a sleep or something, I don't know.

05:09 - Yeah, yeah, yeah.

05:11 You would hope otherwise it's gonna get banned pretty soon.

05:14 But no, I would think it just pulls every so often.

05:17 I think it's doing, I think there's some APIs in here.

05:20 If you look through, it talks about where the data is coming from.

05:24 There's a recreational information database from recreation.gov.

05:30 And it's pulling some of that data.

05:32 And yeah, I do think it's really cool but it also does those different notifications.

05:37 I've just learned about push bullet and push over and realized I should probably figure out what those are.

05:41 Those sound cool.

05:42 I know what Twilio is.

05:43 - And one of the things I like about this is this could be like a SaaS app or something like that.

05:51 And, but I'm glad that somebody, but you don't have to, if you have like a cool need that works for you and you think somebody else might have a need for a similar thing, so build something like this and share it.

06:02 you don't necessarily have to make money off the back of it.

06:05 There's a lot of, it's one of the things I've tried and been pushing more is, software developers have these skills that we can build things like this, but a lot of people don't, and being able to build things and share things is one of the great pleasures of doing what we do.

06:20 So kudos to Justin. - Absolutely.

06:22 Yeah, yeah, well done, Justin.

06:23 Thanks for sending that in.

06:25 And one of our listeners, Kim, also been on the show before, points out that, you know, he's from South Africa.

06:31 You should try camping in some places in South Africa.

06:34 Free roaming rhinos and elephants are slightly more concerning than peacocks.

06:38 Yeah, I'm impressed with people that live in places that have free roaming rhinos, or pretty much all of Australia, all of it.

06:46 Very impressed.

06:47 It's a lovely place, but I'm always a little nervous to be out of the city there.

06:51 - All of nature wants to kill you in Australia.

06:53 - Exactly, and it's good at it.

06:55 All right, off to you, Brian.

06:57 - Okay, wow, I'm not sharing anything yet.

06:58 So just one moment, share screen.

07:01 Sorry, all of the people were listening and waiting for this.

07:05 Okay, we've got fancy readmes.

07:08 So everybody loves, Henik points out that your fancy project needs a fancy PyPI readme.

07:16 Of course it does.

07:17 It's very nice.

07:18 There's lots of stuff.

07:19 So what sort of fancy stuff would you like?

07:21 So one example is the Black readme.

07:25 So Black is one of the ones that uses the same project that we're gonna talk about.

07:30 But so what's fancy about it?

07:32 It's just got, it's the normal standard readme stuff.

07:35 But one of the stuff that has things at the bottom is it's got a changelog listed here and the authors and some other stuff, the highlights from different versions.

07:46 How do you do that within a readme without copy and pasting?

07:49 So that's where this comes in.

07:50 So this is a project called Hatch Fancy PyPI Readme.

07:57 And Hennick has used, apparently in the past, setup.py for generating for packaging.

08:05 And with that was the ability to do some code while you're running setup.py.

08:12 But pyproject.toml-based stuff is different, right?

08:15 So if you just have a flit thing and you point it to readme, it'll just point to a static readme, or you'd have generators outside of this.

08:24 But what this tool does is it has, apparently there's a hook system within Hatch that allowed this functionality.

08:33 So there's configuration that you can do things like, and there's configuration on this readme to tell you how to use it and everything, but the things you'd want to use with it is these little fragments.

08:44 So you can add a text fragment, of course, but that doesn't really help you much 'cause you already have, you can write it down in your readme.

08:52 But this is, actually what this is, is this will be part of your, in conjunction with pyproject.toml and your readme to work together, which is cool.

09:04 So you can define some of the text fragments in your pyproject.toml and have them show up in your readme.

09:09 You can also do files.

09:11 You can say, hey, I actually want the author's file in there also.

09:14 And the files have a start after and start before and stuff.

09:19 So some of the files that you include in there might have some boring stuff that you don't want to include in there and you can cut that out. So this is really exciting to be able to, cause I've switched like all my project to pyproject.toml based projects, but I, I do want some neat stuff in my readme. So, I'll start using this as well. Okay. So you have files.

09:38 you also have pattern matching, which is neat, with files, but then down below substitutions.

09:46 So you've got like a search and replace patterns that use a regular expression substitutions. And then I think that's all. I'm not missing anything, but some pretty neat things that you can do within your readme.

09:58 Yeah, and you've got a CLI interface. It's lovely. It's almost like Jinja, Chameleon, some templating language for your readme.

10:07 So here's the thing that I am always confused about is, do you, you know, there's the readme and then there's the read the docs, right? And sometimes when I go to a package, I'm Which one should I go?

10:19 Like, should I start in the readme and then see if there are more read the docs?

10:23 Like, so this blurs the line even more.

10:25 It's like, should it just all be in the readme?

10:27 When do you go to, you know, the external docs?

10:31 Well, okay, so I've struggled with this on a couple of things.

10:34 And I've got one that's like on the line.

10:37 It's got a ton of functionality.

10:38 And so maybe it ought to be a read the docs thing.

10:41 But some people have really big readmes.

10:44 So which should you go to?

10:46 Well, the pack.

10:47 So are you talking about the package maintainer or the person learning about the package or should they go?

10:51 Well, I think you have both those questions, right?

10:55 I like, cause one thing is I can't decide where should I link to?

10:57 Should I link to the PyPy page or should I link to their read the docs page?

11:01 Right.

11:01 What's it's just, what is the canonical non-quotation?

11:03 And right now I think as both a creator and a user of packages, it's not clear where to go.

11:10 Well, as a user, I always try to start at the PyPI page.

11:15 and whatever, hopefully there's either a homepage, it's got, like Black has homepage and changelog, you can include a documentation link too.

11:24 So if it's just got a homepage, it's just probably the readme.

11:29 But the documentation, I think it's nice if people leave the homepage to go to their GitHub repo and add a documentation link if they've got a read the docs thing, I think so.

11:41 - I do like to see a lot of stuff in the readme 'Cause if you're already there, you don't have to go track it down.

11:49 The time that I would see, Brian, maybe is if there's a lot, a lot of different scenarios.

11:55 Here's this API function, and here's a tutorial, and here, you know, maybe, where there's a lot of navigation, I guess, maybe it makes sense for a read the docs.

12:03 Or if it fits on one file, then maybe make a copy.

12:06 I don't know.

12:07 - I've got a lot of tiny little pytest plugins that I'm just not gonna do a read the docs documentation tree.

12:14 It's just a little tool.

12:15 So small tools, it's easy.

12:17 It's the in-between part that it's difficult.

12:20 So, I don't know.

12:21 >> Yeah, for sure.

12:23 >> All right.

12:23 >> I love our audience. I'll have great things to add here.

12:26 Henry Schreiner says, "GitHub dependency graphs now support PEP 61 as of yesterday." So how's that for keeping on top of things?

12:35 So perfect time to switch.

12:37 If you haven't yet, nice read me's too.

12:39 And then, Saroh says, "The docs link "should always be at the top of the readme." So, excellent.

12:47 - Yeah, I like that too.

12:49 - Yep, and one more piece of real-time follow-up.

12:51 Justin, author of Camply, is in the audience, says, "Yes, wait, no, wrong one, I got out of sync there.

12:58 "Thanks for featuring this.

12:59 "You can leave it running in the background.

13:01 "That's where the accompanying Docker image is from, "so you could just push it over to a Raspberry Pi "and just let it cruise there, which is kind of cool." - So it's just to figure out, make sure I understand this.

13:11 If you close your laptop while a Docker image is running, is it going to keep?

13:16 - It's probably gonna stop.

13:18 - Okay.

13:18 - It depends on your sleep. - So that's why you want the Raspberry Pi.

13:20 - Yeah, yeah, something you can just leave on.

13:23 Or, you know, something, I guess you could set your laptop to still running if the clamshell bit's closed, but generally it would close.

13:31 You could even put it onto one of those little tiny Adafruit things I would imagine.

13:36 I doubt that there's anything that platform specific, probably just requests and stuff.

13:41 - Or you can have a Mac mini running.

13:44 - Yes, you could definitely have a Mac mini running, like the one I'm using right now.

13:47 All right, before we move on, let me tell you about our sponsor this week.

13:53 So, as I said before, this episode is brought to you by Microsoft for Startups, Founders Hub.

13:58 I'm here to tell you all about a fantastic opportunity for startup founders, especially those interested in AI, With over six figures in benefits, this program is a game changer for startups.

14:09 You'll get $150,000 in Azure credits, so you can work with them a lot to deploy many, many things, which is the richest credit offering from any cloud provider.

14:19 Founders Hub is offering a unique chance to access open AIs, APIs, as well as the new Azure OpenAI service, so you can easily infuse generative AI capabilities into your applications.

14:30 The team at Microsoft will also provide you with one-on-one technical advice to help you with architectural plans, scalability, implementation best practices and security.

14:38 Plus, you'll have access to the network of mentors plugged into the startup world, which we've talked about a lot.

14:44 A huge asset for building your network.

14:46 The best part is the program is open to everyone and has no funding requirements, whether you're in idea phase or further along.

14:52 It just takes five minutes to apply and you'll get all these benefits.

14:55 So harness the power of AI in your startup.

14:57 Sign up for Microsoft for Startups Founders Hub today at pythonbytes.fm/foundershub2022.

15:04 Link is in your show notes.

15:05 No-brainer opportunity for startup founders, so don't miss out.

15:07 And Brian, one more thing, just to make the point about how awesome some of these OpenAI APIs and different things that they're offering here is, I asked that same AI to write this ad for us.

15:19 So, how cool is that?

15:22 If you wanna do, I don't know if you've played with these things yet, but OpenAI is really incredible.

15:28 and if you want all these credits to be able to work with it, access to AI, different APIs that maybe don't, people don't all have, sign up at our link in the show notes.

15:38 So thanks to Microsoft for supporting the show.

15:39 - Nice.

15:40 - And thanks to OpenAI for writing a cool ad for us.

15:44 - Wow, I still don't have access to OpenAI and I work for Microsoft, so I guess I just need to apply for that program.

15:50 - Exactly. - I've been waiting.

15:51 - Where's your startup idea?

15:52 Get in the game.

15:54 All right.

15:56 This next one comes to us from Pamphil.

15:59 - Well, wait.

16:00 - Oh, go ahead.

16:01 - Don't we have one from Pamela?

16:02 - How did we, how did I skip that?

16:04 Yes, we absolutely have one from Pamela.

16:07 Sorry.

16:08 - All right, sweet.

16:09 So I'm gonna talk about something new in Pyodide.

16:12 I know Pyodide has been on this show before.

16:15 Pyodide is Python for the browser based on WebAssembly, a port of CPython to WebAssembly.

16:21 Now, the really cool thing, I've been using Pyodide for various projects for a while, But the very cool thing that happened recently is that there's now 3.11 support in the latest.

16:31 So in main, there's 3.11 support.

16:34 This was the PR for it.

16:36 And so it's not in stable yet.

16:38 It's in latest, but that means you can actually, you know, try it out in their little REPL here.

16:45 I can't break up 3.11 code off of that, but you can see it says 3.11.

16:50 And what they're working on right now is, Let's see, they're working on some benchmarks.

16:55 So they did some benchmarks here to show, you know, there's, cause 3.11 has a lot of speed up, improvements.

17:02 So they did a bunch of benchmark here, but it looks like they're also interested in other benchmarks as well.

17:09 Yeah.

17:10 It looks like some are getting faster though, which is really cool.

17:12 Yeah.

17:13 And I also, so I did my own benchmark.

17:16 I mean, I wrote a function called benchmark.

17:17 So it must be a benchmark, right?

17:19 So one thing that I use Pyodide for is recursionvisualizer.com.

17:24 This is something I built when I was teaching Python at Berkeley, and we taught a lot of recursion in Python, which I know is a weird thing to teach in Python, but this is academia, so we teach recursion in Python.

17:34 This is a tool that uses Pyodide in order to visualize the call graphs.

17:41 When you're doing recursive functions, they can take actually a long time.

17:46 It appears trip 10 is actually going to take a while.

17:48 Here we go, we got it. That wasn't that bad.

17:50 >> Oh, my gosh.

17:53 It's a bit long.

17:54 There we go.

17:55 BRIAN DORSEY: It's amazing.

17:56 [LAUGHTER]

17:58 AMANDA SCHADE: So I enabled 3.11 for this yesterday in my local branch and did my own little benchmarking.

18:08 And it's like 15% faster, which is actually relevant for recursive functions, because some of the recursive functions that you run here can actually take a long time.

18:17 All you have to do is increase this parameter a little bit more, and it really takes a while.

18:22 So it is definitely faster for at least this use case here.

18:29 So that's cool.

18:30 It's not yet in the stable.

18:33 So you can see what they're working on here.

18:34 It should be in the next release of Pyodide 0.23.

18:38 They're working on that.

18:40 So I also tried it out in my other tool that uses Pyodide.

18:44 So this is dis.com.

18:47 So this is a way to disassemble Python code in the browser, because I love the DIS module, and I want everybody else to love it too.

18:54 So DISthis.com.

18:56 And the thing that I was able to do with this, because of 3.11, is that 3.11 has the specializing adaptive interpreter, which actually replaces certain opcodes with other opcodes when it sees that it's hot code.

19:12 So some code has been run, you know, at least like eight times, and it's doing some particular operation that it can optimize.

19:19 it actually replaces a byte code.

19:20 So we can compare this to this, and you see that when we have the adaptive interpreter, it's using different opcodes than it used before.

19:32 And it's also got this cache here.

19:34 So this is cool that now you can actually see 3.11 and see the difference in how 3.11 can work versus 3.10.

19:43 So yeah, I thought this was really fun.

19:45 - This is amazing.

19:46 And your visualizer for the recursion is really cool.

19:50 - Yeah. - Yeah.

19:51 - Yeah, that's really cool.

19:53 So this one, this dis this, and props for good naming there, that's funny.

19:58 But wow, you even get the adaptive interpreter in Pyodide.

20:03 - Yeah. - Yeah, that's really cool.

20:05 - Yeah, so in order to do this, so I put this together yesterday since I wanted something cool to show.

20:11 So to do, if you want to have the, If you want to have the latest PyDive, if you want to try it out, if you're like me and for some reason have a huge number of PyDive projects, I'm sure you all are, you just have to do /dev, right?

20:26 So instead of a hard version number, and of course you shouldn't do this if you're using PyDive for something production, but I don't know who's using PyDive for something production 'cause to me, PyDive is all about a great way for building educational tools in the browser.

20:39 I have no desire to replace JavaScript with Python.

20:42 I think you should use JavaScript if that's, you know, We're just trying to make it interactive site.

20:46 But for making educational Python tools in the browser, PyDyte is mwah, it's so good, right?

20:51 We don't have to run a sandbox server.

20:54 So if you want to try out 3.11, you just do /dev instead of a hard version number.

21:00 - Nice.

21:01 - Yeah, this is very exciting stuff.

21:03 What are your thoughts on PyScript?

21:05 Have you played with PyDyte?

21:06 - Right, so I think PyScript is exactly what I don't want, which is trying to replace JavaScript, right?

21:11 As far as I'm concerned, I haven't played with it.

21:13 - Yeah, I think it might be.

21:16 Although, I think also it may offer some interesting alternatives, right?

21:21 Like for example, if you've got a progressive web app or you've got an electron JS thing and you want to write Python more locally, you know, I think some of these are kind of interesting options.

21:33 - Yeah, so for educational tools, for dev tools, but we really need, I mean, we already, even with JavaScript, we're making websites that are not very performant, even with JavaScript.

21:42 And when you bring in these PyDi, a PyDi is huge.

21:45 It's a big old bundle.

21:46 You shouldn't be like this YOLO downloading PyThon, downloading CPython into your webpage, right?

21:52 - It's definitely too big for that, that's for sure.

21:54 All right, also I'm super impressed.

21:57 A lot of our guests will say, "I found this cool thing and it was really neat." But you're like, "Oh, I wanted to create this amazing website to demonstrate some stuff of a new feature." So well done on this list and other things.

22:08 That's awesome.

22:08 - Cool examples, yeah.

22:09 - All right, yeah, very cool.

22:11 We'll definitely put those links in the show notes for people to go check out.

22:14 All right, Brian, now should I go now?

22:17 I can't believe I almost skipped.

22:20 Family is amazing stuff.

22:22 All right.

22:22 So going from really fun to slightly less fun.

22:26 How about we talk about European law?

22:28 Is that good?

22:29 So sure.

22:30 That sounds exciting.

22:31 Yeah.

22:32 There's this, the, this, what is it called?

22:36 Let me pull up my notes here.

22:38 There's the cyber resilience act.

22:41 the CRA, which is a proposal to hold, I think the most important part is to hold companies that write and ship software liable for knowingly being really negligent about shipping vulnerable software.

22:58 So for example, you sell a router, it's like some cheap knockoff router, you support it with updates, maybe once, maybe never, it has some huge vulnerability that people take over your home network, if they run it, you know, RC remote code execution really, really bad, you just don't bother to fix it, because it's not worth it. Right? We don't want to we don't want to worry about that. I think that's the idea of this is to say, companies that do that, no, they can't sell us a device we put in our house, or we put software systems that we put into our hospitals, and just don't care about fixing them from a security perspective, right? Not from a not working so well perspective. However, the concern that Panther Roy pointed it out and sent this over and that's why I'm talking about it is there's a concern that that also applies to open source. So if I made some open source project, somebody adopted it, there was some vulnerability in it. Am I now facing, you know, fines and punishment from the European Union because I didn't patch my silly little program. So there's this organization called the Open Source Initiative. And the, let me pull up my little heights here, it This Cyber Resiliency Act is an interesting and important proposal for European law that tries to drive safety and integrity for software.

24:14 The proposal includes a requirement for self-certification of suppliers of software to attest that they conform to it for security, privacy, and the lack of CVEs, critical vulnerability events.

24:25 However, the European Commission has framed an exception for open source, but they say, We've been doing this for a long time, drawing on two decades of experience.

24:36 We can clearly see the current text will cause extensive problems for open source.

24:40 Since the goal is to avoid harming open source software, we really need to make sure that certain wording of this basically gets replaced.

24:49 So the thing I'm linking to is the feedback from the open source initiative around this project submitted by Simon Phillips.

24:59 So people can check it out and see what they think.

25:02 But there's a lot of things out there that are well-intentioned that have unintended consequences.

25:08 And I'd hate to see open source get squashed because people are afraid of the security liability of it, basically.

25:16 - Is this related to that lawsuit against the crypto open source authors where they're trying to get lots of money from them claiming that they should be able to recover their tokens.

25:30 - Interesting.

25:31 It might've been inspired.

25:33 I think it's more of a general, kind of like the GPR, a general law coming, proposed in the EU.

25:41 Yeah, pretty interesting.

25:43 There's a lot of stuff up in the air.

25:45 We've got, you know, the GitHub copilot lawsuit, and we've got the stable diffusion lawsuit with Getty.

25:53 You've got this kind of stuff.

25:54 In the US, everyone seems bent on destroying Section 230, which is the protection to allow people to post their own stuff if you moderate it.

26:04 It's, we'll see where it goes.

26:06 I have no idea what's gonna happen with these things, but they're kinda, a lot of stuff's up in the air, and here's one more bit.

26:11 - Yeah.

26:12 - Right, Brian, over to you.

26:13 - Okay, so, that was deep.

26:18 - I know, so I told you we were coming from a really fun thing that Pamela did, like, oh, here's some law.

26:23 Well, let's go to something really simple.

26:26 Single quotes or double quotes on your strings?

26:30 So let's do a quick poll here.

26:33 Pamela, you got a preference?

26:34 I had to figure this out a couple of days ago, because I've been trying to make the Azure samples more Pythonic and by running Black.

26:41 But Black changes all the--

26:44 what does it change?

26:45 I don't even know.

26:46 Single to double, right?

26:46 Single to double.

26:47 I'm not totally sure.

26:48 It changes all the single to double.

26:49 But it's such a big change.

26:51 And I'm like, it's so arbitrary.

26:52 It doesn't matter.

26:53 I undid that change.

26:55 Luckily, there's a black option that you could do, which is like ignore string normalization.

26:59 So I now run it with that.

27:01 Because I actually, I don't have, I mean, I think the only reason I would tend to do single quotes is that in case I was embedding HTML, I really want double quotes in HTML.

27:09 Of course, that means I'm a bad person that's embedding HTML in my Python, so.

27:13 - There's other reasons too, so.

27:16 Well, a similar, okay, Michael, do you have a preference?

27:21 - I think I prefer single quotes because it's one fewer keys to press on the keyboard.

27:26 Yeah.

27:27 - Oh, yeah, you don't have to do shift.

27:28 - Given that I have, excuse me, that I have RSI issues and I got to be careful of, and I have my super cool Microsoft ergonomic keyboard that makes a massive difference but I still always am thinking about what can I do to like type less, do less with my hands and accomplish the same thing.

27:43 But I have an exception and it's similar to Pamela's but not exactly the same is if I'm doing anything where I want to put a quote.

27:51 So if I have to say, it's the second day of the week, then I'm gonna put an apostrophe for the it's, and I don't wanna backslash that, so I put double quotes for the string, so then I don't have to escape the single quote.

28:02 But if I was using double quotes in the string, then I would put single quotes, so I don't have, like, so if I'm using one, then I'll use the, inside the string, I'll use the other, so I don't have to use escape characters.

28:11 - So that's like the argument that Black has for why they chose the double quotes, I think, is because of the apostrophes.

28:21 But I'm not really writing a lot of prose within, if I'm writing a lot of prose, it's usually, it's a triple quoted string and it doesn't matter.

28:30 Usually, 'cause I'm doing a block thing.

28:32 But, so this article is, so single or double quotes in Python, and this is coming from somebody that came from R and came to Python and similarly wanted to make sure they were doing things Pythonic-like.

28:44 And they ran across people using Black and you know, what to do about that.

28:49 So they looked into it a little bit more and like, you know, what is, what's pep eight say?

28:54 Well, pep eight say that doesn't say anything about this.

28:57 And I don't think this article goes into it, but the other thing, not just pep eight, but if you try out Python itself, the REPL, if you define a string in the REPL and then like x equals hi there, and then say, what's the value of x, the REPL uses single quotes.

29:15 So that seems Pythonic to me, unless we're saying the REPL is non-Pythonic.

29:19 So the real answer in this article is, it's up to you.

29:25 But it kind of isn't because people use black in their projects.

29:28 And there's a lot of people that are black fanatics, and nothing against them, I'm kind of one of them as well.

29:35 So me personally, I am kind of a mix.

29:39 So I use black on almost all projects, and I use, but I just type it in as single quotes and just let black fix it for me.

29:48 And so the RSI is solved and black's happy.

29:53 But mostly it's just, I don't wanna make that decision on a lot of projects.

29:58 But there are some projects that there's a lot of quotes in there and it really, or the tradition or there's a ton of code already there.

30:06 And so I wanted to point out that this, I guess it's a public service announcement.

30:12 If you're not really into black or just this part of it, just black is a great idea, but I just don't want to go with double-quoted strings, there's blue.

30:21 So everybody just remember there's blues around.

30:24 Blue is just like black, but there's three primary differences.

30:28 The single quote, it's defaults to single quotes instead of double quotes.

30:33 So for projects where it really makes sense to use most of the time single quotes, and I have several that we're sending strings to other APIs, and it's just tradition to use, There's other parameters inside that use double quotes and they can't be single quotes inside.

30:50 So they have to be, it's the, anyway.

30:52 So there's projects I use blue on that for that.

30:55 The other thing is black defaults to the line length of 88 characters, I think, which is a little weird.

31:03 I know there's logic around it, but it's still a little weird.

31:06 And if you're going with Pep8s or the traditional 79, I don't think Pep8s specifies 79, but a lot of people use 79.

31:13 So blue defaults to 79.

31:15 And the other thing that I like is it preserves white space around hash marks.

31:20 So if you've got comments along the right side of your code, like in multi lines, and they're lined up by the hash marks, black will strip that out and says, "Ah, you only need two spaces there." And blue says, "You can align over there. That's fine." So those are the three differences.

31:37 So blue is pretty cool. I like it.

31:38 >> Yeah. Pamela, use blue, black.

31:42 - Yeah, gosh, there's too many options.

31:46 I am waiting for Ruff to implement formatting and then I will have only one tool that I need to use for everything.

31:52 'Cause Ruff now supports eyesore and pyupgrade.

31:56 So we're just waiting.

31:57 And Charlie says he's working on formatting.

31:59 So I'll just do whatever Ruff does.

32:02 - Ruff is awesome.

32:03 - Yeah, Ruff is really cool.

32:05 Some interesting angles from the audience that I think are worth throwing out here.

32:10 However, if you want to fix this, if you think black should use single quotes, just do a PR, I'm sure they'll accept it.

32:16 Here, (laughs)

32:17 the thing like now we have, we've decided.

32:20 Kim says, if you write both C and Python, you'll learn to stick with double quotes or you'll wonder why C doesn't work.

32:27 And yeah, so basically David Poole says the same thing.

32:31 Like if you're working in a language that treats or doesn't support single quotes for strings, like you might, you might want to.

32:38 - It's not the only thing.

32:39 I keep trying to write printfs in my Python code.

32:43 So.

32:43 You do?

32:44 Oh, you're so old school.

32:45 I use cout less than, less than.

32:47 Or my C++ style there.

32:51 All right.

32:52 Yep.

32:52 All right.

32:53 So, who we got next?

32:55 Pamela.

32:56 Pamela.

32:57 This weekend I decided that my personal website is over-engineered.

33:02 So my personal website is pamelafox.org and it's super over-engineered.

33:08 So right now it is a Docker, so it's containerized.

33:12 It's a Flask app running inside a Docker container on Azure Container apps with a CDN in front.

33:19 And it pulls the data from a Google spreadsheet, an authenticated Google spreadsheet.

33:27 So all this data is actually from a Google spreadsheet.

33:30 - That's cool.

33:31 - So it's a little over-engineered.

33:33 And part of the reason it's over-engineered is 'cause I ported it from App Engine Python 2.7.

33:37 So like old school App Engine and I was trying to port it to Azure.

33:40 And so I was using Mincash before and I was trying, so that's why I put a CDN in front.

33:44 So anyway, I realized, you know, it's not that fancy of a website and the data only updates like once a month or something.

33:51 Right.

33:52 So why do I have this whole Flask app that's just running all the time using up cloud resources?

33:57 So I wanted to be less wasteful.

33:59 And I also wanted to try out static web apps because I feel like everybody's talking about that all the time, at least around me.

34:05 So I was like, okay, how could I make this into a static web app?

34:09 And people have recommended various things in Python like Pelican and Lector, but I already had this Flask app.

34:16 So I was like, there has to be an easy way to do this for Flask.

34:19 So I found this frozen Flask and it takes a Flask application and turns it into a set of static files.

34:26 So you just put in this code here and then you just run this and it'll create a folder and put the HTML files in there.

34:35 And it just does it by looking at the routes and then looking at all the URL for, and then recursively following URL fors until it thinks it gets it all.

34:42 And then you can deploy it.

34:44 So you could deploy to whatever static web app.

34:47 So I deployed to Azure, but you could also probably deploy to Netlify or wherever the cool kids deploy their static web apps.

34:54 - GitHub Pages, Netlify.

34:55 - Yeah, so if you do GitHub Pages, then you do have to check it in, right?

34:58 So that's the only thing is if you did GitHub Pages, you'd have to check it in.

35:01 So now I see one of the advantages of using something other than GitHub Pages, 'Cause I usually use like recursion visualizer, dish this, they're all GitHub pages.

35:09 But I wanted to see what's it like when you're actually not just using GitHub pages for everything.

35:14 So I thought this was cool and it's not a recent thing, but the thing that's relevant is that it recently lost its maintainer.

35:26 So in December, there was this pull request where the current maintainer, the most recent maintainer stepped down.

35:33 So it currently has no maintainers.

35:36 So that makes me sad.

35:38 And maybe somebody here could maintain it.

35:42 'Cause to me, it was a very useful project 'cause I was able to, here's the pull request, right?

35:47 And the pull request is way more than I actually had to change.

35:51 But I was able to do this freeze and then set up some infrastructure and boom, I've got a static website.

35:58 And I didn't have to do a big old port to Markdown and Pelican and all sorts of things.

36:04 So I think it's a cool project.

36:06 It could use a little love today on Valentine's Day, some maintainer love.

36:11 So that's what I wanted to show it.

36:15 - So I like Kim's comment saying, "Surely personal websites are supposed "to be over-engineered.

36:21 "It's how you learn what not to do "in your employer's production environment." - Yeah, no, I know.

36:28 And so I'm glad I over-engineered it, but then I saw the bill, I was like, I really do not need to be paying this much for my personal website.

36:36 So I did learn.

36:38 Yeah, thank you, Kim.

36:39 - Yeah, so my personal stuff's on Netlify.

36:42 It's a Hugo, running Hugo as a generator, and then running on Netlify, and it's all free, so I like that.

36:51 But I like the work, it's mostly the workflow.

36:53 So the workflow of like, I wanna write something new, what does that workflow look like?

36:57 And right now it's write a markdown file and commit it, and push it and that's it.

37:02 So I like that.

37:03 - Yeah, for me, I update my Google spreadsheet.

37:05 I'm debating, I might move it to a JSON file because then I could have like a CI that just makes sure the JSON is well formatted, maybe something like that.

37:15 But I'm kind of a freak for spreadsheets.

37:17 So I've been using a Google spreadsheet for 15 years.

37:20 - Spreadsheets for website content?

37:22 - Actually, I love it.

37:23 It's so amazing.

37:25 - You've got to have overflow wrap though on some of those columns, I'd imagine.

37:29 - In the spreadsheet, right?

37:31 - Hmm, yeah.

37:32 - Yeah, this looks like a really cool offering or a cool library for people who, for whatever reason, have a website written in Flask.

37:39 And it doesn't have to just be for a blog or a personal site.

37:42 You know, it could be someone's built a Flask site for like an e-commerce type of thing or some marketing type of thing, and they realize, you know, we don't really change this.

37:52 We haven't changed this in a year and a half.

37:53 Why do we need to maintain servers and patch things, right?

37:56 - No, and this is kind of a neat project that for somebody to take on as a new maintainer.

38:03 - Yeah, looking to level up your open source game.

38:07 - How about extras?

38:07 We got all of our main stuff done.

38:10 Pamela, do you have extras?

38:12 - The extra that I was gonna mention was already brought up in the chat was the fact that GitHub dependency graph now supports pyproject.toml.

38:20 And I think maybe Henry brought that up.

38:23 Yeah, Henry brought that up in the chat.

38:25 But I was gonna show, wait, where's my, OK, so I found this Python package template from Microsoft for somebody at Microsoft.

38:35 So if you're starting a new Python project, this has everything in it that's done the proper way, including the pyproject.toml--

38:43 or OK, maybe not proper-- the way that they think it could be done.

38:49 So if you use this, then the GitHub dependency graph should pick up on your dependencies.

38:58 So that was my extra thing was just to talk about the pyproject.toml with the dependency support now.

39:06 - That's big news.

39:07 - Very good one.

39:08 Brian?

39:09 - I'll have to go take a look at that and see what all I disagree with.

39:11 (laughing)

39:14 - The Havasura structure, you're halfway there to liking it.

39:19 - That's good.

39:20 So I just was curious what everybody thought.

39:23 I don't know if this is new, but I just saw it.

39:25 The pricing structure for GitHub.

39:28 Is this a new thing?

39:29 I don't know.

39:31 So 40, like the individual user gets extra stuff for $48 a year, essentially.

39:37 48, it's not per month, it's per year.

39:39 So that doesn't seem terrible, but what do we get?

39:41 So this is basically the free tier is just always, you still get everything for free, but the copilot is what, 10 bucks a month or something?

39:50 So there's some extras that you can add on to other things.

39:54 I was, before the transition or whatever, a couple years ago I was paying for GitHub Pro so that I could have private repos.

40:02 Now you can have a private repos with the free one, so I switched to the free.

40:06 Is there, what do you guys, Michael, do you have an opinion on this?

40:11 - I guess I have an opinion since I pay GitHub every month for the Talk Python organization, because if you have an organization and you wanna have people in your organization like Talk Python authors, then you have to pay to have them, which is different than an individual having private repos and things like that.

40:31 One of the things that looks interesting from the team perspective is the Codespaces, which is basically a server to run your code on, right?

40:38 Is that right, Pamela?

40:40 - Yeah, but why are they, this is what I, I actually just opened it up to look at that particular point and expanded it.

40:44 'Cause you can, I use GitHub Codespaces constantly on free, and you can use it on free as well.

40:50 So I'm trying to understand what the distinction between the free and the team is for Codespaces, 'cause I'm also a Codespaces freak.

40:57 - Looks like on free, you've got 15 gigabytes max.

41:01 So, I don't know.

41:03 - You can just pay for a little bit more.

41:05 I just pay 'cause I go over.

41:07 - And more CI/CD.

41:10 I mean, I guess I'm getting to the point where a lot of these extra things like GitHub Actions and more complex GitHub Actions, and basically I'm doing more.

41:21 If I ever hit some of these limits, I think I'd be happy with paying.

41:25 - Yeah, $48 a year is not the worst subscription that I pay yearly.

41:30 - Yeah, there's stuff I use way less and pay more for.

41:34 - Oh yeah.

41:35 - Anyway, okay, that was just my extra.

41:36 I was just curious about that.

41:38 - Okay, I've got a couple as well for us.

41:40 - Okay.

41:41 - Our transcripts are way better over here now.

41:43 So if people are interested in using the transcripts, which we have for every episode, not entirely unrelated to open AI stuff.

41:52 We have way better transcripts, like for example, even when Brian said pyproject.toml, it got that perfectly right, which is amazing.

42:03 And that means our search, we have search that doesn't just search, you know, some people search on their site, like for podcasts and stuff, just searches the show notes.

42:10 Our search is every spoken word, right?

42:13 So if you looked for ChatGPT and pyproject, something like that, then check it out.

42:21 We're also live streamed by the way, but there it is, right?

42:23 That one, which neither of those, I believe were listed in the show notes whatsoever.

42:27 So because we're getting much better, like tech words in our search and our transcripts, that means our search should be way better for people to try that out.

42:34 Anyway.

42:35 - So how did you make the transcripts?

42:37 What did you use?

42:39 - Some of the open AI API stuff over there.

42:43 I got a cool Mac app that like plugs into that.

42:47 - I love that.

42:48 - Yeah, if you need something that will make your Apple Silicon Mac that normally is cold to the touch and you put it on your lap, you're like, "Oh, that thing's a cold laptop." But you want it like a heater, you can try to generate one of these transcripts.

43:02 It'll be warm for about half an hour.

43:05 All right, and similar, not the same thing, but somewhat related is the AI chat wars, I think are really taking off.

43:13 And I watched an interview with Satya Nadella, CEO of Microsoft, he was just relishing.

43:20 He was just completely sitting back and smiling and rubbing his hands like, "Oh, this is gonna be good." 'Cause Microsoft and OpenAI have that partnership.

43:30 I'll leave it at that, I guess.

43:31 It's probably a little more complicated with partial owners and credit.

43:34 Anyway, but they're working very closely together.

43:36 And so Microsoft announces that Bing is going to have chat GDP integration as part of its results, and you can actually talk to it.

43:44 And GDP4, I believe, not just the one that's out.

43:47 And so as a result of that, like that day, Microsoft Bing rockets to the top of the app store after announcing ChatGPT integration.

43:54 Like when was the last time you were like, oh my God, where is Bing?

43:56 I've got to get it.

43:57 You know, this is just not something that has been happening lately, right?

44:01 And like, boom, overnight it switches.

44:03 The converse is the same day, maybe the next day.

44:07 I think that's the same day.

44:08 Google shares drop $100 billion after the company's AI chatbot flops in the dough.

44:14 So contrast those two things And it's going to be an interesting next year or so in the big tech space.

44:20 Yeah.

44:21 So anyway, those, that's just, put that out there as something interesting to check out.

44:28 So also, I worked with the folks at JetBrains to get our students at TalkBython training a free copy of PyCharm Pro.

44:36 So for folks who want that, this only works for new users.

44:39 It doesn't work for renewals.

44:40 But if you don't have a PyCharm Pro account already, then just visit the link and, and you must be a customer at Talk Python Training.

44:48 That's part of the deal with JetBrains, again, just to hand them out randomly.

44:51 Anyway, if you are, there's like a little statement of what it needs, but for many people, they can just check that out and get a free copy of PyCharm Pro, which is fun.

44:58 And if you don't, if you're not already a member, just go ahead and purchase the pytest course.

45:03 Yeah, exactly.

45:04 I think the pytest course, this guy named Auchen wrote it.

45:07 It's pretty good.

45:07 People should check that out.

45:08 the mobile apps last time or time before last I mentioned, I was looking for someone to help me rewrite that.

45:14 the flutterification of our mobile app story is well underway, and so thanks to the audience for helping get that going.

45:28 And then very last thing, Brian, is I did a Talk Python episode in the behind the scenes at the Lawrence Livermore National Laboratory with the folks, how Python was used to do the fusion ignition breakthrough that we all heard about like a month and a half ago.

45:42 So Python is a super important part of that.

45:44 Turns out, and I interviewed Jay Solomonson, he's down at the bottom because of responsiveness, but great story, look inside that whole thing.

45:53 So people should check that out.

45:54 I think it's kind of a unique story that, this was in the news a lot, but not this aspect of it.

45:59 - Cool.

46:00 - All right, that's all my extras.

46:02 - So was the, we usually do a joke, but we forgot our joke last week.

46:06 Was the Bing story the joke or?

46:08 - No, the Bing story is real.

46:11 - We have a couple of good jokes, I believe.

46:13 - Yeah, okay.

46:14 - It's for some, let me pull them up here.

46:17 I think you've got one as well, but let me put my stuff back on the screen.

46:20 - I didn't know we were supposed to have jokes.

46:23 - Oh no, normally we just have one.

46:24 We just screwed up last time, so we only had a, we somehow skipped it.

46:28 So this is one of those, you know, you go to the fast food restaurants and you'll see they've got these digital menus up on the screen.

46:35 - Yeah.

46:36 - So here we've got, there's a McChicken, All rights reserved little circle meal.

46:41 There's a Big Mac all rights reserved meal.

46:44 There's a chicken McNuggets 10 piece meal, but do you see what's in the middle there, Brian?

46:49 Yeah.

46:50 The dollar bracket title bracket.

46:53 It's 1350.

46:56 What is it?

46:57 Dollar bracket title.

46:59 It's so amazing that it's up there.

47:00 I don't know if there's just supposed to be curly braces and they missed the shift or something, but the comments folks, the comments are nonstop.

47:07 Some of them I can't read because, (both laughing)

47:12 because it's not actually safe for work, but it's like, you know, what the McBlank is happening to my McMenu and oh my gosh, it's so good.

47:21 - It's funny.

47:22 - Yeah, also the pricing, it's really high.

47:24 I don't know who pays, you know, what is that?

47:27 $13 for a McNugget meal or $10 for a cheeseburger, but that's a pricey burger.

47:32 I guess it's a meal, includes a drink, but still, whatever, that's a lot.

47:36 - Yeah.

47:36 Huh. That's funny.

47:38 Okay. Well, I have something that I was laughing, like, so hard at, and I'm not going to go through all of it, but it's 59 hilariously infuriating examples of user interfaces.

47:50 And I couldn't stop laughing.

47:54 The first one right off the bat, please enter your phone number.

47:57 It's just got a plus sign. You just walk up.

48:01 And then the second one's actually my favorite.

48:05 You got to press it like 7 million times to get your phone number to show up.

48:11 The Angry Birds version of a volume control.

48:15 So you just like pull it back and then shoot the ball to what volume you want.

48:19 Oh, I love it.

48:21 I want that actually.

48:23 That would be fun.

48:25 But there's 59 of these that are just terrible.

48:27 Please enter your phone number with a dial wheel.

48:30 A digital dial wheel.

48:32 That sounds kind of fun though.

48:33 It's been so long to say, I kind of want to go out and just get an old phone just to do that.

48:39 Yeah.

48:40 A volume slider that's just like, you have to like make it level.

48:45 Yeah, it's like a level it slides the volume to like, yeah, balance it out.

48:50 Yeah.

48:51 So is this your phone number?

48:54 It's a phone number entry that just guesses your phone number and you have to say if it's right or not.

48:59 (laughing)

49:00 Anyway, we won't go through all 59, but these are worth a good laugh.

49:06 It's probably not safe for work, unless it's okay for you to be laughing at work.

49:11 There's nothing illicit there, it's just, you know.

49:13 (laughing)

49:16 - You're not allowed to laugh at work.

49:19 - Well-- - This is work.

49:20 This is not for fun.

49:21 You're at work, remember that.

49:22 (laughing)

49:24 - I had a manager once that was sat right across from, long time ago that sat right across from me.

49:29 And every time I glanced over, he was playing Solitaire on his computer.

49:33 Like, six hours out of the day, every time I looked over, it was Solitaire.

49:39 I wanted his job.

49:40 (laughing)

49:42 No, but anyway.

49:44 - All right, Brian, thanks a lot.

49:45 You just ruined the next hour of productivity for me with this article.

49:49 (laughing)

49:50 - Anyway, I guess that wraps up all of our items.

49:53 Thanks everybody on the live stream for watching and everybody that watches it later.

49:58 Super thanks to Pamela for showing up today and thanks Michael.

50:01 - Yeah, thank you.

50:02 Great to have you on the show Pamela.

Back to show page