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


Transcript #175: Python string theory with superstring.py

Return to episode page view on github
Recorded on Wednesday, Mar 25, 2020.

00:00 Hello and welcome to Python Bytes where we deliver Python news and headlines directly to your earbuds. This is episode 175 recorded March 26 2020 I'm Michael Kennedy and I'm Brian Okken Brian. We have a special guest Welcome Matt Harrison. How you doing, man? Glad to have you here. Good. Good. Yeah, come on. Yeah It's always nice to have you on the show before we get into it Let me just tell you this episode sponsored by Datadog check them out at pythonbytes.fm/datadog I'll tell you more stuff about them later. First, I want to just throw this out to both of you guys.

00:33 The world is, I don't know, is it turned upside down or is it locked down or what has gone on with the world? It's crazy. >> We're kind of software people, so and I know we're all kind of in different boats. I am definitely grateful that I'm a software person. I have a lot of friends that are not, that are in the retail industry or the selling stuff to people sort of industry, or self-employed. And those people, they're really hurting. I've got a lot of people I know that if they're self-employed, you don't qualify for unemployment insurance and stuff. So there's a lot of people hurting them. How are you guys? It's crazy. Yeah. Matt, how about you? I just found out this morning that my largest client just dropped all my trainings for the rest of the year. So- That's not your favorite phone call or email to receive, is it? Not the best news, but the thought that I have on that is past couple years have been very good, right? And people have said like the bubble will burst and I don't know that we thought that a virus would do this, but I mean it looks like winter came for better for worse and so people are going to have to adapt and now if you can weather the storm it might, it's going to be tough though. I mean I was even talking with some friends who are in the medical industry and they're like we're worried about our jobs, right? And these are like doctors and people who who work at the hospital.

01:53 So it's interesting to see what's going on.

01:56 And I've worked from home for the good portion of the last 15 years.

02:01 And right now it's scary to see that there's a lot of upheaval and we'll see what happens.

02:07 How are things going for you, Michael?

02:09 - Well, you know what, it's really interesting.

02:12 If you'd asked me this question like six years ago when I was doing mostly in-person training, it would have been like somebody just cut the light switch Bob said, "We're all leaving.

02:23 "Lock the door on your way out." It would have been purely traumatic.

02:28 Luckily now, online courses are great still.

02:32 Podcasting is great.

02:34 What's ironic is my work life is literally unchanged, but the rest of my life is scrambled.

02:39 My daughter is home from school 'cause they closed school.

02:42 Oregon's now on full lockdown.

02:44 It's hard to go out to dinner.

02:46 Everything has changed in some ways, but ironically, not my work life, really.

02:50 I'm sure it'll have some effect eventually, but nothing immediate.

02:53 I guess one more thing before we move off.

02:55 I'm just curious, what are your plans around training?

02:58 Are you going to be teaching over Zoom or is it just focus on other stuff until it comes back?

03:02 Yeah, I think both of that.

03:03 I do have some clients who are moving to virtual training and I already do a bunch of virtual training anyway.

03:10 So, I mean, it's sad that some of them aren't able to or can't due to circumstances or whatnot, But try and see if other people want virtual training and just work on other products that people are interested in as well.

03:24 Yeah, absolutely.

03:25 Well, hang tough you guys and everyone out there.

03:27 It's going to be a wild ride.

03:30 Hopefully the software side of the world is a little bit less bumpy, but it's still it's crazy.

03:34 All right, well, let's talk a little bit about the future, Brian.

03:39 We can't predict when the COVID stuff is going to be better, but you could probably predict some stuff about the Python future.

03:44 I'm just still getting excited, used to being able to have Python 3.8 everywhere.

03:49 And, but we've got Python 3.9 right around the corner.

03:52 And in October is the scheduled release.

03:55 I don't know if that'll change due to the virus or not, but that's where it is.

04:00 And one of the cool things that I noticed from a blog article is that there's union operators coming for dictionaries in Python 3.9.

04:09 And this is a PEP 584.

04:11 and there's a article called Dictionary Merging and Updating in Python 3.9 by, I think, Yong Kui.

04:20 And there's a couple new operators.

04:22 One of them, it's just the bar or the bar equals or the pipe operator, whatever.

04:29 Looks normal if you're used to, I guess that's the math or operator.

04:32 - It's like a bitwise, it's like a bitwise or, yeah.

04:36 - I'm kind of excited about it.

04:37 So you can combine two dictionaries by just doing a dictionary one or dictionary two or something like that.

04:45 And then the equivalent assignment operator as well, which is really an update operator and a merge.

04:52 The article spent a little bit of time talking about the other older methods that you can use to combine dictionaries now.

04:59 And I know people have covered those in a lot of places.

05:02 The one thing, the article actually spent a lot of time on it and I just think it's something to watch out for and be aware of is when you're combining dictionaries, usually if there's overlapping values, like if there's a value with the same key in both dictionaries, you'll get the second one will take precedence.

05:20 It's just something to be aware of.

05:22 - Yeah, yeah, and that's the way it works in the current operators as well, right?

05:26 Star star sort of combine stuff and whatnot.

05:29 - Yeah, as long as you're aware of it, it's good to know.

05:31 But this is clean, it's actually something that, now that I see it, I'm surprised that we don't already have an operator already in TicketMineDictionaries 'cause it's something I kind of do a lot of.

05:42 - Yeah, and if you look at the syntax there for the pipe, I mean, the pipe is already in the set operator and prior to sets existing, when people used to use dictionaries to emulate sets, I mean, they wouldn't do the or operator, but it's interesting that it's sort of coming round circle now that we originally had dictionaries, people started using dictionaries as a simple replacement for sets.

06:04 Then we got sets, which had the pipe operator.

06:06 Now the pipe is coming back to the dictionary.

06:09 - Interesting.

06:09 So why do you guys think they didn't use plus?

06:12 Like, you want to combine two things, like two lists, you don't use a pipe to put them together.

06:17 You use a plus.

06:18 For strings, you use a plus.

06:20 Plus already existed.

06:21 - I think it's because of the union operator already being used for sets.

06:25 - Yeah, you think so?

06:26 Yeah, all right, cool.

06:27 Well, yeah, it's good to see some nice shorthands coming there.

06:30 But if we can have a pipe equals operator, give me the plus plus, come on, I just want the plus plus.

06:36 (both laughing)

06:38 - Double pipe.

06:39 - Yeah, double pipe.

06:41 What does that mean?

06:43 All right, Matt, you got the next one.

06:44 This one is short and sweet, but it looks pretty cool if you got the use case for it.

06:49 - Yeah, yeah, so there is this super string library, which is a new library that's a replacement of, not a replacement, but it's a new string library for holding sequences of characters.

07:02 It's built on this rope data structure, and apparently it's pretty optimized.

07:08 It uses a 20th the amount of memory and a fifth the speed, so operates five times faster for a lot of operations.

07:17 I think this could be super useful for people who are manipulating data.

07:23 So it'd be interesting to look at, you know, if the people who are doing NLP could take advantage of this Definitely like the memory constraints, you know using a 20th the amount of memory would be awesome even in places like pandas NLP as well natural language processing the API is pretty basic right now. It's got Concatenation getting the length doing some indexing and slicing and stripping and uppercasing and lower casing So that could be a good with the speed and memory performance. They're showing that could be a good enough limited set of capabilities Sort of for me the elephant in the room is the f string for me. That's the best feature of python3 I know implement that and uh Let's use it. Yeah, the other thing that's missing is uh negative indexes, but that can't be hard to add honestly Maybe it's hard to add quickly, but it can't be hard to add negative indexing That's a good point. I mean, they don't make any reference to whether they support Unicode. So that's, I guess, another question, right? If they do support the Unicode capabilities, the Python supporting, I mean, Unicode can make indexing a little bit more complicated, but that might be what's going on there. But this will be interesting to watch. Interesting library to watch. What do you think, Brian?

08:44 I'm just not in a place where the strings are the memory or the bottleneck in any of my applications.

08:50 Yeah, but to give you an example, like a real world example, like I've been playing with some Markdown stuff for like the sort of CMS side of things that I'm writing in Markdown. And if you've got something that's maybe 10, 20 pages of Markdown, it takes half a second to convert that from markdown to HTML. I don't know how much of that is like the actual string juggling and how much of that is just converting it to markdown is slow, but that's a non-trivial amount of processing that's like sort of around the corner. I mean, you would never do it manually. You'd use a library, right? But still, you can benefit from that. On that, you can think of all the people who are using static libraries, right? For web pages who, you know, once you get, they all complain about once you get X number of pages in there, they start getting slow and the rebuild takes five seconds instead of a half a second or whatever. And so something like this could help there as well.

09:44 Right, theoretically. So this is not a super popular library, but I'm glad you put it on here because I think it's pretty cool. I guess two thoughts. One, it'd be interesting to look at what they're doing and if there's any easy low-hanging fruit to bring back to CPython, because it would be better if just Python strings were faster. And they're like, why would you make this it's the same speed you know what I mean? Then the other Brian you may have noticed there's no tests. Oh yeah it looks like it's recent it's like I don't know if it's even been around for more than a week. So yeah I think it's pretty new so if somebody's like oh this is cool let me try it out like maybe a way you could participate is like write some tests just to verify things right but uh yeah pretty cool. It's just imaginary if there's no test it's like no picture no proof man.

10:28 if it continuously deployed in the woods and there were no tests to hear it, did it actually happen?

10:33 Something like that? Yeah, exactly. Sure, that's the same, I think, the historical version.

10:38 I thought the way of your new testing strategy is if it doesn't have tests and you don't commit it.

10:46 Didn't you say you're using something like that? Yeah, that's good. That's a good way, for sure.

10:52 All right, so this next one is going to affect everybody who works with Python. This is a big Hopefully it's not a bumpy deal, but it's a big deal.

11:00 So the Python packaging authority folks, the PSF subgroup, they recently got funding to hire some developers to make pip better.

11:11 So pip is awesome, we all pip things, and even if you don't pip things, if you pip-emp them or you poetry them, you really pip them down below, right?

11:20 So they got a bunch of funding to make that better, and one of the challenges, one of the first challenges that they're tackling is that pip will, it's not, it doesn't take into account all the stuff you're trying to do.

11:32 It just says, I see a requirements file, let me just go from top to bottom, just start hitting it, right?

11:38 Install the first one, install the second one.

11:39 So they're rolling out a new pip resolver at the end of the year.

11:44 That's pretty cool, huh?

11:45 - Yeah, this is neat.

11:46 - Yeah, so the idea is basically, it's gonna go and it's gonna look at the dependencies of the various packages and try to install something that is consistent across all of them.

11:56 Like maybe the first package in your requirements files requires, I don't know, docutils 16, and the second one requires docutils 15, or maybe the first one doesn't even specify and 16's just the latest.

12:09 If you pip install -r that, you're going to get 16, and then it's going to complain that you have 16 and not 15.

12:14 You know what I mean?

12:15 It's like, it just doesn't even factor in the larger system that these two things have to coexist.

12:20 So that's one of the things they're working on.

12:22 So to reduce inconsistency, it'll no longer install a combination of packages that's mutually inconsistent, and it will be no pushover, it can be strict.

12:32 If you ask it to install two packages with incompatible requirements, it will say no, it will not do it.

12:40 - Yeah, and then it just doesn't install anything, I think.

12:42 - Yeah, yeah, it just says, no, I can't install it.

12:44 - That might cause some problems, right?

12:47 - Yeah, it might.

12:48 or make people's processes work differently.

12:52 Because, I mean, right now I know that there's a bunch of libraries on top of each other, and I can sort of just install them over on top.

13:03 I have my libraries, and some of them sort of work, and some of them work, it doesn't refuse to install them.

13:08 So this might be a speed bump in the road for a lot of people, and maybe in the end it works out better, but might cause some consternation in the short term.

13:19 Yeah, that was my first thought exactly. It's like, oh, there's going to be a bunch of stuff that just won't install anymore.

13:24 Maybe a library itself can't install because two of its base libraries dependencies themselves are inconsistent.

13:31 How are they working now then?

13:32 You just get a warning and it just still works.

13:34 It's not that they're necessarily truly inconsistent.

13:37 One says, I require library less than equal to this version.

13:41 Another one says, I require library greater than equal to that version.

13:44 That doesn't necessarily mean the one that requires the lower one wouldn't work with the newer one.

13:50 It's just that's what the requirements state.

13:52 You know what I mean?

13:53 Like for example, Bodo3, which is the Python 3 library if we're talking to AWS, and its underlying library, Bodo core, at one point were having different dependency, like inconsistent dependency statements or something weird like that.

14:08 That I was running into.

14:10 But it did matter, it still ran.

14:12 "Oh, I better run the unit test.

14:14 "It says these aren't going to work together.

14:15 "Let's see if they, you know, "maybe there's some corner of that thing that doesn't work, "but I don't use that corner, so I don't care." - Yeah, or you have, in the machine learning side, you have, this library depends on some old version of TensorFlow, but you're not using TensorFlow, you're using some utility library in it, but it also has support for TensorFlow, but you're not using it.

14:37 So if you had a different version of TensorFlow on it, it wouldn't really affect you because you weren't using that portion of it.

14:43 Right, but it sounds like pip will say, "No, I can't install these things." They make statements about two things that they can't coexist. But you're like, "I don't really care that they're working." So I think this is good. I think it makes things more predictable. But you're right, Matt. It's definitely going to cause some challenges. And maybe it'll get people to update things like the base library statements that they depend upon more carefully.

15:09 like to see, if we're talking about pip, is that I'd really like to see Python come out with dot releases that if there's a new version of pip that all the latest versions of Python have the latest version of pip. I'm just really tired of installing Python places and immediately having pip out of date.

15:30 I actually have an alias that when I create a virtual environment, then it immediately does a pip install - - upgrade pip instead of because why doesn't it just do that for me?

15:40 Yeah.

15:41 Anyway.

15:41 Can I just update the top level one so that all my new virtual environments get the newest one?

15:46 Yeah.

15:47 Anyway.

15:47 This is coming. They blogged about it. I'll link to the blog post from the PSF.

15:50 They said there's a couple things you can do to help first and most fundamentally help them understand how you're using PIP.

15:57 They have some user experience research going on. There's a link to go do part of that.

16:01 You can check right now if this is going to be a problem for you.

16:05 Go to your project, your virtual environment, activate it and type pip check.

16:09 And it will tell you if you are in this inconsistent state.

16:12 I had one website that was, a couple that weren't.

16:15 I hacked around until I fixed them up and everything was good.

16:18 Make sure you test the new version of pip.

16:20 It will probably be out in May. Help spread the word.

16:22 All three of us are doing that. Ta-da! Awesome.

16:25 And if you develop a tool like Poetry or something that lives on top of this, make sure that you test integration with the thing coming out in beta in May.

16:34 All right, really quickly before we move on, let me tell you all about Datadog.

16:38 This episode is brought to them, brought to you by them.

16:42 So let me ask you a question.

16:43 Do you have an app in production that's slower than you'd like?

16:46 Is its performance all over the place?

16:47 Maybe fast, sometimes slow others.

16:50 Here's the important question.

16:51 Do you know why it's slow or inconsistent?

16:54 With Datadog, you will.

16:55 You can troubleshoot your app's performance with Datadog's end-to-end tracing, Use the detailed frame graphs to identify bottlenecks and latency in that finicky app of yours.

17:04 Be the hero that got the app back on track at your company.

17:07 Get started with a free trial today at pythonbytes.fm/datadog.

17:11 Use a cool product, help support the show.

17:13 Matt, I think this next topic you got here, this pretty much is on everyone's mind right now.

17:19 And maybe you're trying to not think about it, but there's some useful stuff going on here.

17:23 Yeah, just with the whole coronavirus, COVID-19, I've been thinking, what can I do as an individual to help?

17:32 And I think a lot of people are trying to flatten the curve or limit the growth.

17:37 And I think a lot of people, at least in our community, understand the importance of that, but maybe not the general populace as well.

17:45 So one of the things that I thought that I could do is just spread among my local community through my local social media.

17:52 Like, what is the growth locally here where I'm based?

17:55 I'm based out of Salt Lake in Utah.

17:58 And so I had a problem actually getting the data.

18:02 I mean, there aren't any repositories that have local Utah data.

18:06 The local Department of Health is reporting on it, but their data, there's not a source of data that you can cleanly pull.

18:13 So I've been pulling, making my own data source, and then I've been just posting those on Twitter and LinkedIn just with my local data to sort of track what that growth looks like and sort of put that people's minds to sort of, "Hey, think about what's going on locally and see what changes you can make." And I did some basic modeling to sort of predict what's going on because I've been reading other people's models about, you know, this is an exponential growth rate, blah, blah, blah, what that looks like. And so I did some basic models using machine learning. But it's also in the Twittersphere and elsewhere, people are saying, "All these data scientists are coming and just throwing machine learning at this, and that's not the right thing to do. The right thing thing to do is read the literature and see what epidemiologists and others have done.

19:01 And so I just want to point to some things that might be interesting.

19:05 I've got a link to a Kaggle project that shows making some basic machine learning models, but it also points to a library that's found in SciPy that probably a lot of people don't know about.

19:17 I know about it because I teach about it.

19:19 And that's in SciPy, there's an ODEINT function, which is a solver for what's called ordinary differential equations. And so this is probably a math class that you may have taken in college.

19:30 I took one in college and it was purely theoretical and I basically forgot everything since then. But there's what's called an SIR model and that stands for you have people who are susceptible to being sick, you have people who are infected, and you have people who are recovered.

19:50 And so typically these flattened curves are looking at the infected part, the infected growth of that, but there's a relationship between all these three different groups and they're more complex models.

20:00 But if you use ordinary differential equations, that is the tool that epidemiologists and statisticians use to plot these and determine what's going on here rather than just, you know, throwing it at linear regression or trying to do a machine learning model that way. So I just want to point people at this Kaggle project. It's got an example of doing this SIR model. It's also got some basic machine learning models as well. But be aware that a lot of these things that we learn about, that in theory you think, "Oh, this doesn't make sense." This is actually a case where ordinary differential equations are the right or one of the right tools to look at this data and understand what's going on there. Yeah, that's a cool project. Yeah, definitely a cool project.

20:47 I'm sure there's a ton of data science going on around all of this.

20:52 There's a lot of data.

20:54 It's coming from different places like live dashboards and stuff.

20:57 And I think this is, this is really cool.

20:59 I didn't know about the SIR model.

21:00 That's cool.

21:01 There are a bunch of other Python libraries as well that epidemiologists have created and whatnot that, that implement these SIR models.

21:08 And there's another one, SIER.

21:10 And so check those out if you're interested in sort of digging with the data, but a a plea to people to think about what you can do for your local community.

21:18 You know, if you've got skills to help out, what can you do locally to help out and help others?

21:24 Yeah, absolutely.

21:26 Also, random side point here, looking through this code on Kaggle, I never realized that you could unpack a tuple in a nested way.

21:35 Like thing, comma, tuple unpacking thing, right?

21:39 So where you can layer these in deeper and deeper.

21:42 That's pretty awesome, actually.

21:43 Yeah, your data structure is nested, right? Not necessarily. It's going to make your code easy to read, but you can have fun there.

21:50 It can definitely, definitely make it shorter. All right, cool. That's a nice one. Brian, you're getting all philosophical on this with this next one. What's up?

21:58 Okay, so this is totally we're going from serious to definitely not serious. So that I noticed this also. So there's a Reddit thread that's now or I don't know if it was Redditor or Stack Overflow, but it got taken down.

22:14 But essentially, the question was, why does all return true if the iterable is empty?

22:20 There's an all keyword in Python that I guess actually a lot of people don't know about.

22:25 >> Yeah, probably not.

22:26 >> Takes an iterable and it returns true if all of the elements of the iterable are true or evaluate to true in a Boolean context.

22:35 It's really helpful for a lot of things.

22:37 The interesting aspect is what should you do if the iterable is empty?

22:43 And because, you know, actually the person asking the question said, "Shouldn't it be false? Just like, you know, you can say if list, and if it's an empty list, it's false.

22:55 Why would all be true if it's empty?" And I enjoyed the conversation and somebody wrote an article called "About this, why is all return true?" The end lesson is it doesn't matter why because the court team decided it and you just need to know it and work around it.

23:12 Lastly the tree to be true so therefore it is true.

23:15 Yeah and then one of the things i want to point out from this discussion is a the statement all unicorns are blue.

23:21 I just love that you can't tell me it it is definitely true because there are no unicorns so therefore it's true for me to say all the blue yeah.

23:30 And so I like that and I guess I'm glad that my daughter doesn't listen to this to hear me say that there are no unicorns Sorry, honey. Don't break her heart. Yeah, you can talk about no Santa or what's going on here like The tooth fairy is not real But the person writing this article Carl Johnson is actually also a philosopher and a programmer. So he talks about this 2500 year old debate in philosophy about whether or not all unicorns are blue should be true or false false. And also we get talk about predicate logic and Socrates and Aristotle and syllogisms and things like that. Actually, we never at the end, I still don't know why the core team chose that that is true, but it's a fun thing to look into. That's fun. So looking at it from the outside, I envision it working like this. The way all works to be efficient is it says for thing in collection, if not thing return false, go all the way and return true.

24:32 And it just never goes into that loop.

24:34 So return true.

24:34 Probably.

24:35 Yeah.

24:35 But I probably got to go and open up the CPython source code to find out.

24:39 Matt, what do you think?

24:41 I don't know.

24:42 I'm looking at the Unicode symbol, the Unicode emoji in my Python REPL right now, and that's a hex code point one F nine eight four.

24:53 And it doesn't look blue.

24:55 It looks pink.

24:56 So, someone's got to file a--

24:58 [LAUGHTER]

25:01 We definitely got to put--

25:02 somebody's going to have to put a comment on that blog post.

25:05 Yeah, that's not true.

25:06 All unicorns are pink.

25:07 It's interesting that they did make it true, to your point.

25:10 Like, in a Boolean context, anything empty in Python is false.

25:15 Yeah, yeah.

25:15 Another option would have been to raise an exception, say you can't ask for the truthiness of nothing.

25:20 The main reason why I wanted to bring it up, and the main reason I enjoy reading this article, is now I will never forget that all of nothing is true.

25:29 - I'm also thinking, have I ever used all in an if statement?

25:35 I don't know that I have used all in an if statement.

25:38 - Where do you use it?

25:40 - Yeah, I guess I have.

25:42 - Yeah, I've used it.

25:43 Usually I'll put like a set, not a set, some kind of generator expression in there.

25:48 'Cause I don't usually wanna test all the things are actually true.

25:51 I wanna test like the dates are greater than today for all of them or something, right?

25:55 So put a little comprehension in there and then ask all of that.

25:58 But yeah.

26:00 - Yeah, I guess it returns a Boolean so you would put it in an if statement.

26:03 (laughing)

26:04 - I guess so.

26:05 I don't use it a ton either, but every now and then I'm happy with it.

26:08 - If I put it in an if statement, am I going to loop over the contents of all, right?

26:13 And I don't know that I have it in an if statement.

26:16 I loop over--

26:17 - No, no, it would be to avoid a loop, right?

26:19 It would be like one line of loop basically.

26:22 Cool, yeah, I won't forget either now.

26:23 I didn't realize it was so philosophical, but apparently here it is.

26:26 All right, last one.

26:29 This one's really quick.

26:29 This is a project written by Jean-Sebastien Douay.

26:33 Like, are they close?

26:34 Right.

26:35 Called pytest Monitor.

26:37 And the idea of pytest Monitor, Brian, you familiar with this one already?

26:40 I looked it up quickly.

26:41 Yeah.

26:41 But I haven't used it before.

26:43 Yeah.

26:43 But okay, cool.

26:43 Basically you pip install this and then anytime you run a pytest test, it's going to automatically collect some data for you.

26:52 it'll analyze memory consumption, timing, CPU usage, stuff like that.

26:57 And it'll put it into a little local SQLite database file, and you can look at it over time and whatnot.

27:03 So it's pretty cool, right?

27:05 If you want to say, well, how long does this code take to run on the production machine versus on our laptops, right?

27:13 You actually get tracking and whatnot from that.

27:15 So not a huge addition, but it's kind of cool.

27:18 It's built on a couple of libraries.

27:20 PSUtil and MemoryProfiler, which let it basically go and ask all these questions on a per test basis, which is cool.

27:29 And then obviously it just runs in pytest.

27:31 - That's cool.

27:32 - I could see where you might want to have a report where you just want to limit what that's running on.

27:39 I don't know that I would want that necessarily on everything, but you might have some hotspots or whatever where you want to monitor that and report on that.

27:47 Having it on everything seems like--

27:50 I don't know what the performance implications are of all that monitoring.

27:55 I think it'd be cool to see, this is one of the parts where I'd like to actually see the reporting of this project, have some reporting that's nicer around it.

28:06 Because that's some really cool information, but I think some reporting would help it.

28:09 Yeah, it's not beautiful, is it?

28:11 It is in the SQLite database, you could grab it and do what you want, but then you've got to write that.

28:16 - Like coverage, one of the wonderful things about coverage is the reporting part of it.

28:20 - Yeah, absolutely.

28:22 All right, well, if that's something you guys care about, go install that and check it out.

28:27 All right, well, that's it for all of our major items.

28:29 Brian, Matt, you guys got anything you want to throw out there extra before we get to our joke?

28:33 - Stay safe.

28:35 - Yeah, absolutely.

28:36 - I've got nothing extra.

28:37 How about you, Michael?

28:37 - Well, I took two of my projects that I've been kind of fiddling with for either a short time or a long time, depending on which one, and put them both up on PyPI as things you can now pip install, so that's kind of cool.

28:49 So the switchlang, my little extension to add switch to the Python language, you can pip install that now.

28:54 I still love that thing, I use it all the time.

28:56 And then my markdown sub-template.

28:59 Oh, what's that, Matt?

28:59 - You use that in production.

29:01 - Oh yeah, all the time.

29:03 - Awesome.

29:04 - Yeah, there's like a couple places where it would be like this huge if statement or some other weird lookup, and it does cool stuff to say like, oh, you already tested for this case, or you're like, have the same case in two places, and you would miss the second one because it'd be caught by the first and so on.

29:19 - Cool.

29:20 - Yep, and then the second one, the markdown sub template thing, which we talked about before, but it was not then pip installable, so now it is.

29:27 People can check those out.

29:28 - Do you have tests on these, man?

29:29 - Of course we got tests on those.

29:31 I don't have pytest monitor on, but we got tests going.

29:34 - I got tests in there.

29:36 So they do exist.

29:37 The code does exist, it has tests.

29:38 - It does, yes, we can speak of it.

29:41 Are you all ready for a joke?

29:43 - Yes.

29:44 is it's not really that funny. It's more like as opposed to the rest of our jokes.

29:49 Dude, I think I've done that. Well, some of them are like meant to be straight out funny.

29:54 This one's like funny ironic because yeah, I did that too at one point or something like that. Right. So this guy on Twitter sent a message, sarcastic pharmacist, sent it over and said, I was listening to discussion on talk by the about rebooting a server instead that are chasing bugs and thought you should check out xkcd.com 1495.

30:16 And there's just a picture and it has like a trade off.

30:21 It says, okay, why is everything broken in my life?

30:24 Here's the deal, like I could spend one to 10 hours figuring out why my server keeps running out of swap space and crashing, or I could spend five minutes plugging it into a light timer that reboots it every 24 hours.

30:37 That takes five minutes, let's do that.

30:40 >> Yeah, so true.

30:42 >> Yeah.

30:43 >> That's actually an interesting thing.

30:46 We just ordered a bunch of web programmable power strips.

30:51 Yeah, because one of the things you do when working with electronics is sometimes power cycle the things.

30:57 Ain't no way to go and do that when I'm working from home.

31:00 >> How interesting. So you built that into the CI/CD?

31:04 Hey, with the tests, let's do that.

31:08 Most of the time these aren't problematic, but there is the occasional in development instrument where or in development operating system portions or something like that where it gets into flaky situations and Rebooting is a good is a good thing to do from the start because as a software developer I can get things into really wacky states. It doesn't happen a lot, but it happens enough to where it's good to know that Yeah that you can buy these webs power switches We're getting industrial ones which are kind of expensive because you can stick them in instrument racks.

31:40 But they're just a normal power strip, but they've got a web address and a REST-like API that you can put them in strips.

31:47 And if you want to use them in a CI/CD pipeline, you can call them that way too if you want.

31:53 But normally we just have them as a backup so that we can log in and reboot them if we need to.

31:59 You don't have them connected to Alexa?

32:01 Alexa, reboot my computer.

32:04 Oh, no.

32:05 Yeah, my test won't pass.

32:08 Hell, shall I reboot again?

32:10 Yes, please.

32:11 Awesome.

32:12 All right.

32:13 Well, Brian, thank you as always.

32:14 And Matt, thanks for being here today.

32:15 It was fun to chat with you.

32:16 Yeah, thank you.

32:17 Nice chatting with you.

32:18 Thank you for listening to Python Bytes.

32:19 Follow the show on Twitter via @PythonBytes.

32:20 That's Python Bytes as in B-Y-T-E-S.

32:21 And get the full show notes at PythonBytes.fm.

32:22 If you have a news item you want featured, you can find it on the show notes page.

32:23 And if you want to learn more about Python, you can find it on the show notes page.

32:24 bytes as in b-y-t-e-s. And get the full show notes at pythonbytes.fm. If you have a news item you want featured, just visit pythonbytes.fm and send it our way. We're always on the lookout for sharing something cool. On behalf of myself and Brian Okken, this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page