Latest / Talk Python To Me / #396: AI Goes on Trial For Writing Code (crossover)
Transcript
- 0:00Hi folks, for our final episode of 2022 here on Talk Python, we're crossing the streams with my other show, Python Bytes.
- 0:07I present to you one of the more popular episodes of the year.
- 0:10We cover many small topics on Python Bytes.
- 0:13It's the whole theme of the show, as you may know.
- 0:16But the headline of this one is, AI goes on trial for writing code.
- 0:20Thank you for listening to Talk Python To Me in 2022, and have a great holiday break.
- 0:25The opportunity for me to do this work, and have you all appreciate it and support it, is humbling and truly an honor.
- 0:30Thank you, and I'll see you next week.
- 0:33Here's that episode.
- 0:34Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
- 0:39This is episode 312, recorded November 29th, 2022.
- 0:44I'm Michael Kennedy.
- 0:46And I'm Brian Okken.
- 0:47Brian, we've got a lot to cover today. You want to just jump right into it?
- 0:49What I want to talk about is Simon Willison.
- 0:52This is incredible.
- 0:54So Simon did a talk at DjangoCon 2022, and then he wrote up the slides and everything, and we're going to link to his blog.
- 1:03His blog title is Coping Strategies for the Serial Project Hoarder.
- 1:08And then the talk title was Massively Increase Your Productivity on Personal Projects with Comprehensive Documentation and Automated Tests.
- 1:17Yes, that's a mouthful.
- 1:18But really, I don't know what a good name for this is, other than everybody that works with development needs to watch this talk, because it's incredible.
- 1:28So he goes through a lot of stuff.
- 1:31I'm going to go through it.
- 1:32I'm going to luckily, he's got screenshots on here, but he starts out.
- 1:37So this is important not just for open source projects or personal projects.
- 1:42This is also for if you're working in a company.
- 1:45I think this is equally true.
- 1:47So he talks about how he got these techniques from working at, now I'm going to forget where he worked, but it's gone.
- 1:57A large company with multiple continents, and it was helpful to do this model.
- 2:04So what is he talking about?
- 2:05So one of the things he talks about is the perfect commit.
- 2:10So we don't really, as a professional software developer, you're not really doing new code all the time.
- 2:17What you're doing is maintaining existing software.
- 2:20So the commit is your unit of work, and a perfect commit includes the implementation of whatever you've done, but it also has tests and documentation and a link to the issue thread.
- 2:34And this is, it seems like a lot to me, but walking through his talk, it totally makes sense.
- 2:39So he gives an example of one of his with some cool highlights that he's got documentation changes also.
- 2:48And the documentation might just be a single line change or something.
- 2:53But the tests, he does pause here and say tests are hard for some people, for some developers.
- 2:59So it's important to get a working test framework in place quickly so that a test developer isn't starting from scratch.
- 3:09They're just, or a software developer when they're writing tests.
- 3:11It's just, it's not like comprehensive testing has to be there, but it is a test that passes when your change is there and fails when it's not there or fails when it's not working.
- 3:24That's enough.
- 3:25You can do more thoroughly test, thorough testing, but that's enough to get us started.
- 3:30And I think that's a good way to think about it.
- 3:32But he goes, talks about, has, he throws in this little cool thing of like, just keep common types of projects that you're, you have around as cookie cutters in your own, in your own GitHub area.
- 3:44He's got a Python library and a click app and dataset plugin for him.
- 3:48I might have different things like a pytest plugin or something.
- 3:51And that way you can just keep up with your best practices, what you think of as best practices in one place.
- 3:58This is a cool idea.
- 3:59I'm totally going to steal this.
- 4:01And then for myself as well, I've built like a, this predated cookie cutter, but I built this thing.
- 4:07Like I always want to have logging and I want it like this.
- 4:10I always want to, you know, connect to this other service and like ping and to make sure that the thing is alive or whatever, whatever thing we decided for monitoring inside of our, the company I worked at.
- 4:19And like all the new projects would just start that way.
- 4:22And it was so nice because you didn't like, ah, is it really worth doing the thing to make sure that we can monitor it at some time?
- 4:27Like you just run the one command line thing and it's, it's there.
- 4:30Right. We could give it to an intern and they could run it to start their projects.
- 4:33It was great.
- 4:34And then he's got like this thing that supposedly with a GitHub hook, and I'm going to have to dig into this more because I didn't quite understand how this works, but he's got a way within the GitHub interface to say, I want a new project.
- 4:46And it automatically like gives you the choices or what kind of project and then fills out all the defaults from the start instead of just getting the read me like normally.
- 4:55So this is kind of neat.
- 4:57And I guess I want to try figuring this out.
- 4:59The documentation bit, at least one of the things about including this, even if it's difficult, you can have this be part of the code review requirements.
- 5:09So don't, don't accept a code review until the documentation is there also.
- 5:13So this is a cool idea.
- 5:15And then it's the bonus trick of testing documentation, which is a cool idea.
- 5:22And then the links to the issue.
- 5:24And I thought this was just sort of a, yes, you should do this.
- 5:27But this is really the meat of the talk is him doing his entire thought process in the issue thread.
- 5:34And he even gives examples where there's sometimes like up to 50, 60 comments.
- 5:40And it's just him talking to himself.
- 5:42But this is brilliant.
- 5:44And I'm not going to convince you as much as he is, but includes screenshots and dead ends.
- 5:49Like I tried this thing and it didn't work.
- 5:51And we're going to go back and do this other thing.
- 5:53This is an, he calls it temporal documentation.
- 5:57And I just love this idea.
- 5:58And I'm going to try to follow this myself because I have like a memory issue.
- 6:03I write stuff down and I, then I forget where I wrote it down.
- 6:06And this is where, this way he says, you don't have to remember anything.
- 6:11You just dump it there.
- 6:13And that way, let's say you, you get pulled off of a project and, and you don't get back to it for like six months.
- 6:20Cause you've been fighting fires and doing other stuff.
- 6:22And then you get back to it.
- 6:24You won't remember where you're at.
- 6:25And with this, this, this line of thinking of keeping all of your thinking in the issue thread, you can just jump in and go, oh, that's where I was and get started pretty quickly.
- 6:35I love this.
- 6:36It's cool.
- 6:36So then the rest of the talk is pretty interesting to talking about how like, you know, scientists been doing this and other engineers have been doing this for a long time.
- 6:46They called them lab notebooks before.
- 6:47And we kind of got out of the habit of doing that with software.
- 6:50But anyway, lots of great techniques.
- 6:52And I think this is just how to be a professional software developer.
- 6:55Now.
- 6:56I love that.
- 6:57It's like a casual conversation and not like, here are my four recommendations, but like the playing around and the dead ends are really, really valuable.
- 7:04Yeah.
- 7:05Kim out in the audience says the cookie cutter approach also works beautifully from a DevOps perspective for setting up developers to use your firm specific infrastructure.
- 7:13Yeah, I totally agree.
- 7:14And that's a little bit of what I was hinting at of like, here's how we integrate with this, like uptime manager and stuff.
- 7:19But obviously DevOps that was talk.
- 7:21We were deploying to a server in a closet there, which I mean, that tells you all you need to know.
- 7:27Yeah.
- 7:28Speaking of stuff you might need to know, Brian, Google Copilot and these code writing AIs, I have more to say about that at the very end of the show, book in this a little bit.
- 7:37They train themselves on lots of code and Google Copilot.
- 7:42For those of you who don't know, you basically can give it a comment and like, I want to connect to a Postgres database with SQLAlchemy.
- 7:50And then boom, it'll like literally write all the code, import the usings, you know, come up with a connection string, all that kind of stuff.
- 7:57It's pretty fantastic.
- 7:58Has some privacy issues.
- 8:00I don't know what it's doing now.
- 8:02It used to send your source code that you wrote up to GitHub, which made me not want to use it already.
- 8:09But the big news here is get the website, GitHub Copilot litigation.com.
- 8:17And that's as ominous as it sounds.
- 8:20It says we filed.
- 8:22This is what the website sort of announces.
- 8:25We fought a lawsuit challenging GitHub Copilot, an AI product that relies on unprecedented open source software piracy.
- 8:32Why piracy?
- 8:33Because it's trained on things that are like GPL and Creative Commons share alike or attribution.
- 8:39And then it outputs code based on that original input that has no GPL and it has no, you know, whatever license, right?
- 8:46The license is stripped and no attribution.
- 8:49What do you think?
- 8:49Something we talked about from the very beginning of like, how is this okay?
- 8:54Yeah.
- 8:54Not sure.
- 8:55Absolutely.
- 8:56If it did things like we're only going to look at MIT licenses and other commercial open no attribution licenses, I don't think there'd be anything to say about it.
- 9:06But apparently that's not the case.
- 9:08So there's a couple of updates as well.
- 9:11I suppose we should also, like they do on this page, say we are not a lawyer.
- 9:15Please don't take legal advice from us.
- 9:17We write code, not legal documents.
- 9:20But nonetheless, it says this is Matthew Butterick.
- 9:24And they've set up to investigate Google Copilot.
- 9:29And they filed a class action lawsuit in the U.S. federal court in San Francisco on behalf of a couple folks.
- 9:35So they're challenging the legality of GitHub Copilot and a related product, OpenAI Codex, which powers Copilot.
- 9:44The suit has been filed against a set of defendants that includes GitHub, Microsoft, and OpenAI.
- 9:49Wow.
- 9:50There's an update down here somewhere.
- 9:53Let's see.
- 9:54It says by training, here's the motivation for their lawsuit.
- 9:58By training their AI systems on public GitHub repositories, though based on their public statements, possibly much more,
- 10:05we contend that the defendants have violated the legal rights of a vast number of creators who posted code or other work under certain open source licenses on GitHub,
- 10:14which licenses a set of 11 popular open source licenses that all require attribution, the author's name, and copyright,
- 10:20including, I guess, the MIT license as well, the GPL, and the Apache license.
- 10:24And it's listed out there.
- 10:26There's a whole bunch more details, and it says, update, November 10th.
- 10:29That original was November 3rd.
- 10:33There's an update here.
- 10:34This is, we filed a second class action lawsuit on behalf of two additional plaintiffs.
- 10:39The defendants and claimants are otherwise similar to the initial one.
- 10:42So there you go.
- 10:44It's going to be interesting.
- 10:45It's not going to be just interesting for Google, for Google, GitHub, Copilot, but basically AI in general, right?
- 10:52It says it's going to challenge that AI strips the ownership and other requirements of inputs and outputs, right?
- 11:02And maybe it does, maybe it doesn't.
- 11:04I mean, we heard that APIs are not copyrightable in the Google Oracle Java lawsuit.
- 11:09So we're going to find out here.
- 11:10Oh, interesting.
- 11:12Yeah.
- 11:12I mean, like, when we looked into this a little bit earlier, if it's helping you fill in parameters to a function or what likely things you're going to fill in for a function call, that's one thing.
- 11:25But when it plops down like 20 lines of code for you, where did it get those 20 lines of code?
- 11:31And then, I mean, open source doesn't necessarily mean you can copy it.
- 11:35It's just open to read.
- 11:37I mean, you can put your own license in there.
- 11:40You can make up your own license that says anybody can read this, but you can't copy it, use it, or do anything else with it at all.
- 11:47Can't even fork it.
- 11:48And there's nothing stopping you from doing that sort of a license.
- 11:53Right.
- 11:54Or the default, if you put it on GitHub, I believe if you put no license means you have no license, you're conferring no license whatsoever, right?
- 12:01Yeah.
- 12:01It means it's just like writing a book.
- 12:04You can't, when you write a book, you have the full copyright unless you give it to somebody else.
- 12:10Yeah, absolutely.
- 12:11This portion of Talk Python To Me is brought to you by Sentry.
- 12:16How would you like to remove a little stress from your life?
- 12:18Do you worry that users may be encountering errors, slowdowns, or crashes with your app right now?
- 12:24Would you even know it until they sent you that support email?
- 12:28How much better would it be to have the error or performance details immediately sent to you,
- 12:32including the call stack and values of local variables and the active user recorded in the report?
- 12:38With Sentry, this is not only possible, it's simple.
- 12:41In fact, we use Sentry on all the Talk Python web properties.
- 12:45We've actually fixed a bug triggered by a user and had the upgrade ready to roll out as we got the support email.
- 12:51That was a great email to write back.
- 12:53Hey, we already saw your error and have already rolled out the fix.
- 12:57Imagine their surprise.
- 12:58Surprise and delight your users.
- 13:00Create your Sentry account at talkpython.fm/sentry.
- 13:05And if you sign up with the code talkpython, all one word, it's good for two free months of Sentry's business plan,
- 13:12which will give you up to 20 times as many monthly events as well as other features.
- 13:16Create better software, delight your users, and support the podcast.
- 13:21Visit talkpython.fm/sentry and use the coupon code talkpython.
- 13:27All right.
- 13:27Over to you, Brian.
- 13:28What's the next one?
- 13:28So this is a silly thing, but sometimes I've got Python code that I want to have a pop-up, a window pop-up.
- 13:40And I've always been using, what is it, PySimple GUI?
- 13:45Well, not always, but that's what I've been using lately for like really easy, just a simple pop-up thing,
- 13:51especially if I needed to use RunOnMax and really anywhere, because it's like totally fast to get it done,
- 13:57and I don't have to think about it anymore.
- 13:59However, PySimple GUI doesn't, I don't, I haven't mastered the art of getting it to look just like a native dialog box.
- 14:07It's, and maybe there's some tricks that you can do that I just don't know.
- 14:11But if I'm on, if I know it's on Windows, maybe we could just go ahead and use the Windows DLLs and do a native Windows dialog box.
- 14:21Right, just call straight into the Windows Win32 API for.
- 14:25Yeah, sure.
- 14:26Like that could be, that shouldn't be too hard, right?
- 14:29No.
- 14:30It sounds scary to me, but I ran across Matt Callahan's blog.
- 14:35Matt Callahan has an article called Display a Message Box in Python Without Using a Non-Standard Library or Other Dependency.
- 14:44Actually, you can just do this.
- 14:46You don't have to install anything.
- 14:48And I got this.
- 14:49I want to, where did I get this from?
- 14:52Give credit where credit is due.
- 14:54I got this from the PyQuarters Weekly newsletter.
- 14:56So thanks, thanks to them.
- 14:58Anyway, this is not hard.
- 15:01So he has a little pop-up example.
- 15:03And I should have read the article, but I just skimmed for the code.
- 15:06Here's some code.
- 15:08That's it.
- 15:09This makes a dialog box pop up.
- 15:12And it's calling the, so it calls, it's just like a couple flags.
- 15:16It's like 10 lines of code.
- 15:17It calls ctypes, winDLL, user32, messagebox, exw, whatever that means.
- 15:25And with some stuff in it, like a title and a message and everything.
- 15:29So it's using ctypes, which I don't use much, but you can to get into DLLs.
- 15:35So ctypes is built into Python.
- 15:38And so this message box, I wanted to play with it a little bit more.
- 15:41So as I was playing with this, looked into the Microsoft documentation, the message box
- 15:49dialog, there's a, one of the flags is this U type.
- 15:52And it's like this hex value thing or a bit field.
- 15:55And you can orient a whole bunch of stuff.
- 15:57So you can use this to get like an OK box or an OK cancel box, different types of dialog
- 16:03boxes using this flag.
- 16:05And then once you've got this popped up, how do you, you need to know like what users
- 16:10clicked on and stuff.
- 16:11So there's, there's return values from this and you can just like check the return value
- 16:16and it's defined to be like, you know, a three for abort and a two for cancel and one for OK.
- 16:23And you can just check this value.
- 16:25So with just a little bit of code, you can have a native dialog box pop up if you need to in
- 16:30your code.
- 16:31Yeah, that's awesome.
- 16:32And it does things like natively that you would expect.
- 16:35Like, for example, you hit escape and you have an OK cancel.
- 16:38It'll return cancel.
- 16:39I hate some of these, these like UI things.
- 16:41They show up and you're like, well, it's got one text input and a submit button.
- 16:45You hit enter.
- 16:45It does nothing.
- 16:46You're like, yeah, great.
- 16:46OK, apparently this is not real.
- 16:49I'm going to have to just, you know, go click it or whatever.
- 16:51Right.
- 16:52So hooking into the native OS is sweet like that.
- 16:54This looks like a thing that would be ripe for a short, simple little package that wraps
- 17:00up, say, all the OK cancel.
- 17:02Yeah.
- 17:03OK cancel.
- 17:04What kind of icon you want?
- 17:06Do you want like a warning?
- 17:07Do you want an informational icon?
- 17:08The buttons?
- 17:09Yeah.
- 17:10Yeah.
- 17:10It seems really great.
- 17:11But this is fantastic.
- 17:12So neat.
- 17:14And built in.
- 17:15Neat.
- 17:16So anyway, just a quickie.
- 17:17Yeah.
- 17:18It comes included.
- 17:18And yeah, I really like it.
- 17:20And it's also a bit of a roadmap to show what you could do beyond that.
- 17:24Right.
- 17:24There's more than just really simple dialog boxes.
- 17:26For example, like the open file dialog box on Windows could probably be real similar.
- 17:30Right.
- 17:30Oh, yeah.
- 17:31Probably.
- 17:32So when I was looking it up, there's a whole bunch of dialog boxes you got access to.
- 17:36So.
- 17:37Yeah, exactly.
- 17:38It's like a roadmap to like, oh, I can like create a file or, you know, any of these things,
- 17:42which I think is pretty cool.
- 17:43All right.
- 17:44Let's flip away from OS specific to OS general.
- 17:48Let's stick with PyCoders for a minute.
- 17:49So this one also comes from PyCoders.
- 17:51I don't know if it's the same issue or not, but very cool.
- 17:54It says write Chrome extensions, which also mean like Brave and Vivaldi and others.
- 17:59Edge, maybe.
- 18:00Write Chrome extensions in Python.
- 18:03Oh.
- 18:04How does it work?
- 18:06PyScript, of course.
- 18:08So, yeah, we just take PyScript.
- 18:12And this is an article by Pete Fiston.
- 18:15And it sort of walks through how he was able to use PyScript, which is Python on WebAssembly running in the browser, to use that to power a Chrome extension.
- 18:26And it doesn't really matter if it's a bit of a nine meg download because you install it once and it's local on your computer.
- 18:32Right.
- 18:32So if you want to do this, it walks you through all the things you got to do in order to use PyScript to write Chrome extensions or Python to write Chrome extensions.
- 18:40What do you think?
- 18:41Cool.
- 18:41Even shows you how to put an icon.
- 18:42That's pretty cool.
- 18:43Yeah.
- 18:45But I have more for you.
- 18:46So just so in case people don't know, this is an extra, extra, extra hear all about it section because I want to hit a whole bunch of things.
- 18:52So as of recently, just published this episode.
- 18:56Let me look.
- 18:5630, 31 minutes ago.
- 19:00And it says PyScript powered by MicroPython.
- 19:02So one of the challenges that PyScript has had traditionally is it's based on the full, nearly the full CPython runtime compiled into WebAssembly, which after you strip a bunch out, that doesn't work in the browser.
- 19:14It comes down to like nine megabytes.
- 19:16Okay.
- 19:17It's for like this browser extension thing.
- 19:19That's reasonable.
- 19:20But for you would never use in place of like Vue.js on a popular page because you want that page to load quickly.
- 19:27You want it to be good for SEO, all those things.
- 19:29But you know what's small and fast?
- 19:32MicroPython.
- 19:33Oh, neat.
- 19:33So I just had Brett Cannon, Nicholas Tolerwey, and Fabio Flieger on Talk Python to talk about the work that they're doing to make PyScript not run on full CPython, but to run on MicroPython.
- 19:48Oh, wow.
- 19:49And MicroPython, you can get that to load up in 100 milliseconds on your page.
- 19:52And it's only a couple hundred K.
- 19:54All of a sudden, that starts to sound a lot like a pretty rich front-end framework level of stuff you got to download and get started.
- 20:01And you cache it, then you're good to go.
- 20:03That's exciting, huh?
- 20:04That's super exciting.
- 20:05Yeah.
- 20:06Yeah.
- 20:06So this Chrome extension thing is cool.
- 20:08when you look at the shipping version.
- 20:10I don't know if you can call it shipping because the price grip is still like super alpha.
- 20:14But what you can get today.
- 20:16So Nicholas said probably spring that they'll have something to share, but in terms of being able to use MicroPython.
- 20:24But I think that's pretty excellent.
- 20:26That could really, really unlock some super cool features.
- 20:29If now we could build like a Vue.js type thing, but with Python.
- 20:33And one of the goals that they stated is that they're looking to build this as a framework or, excuse me, a platform that you can build frameworks on top of.
- 20:43So it's not just here's how you write some Python code in the browser, but here's a foundation that people could create like a PyView or a PyAngular or, you know, whatever they wanted to create.
- 20:52Right.
- 20:52Yeah.
- 20:53So question, question just for my own personal use is, is, is would Chrome extensions work on Vivaldi?
- 21:01Yeah, yeah, they do.
- 21:02Okay.
- 21:03One of the things that's interesting about Vivaldi, and I think it probably affects its reporting a little bit.
- 21:08When you look at the user agent of Vivaldi, it's exactly the user agent of Chrome.
- 21:13So it lies to the world and tells the world it's Chrome.
- 21:16There's no user agent for Vivaldi.
- 21:18It's just whatever version of Chrome it's, it's like using, you know?
- 21:22Okay.
- 21:22So when you go to the Chrome web store, it's like put this in Chrome, you click it and yeah, it goes.
- 21:26So it worked perfectly.
- 21:27Sure.
- 21:27Cool.
- 21:27Yes.
- 21:28And John Sheehan says, yes, they do.
- 21:30All right.
- 21:30Next extra, extra, extra.
- 21:31Brian, I've been excited a little bit about Mastodon.
- 21:35I don't know if you noticed.
- 21:35Yeah, me too.
- 21:37I know.
- 21:37It's fantastic.
- 21:38It's really tons of great interactions.
- 21:39And I started putting in our show notes, which you'll see when I publish this, your Mastodon account and mine.
- 21:46So people can connect with us and have even more conversations over there.
- 21:50But there was a really interesting article by Eugene, the guy who created Mastodon.
- 21:56I've been looking and looking.
- 21:58It's about scaling Mastodon and the challenges they were having.
- 22:01And boy, it's I would love to link to it, but I just can't find it.
- 22:05But it's so it's written in Ruby.
- 22:08Right.
- 22:09And so it talks so much about these are the challenges of scaling out threads.
- 22:14And, oh, we have this thing called a GIL.
- 22:16And it really doesn't allow you to use threads very easily.
- 22:19And here's there's just it was so interesting to look at how a technology that doesn't have asyncio and async and await getting all tangled up trying to do IO based things.
- 22:32So it's like, well, can we have maybe we should have 10 to 20 threads to do the network communication.
- 22:38But if we have more than 20, then we get like a context switching and contention in the operating system, you know, that just comes with having OS threads.
- 22:47Well, guess what?
- 22:47You can do really well with no threads or one thread.
- 22:51You can talk to web.
- 22:52You can call other websites.
- 22:53You can receive web requests.
- 22:55And the mechanism for doing that in Python is async and await.
- 22:59And asyncio requires no additional threads.
- 23:02Very, very little overhead.
- 23:03No contact switching.
- 23:04So this project by Andrew.
- 23:10I'm sorry if I am not getting Andrew Godwin.
- 23:13Sorry for last name for a moment of Django channel said, what if I rewrote this?
- 23:20But in Python with an async and await.
- 23:22OK, so there's a bunch of challenges.
- 23:25Challenges of running Mastodon.
- 23:26People want to have their own server because they're like, oh, I want my own server.
- 23:29So I'm not stuck in one of these communities.
- 23:31And as beholden to them, the problem is every one of those is like a standalone DevOps adventure.
- 23:37There's tons of like things working together.
- 23:39And it's it's a lot of work.
- 23:41Right.
- 23:41It'd be better if you put like host more of them on one machine and sort of scale scale that up in a nice way.
- 23:49So this one lets you host multiple domains for small to medium instances.
- 23:53And it's written with async and await, which is pretty awesome.
- 23:57So, yeah.
- 23:58Anyway, I don't know.
- 24:00Check this out.
- 24:00I didn't know if you if I caught you trying to pronounce it.
- 24:04Takahe?
- 24:04Takahe?
- 24:05I don't know.
- 24:06I'm going to go with that.
- 24:07But and of course, Andrew Godwin just said, you know, I can probably write this in Python and like get it out in a couple of weeks.
- 24:15I think it was like five days or something.
- 24:17So key features, multiple domain support, multiple identities per user, which is kind of interesting.
- 24:24Desktop mobile PWA compatible.
- 24:27Again, how many days and easy deployment, a web worker, a background worker and one database.
- 24:32Not all this crazy, crazy stuff.
- 24:35So anyway, people can check it out.
- 24:37Let's check out the requirements.
- 24:39See what we got going on here.
- 24:41uvicorn for an HTTPX.
- 24:44I mean, that pretty much pretty much says it right there.
- 24:46Oh, interesting.
- 24:47It's based on Django HTMX is pretty interesting.
- 24:52It's some of the building blocks.
- 24:53But yeah, super cool.
- 24:55So there's another one.
- 24:56This portion of Talk Python To Me is brought to you by the AWS Insiders podcast.
- 25:01When was the last time you ordered a physical server to host your functions as a service, your latest API or your most recent web app?
- 25:09I remember the last time I did.
- 25:11That was around the year 2001.
- 25:13And yes, it was quite the odyssey.
- 25:15Of course, we don't do that anymore.
- 25:18We run our code in the cloud with near instant provisioning and unparalleled data centers.
- 25:24And the most popular cloud provider is AWS.
- 25:27But for all the ways that AWS has made our lives easier, it has also opened a massive box of choices.
- 25:34Should you choose platform as a service?
- 25:36Or maybe it's still VMs with IaaS.
- 25:38What about your database?
- 25:39Maybe you should choose a managed service like RDS with Postgres.
- 25:43Or is DynamoDB better?
- 25:45Maybe Aurora?
- 25:46No, wait.
- 25:46I hear good things about Amazon DocumentDB too.
- 25:49And that's where the AWS Insider podcast comes in.
- 25:53This podcast helps technology leaders stay ahead of Amazon's constant pace of change and innovation.
- 25:58Some relevant recent episodes include Storage Wars Database Edition, Microservices or Macro Disaster, and Exploring Computer Vision at the Edge with AWS Panorama.
- 26:10They bring on guests to debate the options and the episodes are vibrant and fun.
- 26:15So if you want to have fun and make sense of AWS, head on over to talkpython.fm/AWS Insiders.
- 26:22Yes, I know you probably already have a podcast player and you can just search for it there.
- 26:26But please use the link so that they know you came from us.
- 26:30Thank you to the AWS Insider podcast for keeping this podcast going strong.
- 26:36We just had our Black Friday sale over at Talk Python.
- 26:39Cool.
- 26:40And that was really excellent.
- 26:41Sold a bunch of courses.
- 26:42We sold some pytest courses, by the way.
- 26:44Yeah.
- 26:45I'm just excited because sometimes we have these sort of conversations about you've like cool sales and stuff.
- 26:51And I'm glad that I get to be a part of that now.
- 26:53We've done other fun things where like we couldn't sell your book through them because it's through the publisher.
- 26:59And I guess it gets tricky, right?
- 27:01So I'm really excited as well.
- 27:02So we did our Black Friday sale.
- 27:04And guess what?
- 27:05I noticed something a little bit unusual.
- 27:07So after a little bit, I opened up Glances on the main web server and said, CPU usage is 85%.
- 27:14I'm like, oh, that's not so good.
- 27:1588, 91, 92.
- 27:17Uh-oh.
- 27:17But what was super interesting was Nginx, not Python, was the thing getting hammered.
- 27:24So both Nginx workers were like almost 100%.
- 27:27And Python was just chilling.
- 27:28I'm like, okay, that is a really interesting story for Python performance that something amazing like Nginx that people say is fast all the time is the bottleneck.
- 27:38And it turned out it survived, but just barely, right?
- 27:41If it were like twice as bad, it would have keeled over, which had been bad.
- 27:45So I talked to a bunch of people about this, and I realized that there's one HTTP response.
- 27:50I've got to spell that better.
- 27:51And 12 CSS files, 43 images, and one JavaScript file on the page I was sending them.
- 27:57So I'm like, all right, maybe I should try to use some interesting CDN, which I had got a recommendation from one of our listeners, but otherwise hadn't heard about.
- 28:05What a cool service.
- 28:07So now we have 112 different locations serving up those static files.
- 28:13Nice.
- 28:13And just processing.
- 28:14So I went back today when we did our Cyber Monday, and I said, when I, that was yesterday, when I pushed out the announcement for Cyber Monday closing, and I pulled up the real-time data, look at that traffic.
- 28:27That's CSS and JavaScript and images.
- 28:291.4 gigabytes a second.
- 28:31Oh, my gosh.
- 28:32It's insane, dude.
- 28:34And check this out on the server.
- 28:36This is the most important part.
- 28:373% CPU usage on NGINX.
- 28:39And across the whole computer, across all of the MicroWISGY processes, just a couple more percent.
- 28:45CDN to the rescue.
- 28:47Exactly.
- 28:48But the thing that's also interesting is that Python is just like, yeah, it was nothing.
- 28:51Like, we can take that, but it's all those static files.
- 28:54So anyway, I put that right up together for people in order to serve out that data, pay $2, right, for 0.35 terabytes.
- 29:05And, by the way, it's going right now.
- 29:07Oh, it's got to refresh here.
- 29:09They have these cool real-time maps and whatnot.
- 29:12But that little spike right there is when I released the Talk Python episode.
- 29:16And that's about 4.5 terabytes per second, which is just insane.
- 29:21So anyway, I totally recommend people check this out.
- 29:24It's super fun.
- 29:25You're reaching people all over the world.
- 29:26That's pretty cool.
- 29:27Yeah.
- 29:28Isn't that amazing?
- 29:28You get all these different locations.
- 29:30I think it lost its web socket connection because it stopped updating.
- 29:36It's like there's a little warning.
- 29:38This live monitor is like a little bit of a suggestion of how things might be.
- 29:43But, yeah, anyway.
- 29:44Yeah, what's up with the Alaska people not listening?
- 29:46Hey, Alaska.
- 29:47Yeah, man.
- 29:47Come on.
- 29:48Yeah, they're going to have to CDN over to Canada anyway.
- 29:52So not that.
- 29:54This final one here.
- 29:56No, not final one.
- 29:57The second final one that read all about it or hear all about it.
- 30:00Reader 5, I've actually been really getting back into RSS.
- 30:04I've never left.
- 30:06Yeah.
- 30:06What's your RSS story these days?
- 30:08No, I use Feedly on my phone just to keep up on stuff.
- 30:13Nice.
- 30:14I'd switch to things like Zite, which is sadly gone, and Flipboard, and these sort of Apple
- 30:21News-like things where they kind of curate a bunch of different sources.
- 30:24I'm like, you know what?
- 30:25There's a bunch of great places I would really like to just directly get them from and curate
- 30:30a little more than just I suggest more Python.
- 30:32Because do you know how many times my Python channel in Flipboard has women scared of Python
- 30:39that comes out of the toilet?
- 30:40Like, you know, no, not that Python.
- 30:42Really not.
- 30:43Oh, no, no.
- 30:44And so I've just been super loving.
- 30:46I've been using Reader 5 with two E's.
- 30:50What a nice piece of software this thing is for $10.
- 30:53Okay.
- 30:55Really, really cool.
- 30:55Yeah, so.
- 30:56I'll check it out.
- 30:57Yeah.
- 30:57And another thing I would like, if people have awesome recommendations for blogs, especially
- 31:03Python blogs that I should be following or people, listeners should be following, put
- 31:08that on the YouTube channel comments or send it to us on Mastodon or Twitter.
- 31:12And maybe I'll give a shout out to ones that are extra good.
- 31:15But very, very cool.
- 31:16Let's see.
- 31:17Check this out.
- 31:19There's a podcast called Sing for Science.
- 31:22And on season three, episode eight, which just came out six days ago, Rivers Cuomo of Weezer
- 31:28and Guido Van Rossum sit down for a conversation.
- 31:31How cool is that?
- 31:32That's pretty cool.
- 31:33That's really cool.
- 31:34So.
- 31:35Have you listened to it?
- 31:35Yeah, I listened to it.
- 31:36I grabbed some, grabbed my phone and my dog and went for a walk and listened to it because
- 31:41the sun came out and that was rare right now.
- 31:43So yeah, it's really interesting.
- 31:45Neat.
- 31:46It's a lot of the host talking to Rivers and talking to Guido and a little bit of interaction.
- 31:52I would love a little more facilitation of them to talking directly, but both great people.
- 31:56Rivers is awesome.
- 31:58He does really cool stuff with Python.
- 31:59I had him on Talk Python 327, little automation tools.
- 32:04Which was fun.
- 32:05So yeah, he's a, he's a legit developer these days, which is, that's pretty neat.
- 32:09All right.
- 32:10Final thing, Brian.
- 32:11Final extra, extra, extra.
- 32:12We started with, I started at least my segment with AI coding and I'm going to end it with
- 32:18AI coding kite.
- 32:19Do you remember kite?
- 32:20It was like the original GitHub copilot.
- 32:22Yeah.
- 32:23Yeah.
- 32:24Unfortunately, they are shutting down.
- 32:26So they've been around for 10 years or so.
- 32:30Not quite.
- 32:30Seven years, something like that.
- 32:32Quite a while, but they're shutting down.
- 32:34So thanks for all the code, I suppose.
- 32:37And that's it.
- 32:38That's all I got for all my extras.
- 32:40I want to add one.
- 32:42So we talked to Simon Willison, talked to one of the, one thing I didn't mention about
- 32:48in his talk is he encouraged people to write blogs because there's not that, that blogs
- 32:53were huge for a while and then everybody was doing it and now not so much.
- 32:57And so you do get noticed more if you're writing a blog.
- 33:01I think that that's a good thing.
- 33:03Plus you can link, we can link to it easier if you've, if you got your article on a blog.
- 33:07But also, and RSS wise, Planet Python is something I still check out.
- 33:13So planetpython.org, if you haven't heard of it, it has, you can either have the full
- 33:18content so you can read and it pulls all of this through RSS from, from different blogs.
- 33:23And so if you have, and titles only, if you have a, a Python blog or you're starting one,
- 33:30check out Python, planetpython.org and try to get your name on the list.
- 33:35Maybe put out like three or four articles first and then, and then try to get your name
- 33:39on the list or your blog on the list.
- 33:41And that way it gets seen by people like us, even if you don't notify us.
- 33:45So yeah, that's, that's excellent.
- 33:47I didn't subscribe to that because I feel like it's a little bit too much of everything, but
- 33:52I went through all the recent posts and said, this writer looks interesting or this source
- 33:56looks interesting and like subscribe directly.
- 33:58So I kind of used it to, to start my exploration of those things I wanted to subscribe to.
- 34:02Yeah.
- 34:02Not a bad idea.
- 34:03And you know, they have RSS feeds cause they're, they're in here.
- 34:06Exactly.
- 34:07I, since you brought it up, I just want to also point out like one of my roadblocks of writing
- 34:12a lot was, well, I don't have time to write like an article, something well thought out
- 34:16and you know, a thousand words and that, you know what?
- 34:19My, my new philosophy has been, let's just write like really short posts.
- 34:24Like here's one about a fun thing I did with spammers and it's like three paragraphs or here's
- 34:29one about installing something as a PWA.
- 34:31It's two pictures and four paragraphs.
- 34:33And you don't, you don't have to write essay like long essays to contribute interesting things
- 34:39and ideas.
- 34:40I think so.
- 34:40I just following up on that.
- 34:41Yeah.
- 34:42My, my thoughts are if it's going to be a thread, make it a post instead.
- 34:46Yeah, exactly.
- 34:47Exactly.
- 34:48All right.
- 34:49Well, my jokes have vanished.
- 34:52I had a cool joke on social media and it got taken down.
- 34:55It was, it was, it was really funny.
- 34:58It was totally benign.
- 34:58I don't know why it's gone, but whatever.
- 35:00And then by the way, following up on this, Jeremy Page says you can also RSS Mastodon users.
- 35:06Okay.
- 35:07That's, that's funny.
- 35:08And Mastodon hashtags as well.
- 35:12You can RSS those.
- 35:13Okay.
- 35:14Yeah.
- 35:14I follow the Python hashtag over there.
- 35:16I could RSS it, I suppose.
- 35:17Excellent.
- 35:18All right.
- 35:18Brian.
- 35:19So do you have a joke for us?
- 35:21Yeah.
- 35:21So speaking of Mastodon on Mastodon, I said, I'm getting, I'm getting a lot of great
- 35:25Python content on Mastodon, but I need some joke people to like, I need some nerd jokes.
- 35:31So I'm asking for people.
- 35:33And this, somebody didn't ask, tell me a person to follow.
- 35:37I'm still looking for people to follow with good jokes.
- 35:39So if you send them my way, if I, or send me their way, if, if you know of people, but here's
- 35:45one that I got from somebody on Mastodon.
- 35:47So I got it from, who did I get this from?
- 35:50I should probably give credit.
- 35:52So this came from Steven Box.
- 35:54Nice.
- 35:55Thanks, Steven.
- 35:56So exit condition from monkeyuser.com.
- 35:59So it took me a while to get this.
- 36:03So there's a couple of people sitting at a desk, paraprogramming, I'm guessing, and then
- 36:10somebody else is frustrated.
- 36:11They hear, wait.
- 36:12And he says, the frustrated guy says, that's it.
- 36:15And, and, and he starts going towards a door that's labeled recursion.
- 36:20And somebody says, wait, there's no, I'm going in.
- 36:23He goes in and he gets into the other side and says, wait, he's the person trying to say
- 36:30wait.
- 36:31Oh my gosh.
- 36:32There's no exit condition.
- 36:34So that's a dumb joke, but it's really good.
- 36:38And it's got some clever, the cartoon is clever where like the speech of the other
- 36:44one is off screen.
- 36:45So it kind of looks like it comes from the original group, but in fact is coming from the
- 36:48recursion of the first one.
- 36:50And yeah, it's, yeah.
- 36:51Okay.
- 36:52Well, one more.
- 36:53somebody said, you, I should follow, Olafur.
- 36:57Why?
- 36:57Anyways.
- 37:00I just thought this was dumb and funny.
- 37:02Bobby pin.
- 37:03No, I go by my full name, Robert Pindle.
- 37:06And it reminded me of the Bobby tables thing.
- 37:10So yeah, that's exactly.
- 37:11I love it.
- 37:12All right.
- 37:12Well, thank you everyone for listening and Brian, thanks for being here.
- 37:16Thank you.
- 37:16Yeah.
- 37:17Bye everyone.
- 37:18Bye.
- 37:19Bye.
- 37:20I hope you all enjoyed this crossover Python bytes episode.
- 37:23If you did, please consider subscribing to Python bytes.
- 37:25If you don't already do so.
- 37:27Thanks for being part of talk Python to me, have a great new year and I'll see you in 2023.