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


Transcript #200: No dog-piling please (it's episode 200!)

Return to episode page view on github
Recorded on Wednesday, Sep 16, 2020.

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

00:05 This is episode 200, I can't believe it. Recorded September 16th, 2020. I'm Brian Okken.

00:11 And I'm Michael Kennedy.

00:12 200, can you believe it?

00:13 I actually cannot believe it. That is a ton of podcasting and everyone's been super supportive

00:20 and it's been great to do 200 episodes with you. I don't think we've actually done 200 episodes

00:25 because there's a few times you couldn't make it or I couldn't make it or we did some live thing.

00:28 So probably like 195 together, but that's still a ton of podcasting together.

00:32 Yeah, yeah, it is. It's pretty exciting. I've had a blast.

00:36 Absolutely. I hope people are finding this helpful.

00:38 Oh, I think they will find it helpful. We're really good at transitions.

00:45 Because we've been doing it so long.

00:46 Yeah. To transition into the next topic. Actually, the first. Batchelder wrote a cool article. This

00:53 is great on how to be helpful online. And this is the advice that he's giving is targeted towards people

01:01 that are trying to help other people online. So if you're answering a question on Stack Overflow or

01:07 just even an email question somebody sends you or on Twitter or whatever, these are good advice.

01:13 Actually, it's a pretty long article. There's a lot of advice there. So I want to highlight a handful of them. One of them is answer the question first. There may be other problems with their code that they're not asking about. And you want to get to the point of just helping them with their answer. All the rest of the problems on their code. Actually, I think that's really good. I've seen that people violate that all the time. The second point that he brings up is no third rails. And I don't even know where that term came from. I don't. That doesn't make sense.

01:43 any sense to me. But going off the rails, I've heard of that. He gives an example of, it should

01:49 be okay for someone to ask for help with a program using sockets, for example, and not have to defend

01:55 their use of sockets, especially if the specific question has nothing to do with sockets. And he

02:01 says things like, it's not sockets, it might be pickle or threads or globals or a singleton or

02:06 something. You might have really strong opinions about some design pattern or some code

02:13 that they're using or different libraries. That's not really what they're asking about.

02:17 Don't attack them for their design choices. Just maybe answer the question instead. No dogpiling.

02:24 I think that's self-explanatory. Once somebody's already answered a question, you don't have to

02:29 answer it slightly different. If you're very different and you think you're adding to the

02:33 conversation, of course, speak up. Meet their level. This is a difficult one. Try to determine

02:40 what they know and give them a reasonable next step, not the ultimate solution. A suboptimal

02:45 solution they understand is better than a gold standard they can't make use of.

02:49 That makes a lot of sense because, you know, I think also leads to one of the other ones is

02:55 your gold standard is encased in your context and your use case and so on. It's like the,

03:03 you're not Facebook, you're not Google, you're not LinkedIn, probably. You might not need their

03:08 gold-plated solution that's perfect for that situation. Yeah. And also odds are if you're

03:13 answering questions, you're a more advanced developer than the person asking, at least in that field. So

03:19 be gentle. The last one I want to highlight is use more words. IRC and Twitter and other online

03:28 mediums encourage short responses, but short responses are the exactly the kind of thing

03:33 that can be easily to easily misinterpreted. So use more words, especially encouraging optimistic

03:40 words. I think this, and you know, also just, there's a lot of stuff people leave out, but they

03:45 would say in person, they would say, Oh, it's cool that you're trying this problem. Let's look at it this

03:52 other way and let me know if you have any other questions, but they don't put that stuff in text.

03:58 And so I think it is important to use more words and, and, be more encouraging online. And there's a

04:04 whole bunch of other stuff like humility and understanding your motivations and their motivations

04:08 and trying to, you know, build a community. So great advice from Ned. I encourage the next time that you read

04:15 a question and your mouth drops open and your eyes stare in shock, maybe read this article before answering.

04:21 Yeah. It's a nice article and a good advice. Thanks, Ned.

04:24 I don't know how to transition to magic, man.

04:28 Magic is awesome. You know what else is awesome? Black is pretty awesome, right?

04:31 Yeah, definitely.

04:32 You know what is not awesome? Crappy code written in a Jupyter notebook that has no like proper editor

04:41 support. Like I don't need black that much because I use PyCharm and I can hit command alt L and it

04:46 formats it basically like Blackwood or in VS Code, I hit command shift P and type format document and it

04:53 formats it basically like Blackwood, but in notebooks, it's just stuck there and it's like permanent

04:59 icky form. And it's like, well, how I want to make this nicer, but I don't want to take the effort of

05:05 like developing it nicely. I want the tool to just fix it for me. Right. And black is really great for

05:11 that black super popular, but Jupyter doesn't have black, but magic can add black to your Jupyter notebook.

05:19 So there's a cool package called black cell magic. And so with black cell magic, you can load this.

05:26 It's an extension for Jupyter notebooks. You just say percent load extension, black cell magic once.

05:31 And then on any cell that you want to reformat, you just say percent percent black and rerun the cell

05:38 and then it formats it.

05:39 Nice.

05:40 Nice. Yeah. And so actually you type that command at the top of the cell, you rerun it, and then it

05:46 takes that away. So it doesn't stay there basically. Yeah. So anyway, you run it once and you can even

05:52 give like little command line arguments to the formatter when you put that special magic command,

05:57 the percent percent, I think those are called magic commands in Jupyter. So percent percent black

06:03 dash L 79 for like changing the line with the 79 characters instead of 80 by default, or there's,

06:10 you can pass stuff off to black that way.

06:12 This is cool. I like it.

06:13 Yeah. Yeah. And if you want to know if you like it and it's for you, you go to the website,

06:17 go to the link I provided and it has a cool animated GIF and you can see right away.

06:21 Oh, that's cool. I want that. Or no, that's, that's weird. I don't want that.

06:24 Yeah. I was watching that while you were talking.

06:27 Yeah. It's cool. Right. So it just, it's always a problem. Like I need to format my Jupyter notebook.

06:33 Why, why is this not built in? Well, now it's kind of sort of plug in a bowl, not part of the story,

06:40 but can we go back to the whole command alt L thing?

06:42 Yeah.

06:42 That's in PyCharm. It reformats your code or something.

06:45 It does. Yeah.

06:46 Okay. I'll just check that out.

06:47 It's pretty sweet. That only works on Mac and it depends on which bindings, you know,

06:51 there's like multiple keyboard bindings. So maybe in the Vim one, there's like a different one.

06:55 But if you go and you go find the menu command for like reformat document, it'll show you what the hockey is.

07:01 And you can do better than that. You can actually right click on the project and say,

07:06 reformat the project. And it'll like traverse down into all the files and it'll reformat like everything.

07:13 So that's okay. But I don't know of a hockey for that, but you can like right click and say reformat this tree of stuff.

07:19 Yeah. But if I'm doing a tree of stuff, I'll probably use black.

07:21 Yeah, exactly. Yeah.

07:22 I never use that, but generally command alt L or control alt L probably on windows or Linux.

07:29 We'll do it. But black cell magic will add it to Jupyter. Now what's super annoying is you got to type that command every time on a cell and it does it one cell at a time.

07:42 So if you've got a hundred cells, you got a lot of percent percent black you're typing.

07:46 There is a guy named Tobin Jones who wrote a NPM package that will use this over top of it and reformat all of them.

07:57 And I linked to the repo, but then when I go to it, it looks like it's archived.

08:01 So I have no idea whether it even works still or anything. I haven't tried that one.

08:04 So people can check that out, but it would be nice if this was like leveled up to apply at least to a notebook, even if you run it on demand.

08:13 Yeah, definitely. It would be cool to be able to blackify a notebook.

08:17 Yeah. But nonetheless, this is better than what it was before. So it's pretty good.

08:21 Do you know what else is really good?

08:23 What's that?

08:23 Learning awesome Python from Talk Python training.

08:27 That is pretty awesome. Yeah. So this episode is brought to you by us again.

08:32 And if you're in the market to learn Python, we've got a ton of courses.

08:36 We're coming up on 200 hours of highly edited courses. So that's a ton of content.

08:42 And we have a special enterprise plan. So if you're looking for team training and team events that are online, digital,

08:47 you know, just shoot me a message and I'll get you info about that.

08:52 And pytest.

08:53 Yeah, definitely. If you are considering pytest or considering testing your code, please do test that.

09:01 And I would like to actually highlight, I brought up, somebody made a nice comment today.

09:06 I wanted to bring it up.

09:07 Ken Ewens Clark, this came out a couple of days ago, says he picked up my book, Python Testing with pytest and started reading it.

09:15 He was excited. And just one hour later, he posted another comment and said,

09:21 I've just finished the first chapter and I can see I've barely scratched the surface.

09:25 So I'm already learning something new in one chapter.

09:28 So that's cool.

09:29 Yeah, that's really cool. Maybe help people test smarter, not harder.

09:34 Yeah, well, actually, you know, that is the goal of the book.

09:36 But I also wanted to highlight an article by Luke Plant called Test Smarter, Not Harder.

09:43 And this is not like a huge article.

09:46 It's some nice opinion.

09:48 I like opinionated testing articles.

09:50 Good opinions there.

09:52 There's a lot of great advice, but I wanted to pull out a couple of his suggestions

09:56 because I don't think that they're talked about much.

10:00 So the first suggestion that Luke has, or the first one I'm highlighting, is write your test code with the functions or methods or classes that you wish existed,

10:09 not the ones you've been given.

10:11 So if an API you want to use doesn't exist yet, you just use it anyway, but then you have to make it exist.

10:18 So this is actually huge advice, I think.

10:21 And people don't really, I think they think about it while they're coding, that you try to write the code you want, the API you want,

10:27 and then make it if it isn't there.

10:31 But forget to do it while testing.

10:33 And while testing, it's even more beneficial, I think, because you've got to be able to read your test code really fast and understand it quickly.

10:41 The other thing I want to highlight with that is if you are responsible for the API or the API that you're testing against is something you control,

10:49 then pay attention to those tendencies to say, I really wish I had an easier API,

10:54 because that might tell you that maybe that new API should exist and maybe you should add it to your interface.

11:00 Yeah, I think this is one of the really big values of testing is that it lets you step back from the code you're writing

11:05 and look at the API or the classes or library or whatever you're building, look at that from the outside and go,

11:12 does that make sense?

11:13 Is that the best way I want to use it?

11:15 It's sort of your first chance to put it into practice as a consumer rather than a creator of it.

11:21 So if you're not the person in control of the API and you're just using a different API,

11:27 you can write a wrapper around that to just highlight the thing that's important for the test

11:34 and not have to pass in a bunch of stuff that doesn't matter to the test, but you have to pass it anyway.

11:39 I think those are great suggestions.

11:41 The next suggestion is only write necessary tests, specifically tests whose estimated value is greater than their estimated cost.

11:51 This is a judgment call, of course, but it does mean that at least some of the time you should be saying this test isn't worth it.

11:58 And now this is a controversial sort of opinion, but I go by this.

12:02 And if you have trouble convincing the people that you have to convince to skip a test,

12:08 you can just say I'm prioritizing my tests and that one's lower on the priority.

12:13 Maybe we can get to it later.

12:15 The flip side of this, that's good advice.

12:17 The flip side is that I think is not initially thought of by a lot of folks is you have to maintain your tests as your code changes.

12:24 I mean, if you've got a static API and it's just fixed and it's on PyPI, it's fine.

12:28 But if this is an application you're building, you might dramatically change the way things work.

12:33 And when you do that, you might have to rewrite your test to correspond with that, to recreate objects in some new way or whatever.

12:41 And the more maintenance burden that your tests carry, the less you're going to like writing tests and the less you're going to keep them running.

12:50 And so it's not just, is it worth the value of creating the test?

12:54 It's worth the value of creating and living with that test.

12:58 Yeah.

12:58 Test code has the same maintenance cost or more maintenance cost than production code.

13:03 Also, different parts of your workflow.

13:07 So early on in a project, you're really learning how to do the problem and you're learning about the code.

13:12 So write tests that help you with that learning.

13:15 Don't write tests that solidify the API so it's hard to change.

13:19 That's the point.

13:20 Yeah.

13:20 Write the ones that help you learn about your code while you're putting it together.

13:24 Very nice.

13:25 So this podcast is pretty awesome.

13:27 And for episode 200, I wanted to get something good, a package that's good to talk about.

13:33 It might be the greatest package of all time.

13:35 Really?

13:36 Well, it's self-proclaimed.

13:37 So a bit of a grain of salt.

13:39 It sounds really simple.

13:41 It has a crazy name and it actually is really quite useful.

13:44 So this next one is called US, as in the United States, the greatest package in the world.

13:50 That's literally the name of it.

13:51 So this goes to us.

13:54 Yeah.

13:55 So Jerry Carbaugh reached out to us and said, hey, I created this package.

13:58 I don't know.

13:59 You think it's useful or not?

14:00 I'm like, oh, okay.

14:01 It's kind of interesting.

14:01 It's a Python package on PyPI for working with states.

14:08 States, zip codes, those types of things.

14:11 And the United States.

14:12 Right?

14:13 Okay.

14:13 And it seems like this could be motivation for things like the EU or some other place where

14:21 you want to understand the geography of it.

14:22 But this is really quite involved.

14:25 So I envision like, okay, well, maybe it's got like a list of the states and it's got the

14:29 abbreviation or something.

14:30 It's got that.

14:31 It's got all the territories.

14:32 It has the postal abbreviations.

14:35 It has associated press style abbreviations, which I don't really know.

14:39 It has FIPS codes.

14:40 I have no idea what FIPS codes are, but they're like lookup codes, different kinds of lookups

14:44 you can do.

14:44 Okay.

14:44 Capitals, the year of statehood, the time zones.

14:47 You can even do phonetic name lookup.

14:50 So like if you can't spell Mississippi, but you can make Mississippi sounds with letters,

14:54 you can put that in there and it'll go and find it.

14:56 So like it basically do like lookups on misspellings, but if you get it like sounding right, it can

15:01 still find it.

15:02 So maybe you accept typed input or some text field that says the state, but then you can

15:07 do a lookup on that to get a more canonical representation, whether the state is contiguous, like Oregon,

15:15 all one thing stuck together or a very nice place like Hawaii.

15:19 That's broken into a bunch of islands where there's continental or not similar difference

15:24 there.

15:25 That's pretty cool.

15:26 If you want the geographic boundaries of them for like geospatial work, it comes with

15:32 URLs to shape files that come out of the U S census.

15:35 At least they're accurate up to 2010.

15:36 Okay.

15:37 Well, also one of the flags is, is obsolete.

15:40 I was wondering if there's obsolete states.

15:42 There are obsolete states.

15:43 Yeah.

15:44 So I think more territories are obsolete.

15:47 I don't think there's states that are obsolete, but there's territories that are, for example, like

15:51 the Philippines, I think used to be a U S territory, but it's no longer something like that.

15:56 There's a few examples in the docs.

15:58 Oh, okay.

15:59 Cool.

15:59 Yeah.

15:59 And they also have a, an environment variable to indicate whether Washington DC becomes a

16:06 state.

16:06 You can set a flag that will like trigger that to show up.

16:09 So it's like future proof a little bit.

16:11 Okay.

16:11 And it has a CLI.

16:12 So you could type states space MD for Maryland and you'll get a big, long description of information

16:19 about it.

16:19 Well, with the prefix of the great state of.

16:22 Yeah.

16:22 That's interesting.

16:23 So is this more than you expected out of it?

16:26 Like when I thought, I thought it would just be like a list of states and stuff, but like

16:30 all this lookup, all this information, this is pretty awesome.

16:32 Actually.

16:32 It's pretty in depth.

16:33 Well, no, it's pretty cool.

16:34 I just didn't, I don't know if I'd say it's the greatest package in the world.

16:38 Oh, all right.

16:39 Well, there's always a PR.

16:41 You could always a pretty good package with respect to state management in the world.

16:46 Yeah.

16:47 Yeah.

16:47 Okay.

16:47 No, actually, if you work with states, this seems super useful, regardless of whether you

16:51 agree with the name.

16:52 Yeah.

16:54 I've got kids that are at home right now.

16:58 One that's a started school, but started school like online.

17:03 So it's a, it's sort of an anticlimactic big beginning to school.

17:08 Yeah.

17:08 And we still have like some, a lot of time that they're devoting that I'm glad they're doing

17:14 this.

17:14 They're allowing teachers sometime during the, during the week to prepare for all of this,

17:18 which means they've got kids have more free time than they had before.

17:21 So one of the things I was looking for was good learning software coding related learning

17:26 activities for kids that are, have some spare time, especially early on in the school year.

17:33 I can't remember who suggested this.

17:34 Somebody on Twitter suggested this, but there's a video series that's part of Ted Ed that's

17:40 called think like a coder.

17:42 The title says it's a 10 episode series that will challenge viewers with programming puzzles

17:47 as the main character, a girl and her robot companion attempted to save the world that has been plunged

17:54 into turmoil.

17:55 So I was trying to evaluate whether or not to highlight this on the show.

17:59 And I got like four episodes in just this morning.

18:03 Although it says it's a 10 episode series, but I only count nine.

18:06 It's zero.

18:07 It's you start counting.

18:08 It's a zero base.

18:09 So it's off by one for programmers.

18:12 I don't know.

18:13 It doesn't really teach.

18:14 I haven't got at least the first four episodes.

18:17 It doesn't teach like actual coding, but it talks about the concepts.

18:21 And that's what I really like about it.

18:23 It's an interesting story.

18:24 The animation is pretty good, but it'll introduce words and terms like loops for loops and tell

18:30 loops, while loops, conditionals, variables, path logic, permutations, how to do searches,

18:37 tables and recursion, and even some big O notation and some other things.

18:42 But these are like terms that in software and in programming, we use all the time and just

18:48 assume everybody knows what we're talking about.

18:50 One of the things I really like about this is just defining and using those terms in an

18:55 entertaining story so that when you really do start learning how to code, it's not going

19:00 to be surprised.

19:01 Highlight with that.

19:03 I'm also reading to my daughter a book that I picked up called Girls Who Code, Learn to

19:09 Code and Change the World.

19:11 And it's a lot of inspiration.

19:13 There's actually a Girls Who Code project that does teaching and stuff, but I don't know

19:19 what they're doing right now during COVID.

19:20 But the book is great and it's not any language specific stuff.

19:25 I think there is some Python in there, but that's not really the focus of it.

19:29 The focus really is teaching a lot of the concepts and just getting people excited about it.

19:34 So I wanted to highlight these two.

19:36 That's one of the biggest challenges.

19:37 It's getting people feeling like this is interesting and this is for me and I should pay attention to

19:41 it.

19:43 Yeah.

19:43 That's cool.

19:44 Also, I want to throw a shout out to CodeCombat.com.

19:48 That's another really nice place that sort of has some of these ideas, go through and do

19:53 like a little dungeon exploration and solve problems.

19:56 I think it would be a good follow on to this series.

19:59 Like you've got the ideas from the series and then you can go write like super editor supported

20:04 Python code to like in a little game world.

20:07 So that'd be fun.

20:08 Yeah.

20:08 Yeah.

20:09 We'll link to all that in the show notes.

20:11 Absolutely.

20:12 So this next one is interesting.

20:15 I ran across this just a few days ago and I thought, oh, I definitely want to talk about

20:19 this because how many programmers out there have this idea of I've been building this software

20:25 for other people, for other companies.

20:26 And I just want to, I have this idea and it doesn't exist and I want to build it and put

20:31 it out there into the world.

20:32 Like surely almost every programmer has had this, this idea of some in some form or other,

20:37 right?

20:37 Yeah.

20:37 Yeah.

20:37 So there's this project that is a pretty new project that goes along its path and it's

20:44 called keep the score.

20:45 So keep the score is like online software for scorekeeping.

20:48 Basically, if you've got like a soccer tournament, rock climbing competition, whatever, like those

20:56 things probably don't exist anymore.

20:57 But when we could be around other humans and when we can, again, this is going to make

21:02 a lot of sense.

21:02 You could have like a, a little online scoreboard that the parents could pull up and keep track

21:08 of or whatever, something like this.

21:10 Right.

21:10 That's basically what this app is.

21:12 It's a Python flask app and they wrote a blog post called the cost of running a Python

21:16 web app with 55,000 monthly users.

21:19 Okay.

21:19 So this explores like the infrastructure and how much did it cost to actually put it together?

21:23 how are they doing it?

21:25 And so on.

21:26 So I thought it might be fun to just kind of talk through that a little bit and then do

21:29 maybe a little comparison over to some of the talk Python stuff.

21:32 All right.

21:32 Yeah.

21:33 So I'm leaking over the thing.

21:35 Their site's pretty cool.

21:36 It's hosted on digital ocean as is all of our stuff, Python bites, talk Python and whatnot.

21:40 So that's a really fair comparison that I'll make.

21:43 And they're using digital ocean and Firebase currently have around 55,000 unique visitors

21:48 and they have their servers and database over on digital ocean.

21:52 And I think they might be using Postgres as a service on digital ocean rather than hosting

21:56 their own database server.

21:58 From what I can tell, they also have Amazon web services.

22:02 Yeah.

22:02 So for the numbers, digital ocean has cost them about $95 a month.

22:06 They have some AWS metabase stuff running over there.

22:10 It's $60 a month for like reporting and whatnot.

22:13 They have Google cloud for a whopping $1.32 at Firebase.

22:17 DNS hosting of $5.

22:20 Discuss $10.

22:22 They said, of course, you can have a free one, but they put ads there and they don't like

22:26 that.

22:26 So $10.

22:27 They're paying for that.

22:29 And they said, well, okay, that's $171 a month.

22:33 Is this worthwhile?

22:36 Obviously, if you were Roden Schwartz or you're Talk Python training, like it would be obviously

22:42 $171, like no big deal.

22:44 Right.

22:45 But this guy points out like, I'm an indie developer.

22:49 I have no revenue yet.

22:51 And I'm just trying to get this thing off the ground and I'm paying $171 a month.

22:55 But that's a lot of money for just trying to do something nice for everybody.

22:59 Yeah, I agree.

23:00 And it's mostly free and they're trying to figure out the monetization.

23:03 And I think it's a cool project.

23:05 I actually hope they're successful and it's cool they're building it with Python.

23:07 But I don't know.

23:09 It's an interesting trade-off.

23:09 I feel like so many people, I don't want this to sound at all critical of this guy.

23:13 Like what he's doing, it's working for him and that's great.

23:16 But I feel like a lot of people just in general, not necessarily this example, they envision

23:22 a world where like things are so much bigger and more powerful and more awesome or more

23:27 like there's more users and it's like more awesome.

23:29 And they got to be ready for that because when they get, when they land on like Hacker News

23:34 and all the people come, they've got to be ready for like a 50x traffic and stuff like

23:40 that.

23:40 And I don't necessarily think that that's how it goes or, you know, if you're in the cloud,

23:44 something like that happens.

23:46 Just push the make it bigger button.

23:48 And then it goes like, you don't have to do that beforehand.

23:51 And actually one of the things they said they ran into is they started out with a smaller

23:56 server and they said, oh, we want to make sure we have a bigger server just in case.

24:00 And they upscaled it.

24:01 And part of that upscaling like changes the, I think it was probably the file system got

24:07 larger, the disk got larger.

24:08 And once that happens, you can't downscale it again.

24:11 You're like stuck without, unless you recreate it from scratch, you can't downscale it again.

24:16 And so they have two servers.

24:18 They're like deploying to one.

24:20 And while they're deploying to one, they take the floating, the elastic IP and they switch

24:24 it over to another one that's keeps it running.

24:26 And then they deploy to the other one and it switches it over to the, like, there's like

24:31 this back and forth swap going on.

24:33 And that's actually how I do it at Talk Python on training site and stuff like that as well.

24:37 Having like two servers.

24:39 That said, this feels really high to me.

24:44 I'll give you some stats on Talk Python.

24:46 Just talkpython.fm, the website for the podcast, not the training site, not Python Bytes.

24:52 The reason I chose Talk Python is it's very similar to the numbers that this guy is using

24:57 on the same infrastructure.

24:58 So Talk Python gets about 40,000 monthly visitors.

25:01 It's super hard to talk about unique monthly visitors because so many developers, especially

25:07 in the developer space, because so many people have ad blocking turned on, which is how you,

25:11 you know, like third party cookies from apps like Clicky or whatever, say you get this many

25:16 visitors and like 50% of that's blocked or something.

25:19 Right.

25:20 So anyway, you got to kind of estimate like, well, how much is blocked?

25:23 Is it 30% or who knows?

25:24 So anyway, it's around similar numbers, a little bit smaller in terms of visitors, but the podcast

25:30 clients, oh my goodness.

25:32 The podcast clients are crazy.

25:35 They're just pounding the server like all the time asking for the RSS feed.

25:39 So we get about 3 million requests for the RSS feed monthly.

25:43 That goes through, it goes through Python.

25:46 It talks, it does some database stuff.

25:48 It talks over the database and it gives back an answer.

25:50 I could cache that as a file, but then there would be like latency and inconsistent.

25:55 I just, there's no need to not have that happen.

25:57 Right.

25:57 But that, that does.

25:59 Right.

25:59 So that comes through and that's about 120 K requests.

26:01 So that's 320 gigs of traffic and 3 million requests just to answer the question.

26:07 Can I go download the file?

26:09 Which is much bigger month of weekly.

26:11 You know what I mean?

26:12 So that's a ton of traffic and the servers back in that.

26:16 I have two servers cause I do this flip as well.

26:19 So there's zero downtime.

26:20 Most of the time.

26:21 One of them is a $5 server.

26:23 And because I wanted to splurge, the main one is $10 because, Hey, this is my whole business.

26:29 Like it's worth five extra dollars a month, but it could easily handle it on five, on five bucks.

26:34 So for example, I have it pulled up right now and it's running at like 8% CP usage, 6%.

26:40 You know, it kind of varies.

26:41 Right.

26:41 Right now.

26:42 If it was on the $5 one, it would be like 12%.

26:46 It would still be fine.

26:46 And then there's also a dedicated MongoDB server that handles everything, but that's like $10.

26:51 Total cost, 25 bucks.

26:53 Okay.

26:53 Well, 25 is, okay.

26:55 Okay.

26:56 Devil's advocate here.

26:57 $25 is way better than 171, but even $25.

27:00 Yeah.

27:00 I could do it at 20 if I wanted, if I, if I just went down to the $5 server, which I could,

27:05 but even at 20 a month, that's what a $240 a year for trying to do something nice and free

27:13 for everybody.

27:13 Yeah, I know.

27:14 What's really lucky is that I don't have to pay for the bandwidth for the, the stuff going

27:19 through digital ocean.

27:20 Cause that would be like another thousand dollars a month at least, but that's included.

27:24 So it's fine.

27:25 I feel like you could turn stuff down a lot.

27:28 Like for example, I think he's using Postgres as a service, which is probably, I don't know,

27:33 I'm sure there's probably 50 bucks a month.

27:34 You could probably put that on a $5 server and just manage Postgres yourself.

27:39 Okay.

27:39 Is that worthwhile?

27:40 I don't know.

27:41 Like how much of a pain is that to manage yourself versus like, how do you do backups and all that

27:46 kind of stuff.

27:46 But in the really early stages, I think you, if you're worried that the extra $100 a month

27:51 is a big deal, you know, maybe you do it that way.

27:54 Also though, by the way, my AWS bill is over a thousand dollars last month.

27:58 So, but that's just video delivery.

28:00 That's a different story.

28:02 That's just bandwidth.

28:03 That's, and that's because of the training.

28:05 Yeah.

28:05 Yeah.

28:06 Yeah.

28:06 Okay.

28:07 So I could do it cheaper.

28:08 I could do it a lot cheaper, but it would be less good for people.

28:10 And for that, I'm trying to pick the best possible option.

28:14 So that's how that goes.

28:16 But anyway, I think it's interesting to sort of think about like, what does it cost?

28:21 And your point about if I'm doing something nice for everyone, right?

28:25 It should cost less.

28:26 Yeah.

28:26 Well, I mean, you know, motivation doesn't really get into it, but it's a very real thing.

28:33 It's a barrier to entry for, for people that maybe that, I mean, they had to scrape together

28:39 just to get the laptop in the first place to start coding.

28:42 And yeah.

28:42 And if you're not in like a Western democratic place where currency is pretty valuable or the

28:48 pay rate is pretty high, all of a sudden $175 could be 25% of your monthly income, which

28:54 that's a huge number, right?

28:55 Yeah.

28:56 Yeah.

28:56 So it could definitely vary depending on where you're located.

28:58 Yeah.

28:59 Anyway, pretty, pretty cool.

29:01 I think it's worth looking at and digging into, and I wish them the best of luck with this project

29:05 because it seems cool and it's built Python.

29:07 Finally, if you want to hear like a deep dive into all this stuff that I was talking about,

29:12 Dan Bader and I had a long chat about the infrastructure behind Talk Python and some behind

29:16 real Python over on Talk Python 215.

29:19 I'll link to that as well.

29:21 That's pretty serious, man.

29:22 We should do something funny.

29:22 Yes.

29:23 Tell me a joke.

29:24 Okay.

29:25 So somebody shared this with us on Twitter and originally Netlify posted it.

29:30 It's a conversation between two people.

29:32 Oh no, we lost the hackers.

29:34 Where did they go?

29:35 I don't know.

29:36 They just ran somewhere.

29:37 They just ran somewhere.

29:40 That's so awesome because I didn't get that joke reading it, but when you say it like,

29:44 oh yeah, perfect.

29:45 Well, I'm very concerned about making sure that everybody has a happy work environment and

29:52 that they're safe.

29:53 And I've had to fill out some contracts and stuff.

29:56 It's so ridiculous, man.

29:57 I've had to fill out like vendor stuff for podcast advertising and they make me go through their

30:02 stupid vendor onboarding thing at some of these big companies.

30:05 And I've got to answer like the general vendor information.

30:09 So what is your information?

30:11 Like what is your location?

30:12 What is your bank account information so we can pay you?

30:16 What is your OSHA health policy?

30:21 Is there a chance that somebody is like, are there dangerous ladders that people could climb?

30:25 Will it be forklifts?

30:27 I'm like, dude, this is podcast advertising.

30:29 There's no ladders and there's definitely no forklifts.

30:32 Why are you sending me this huge 50 page form?

30:35 I got to fill out like two pages apply to me.

30:38 Anyway, let's take this and turn it into the programming joke.

30:42 So, you know, you've seen those like number of days since serious injury at factory seven.

30:48 We're doing great.

30:49 Nobody hurt this week.

30:50 So how about this for our programming sign?

30:53 Number of days since I've encountered an array index error.

30:57 Negative one.

31:00 I love this joke.

31:02 It's a good joke, right?

31:03 Yeah.

31:03 Negative one.

31:06 So that's really big because you probably overflow.

31:10 Well, you don't know how big though.

31:12 Is it a short and unsigned?

31:13 Is it like a, if it's a short, it's like negative 32,000.

31:16 But if it's a long, that's a really huge number.

31:20 It's like 4.2 billion, 9 billion, whatever the overflow wrap is there.

31:24 They probably just allocated a byte for it.

31:27 So it's like 255 or whatever.

31:31 Yeah.

31:32 Yeah.

31:32 Less than a year.

31:33 Awesome.

31:35 All right.

31:36 Well, thanks, Brian.

31:38 Congratulations on 200, man.

31:39 Thank you.

31:40 Oh, we overflowed.

31:42 We're into the 200s now.

31:44 Congratulations.

31:45 Oh, wait.

31:46 Let's celebrate on 256.

31:48 Yes, we will.

31:49 That's going to be the full cycle.

31:51 Yeah.

31:51 Yeah.

31:52 Awesome.

31:52 All right.

31:53 Well, thanks again.

31:53 Thank you.

31:54 Bye.

31:54 Thank you for listening to Python Bytes.

31:56 Follow the show on Twitter at Python Bytes.

31:58 That's Python Bytes as in B-Y-T-E-S.

32:01 And get the full show notes at Python Bytes.fm.

32:04 If you have a news item you want featured, just visit Python Bytes.fm and send it our way.

32:09 We're always on the lookout for sharing something cool.

32:11 This is Brian Okken.

32:12 And on behalf of myself and Michael Kennedy, thank you for listening and sharing this podcast

32:17 with your friends and colleagues.

Back to show page