WEBVTT

00:00:00.001 --> 00:00:04.920
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to

00:00:04.920 --> 00:00:10.640
your earbuds. This is episode 113, recorded January 16th, 2019. I'm Michael Kennedy.

00:00:10.640 --> 00:00:11.740
And I'm Brian Okken.

00:00:11.740 --> 00:00:16.420
And this episode is brought to you by DigitalOcean. Check them out at pythonbytes.fm

00:00:16.420 --> 00:00:20.080
slash DigitalOcean. Get $100 free credit for new users. Brian, how you been?

00:00:20.080 --> 00:00:21.000
I am great.

00:00:21.000 --> 00:00:21.860
Nice. Me too.

00:00:21.860 --> 00:00:22.440
Cold though.

00:00:22.440 --> 00:00:26.640
Yeah. I don't know what happened. It's like winter, mid-January. I guess it's supposed to

00:00:26.640 --> 00:00:30.040
be cold. But yeah, it's cold. Maybe. My daughter said this morning,

00:00:30.040 --> 00:00:34.440
like, when are we going to get snow? And I said, well, I hope never because I don't have snow tires

00:00:34.440 --> 00:00:38.620
yet. I just bought snow tires for my car so I can drive up to the mountains and go skiing real easy.

00:00:38.620 --> 00:00:43.440
So I'm ready. It can snow whenever. But yeah, if it's not going to snow, let it be a little warm.

00:00:43.440 --> 00:00:50.140
So speaking of wintry type things, advent calendars, those are a type of things that folks use a lot

00:00:50.140 --> 00:00:51.420
in December, right?

00:00:51.420 --> 00:00:56.180
Yeah. And actually, this last December, I totally meant to do the advent of code thing,

00:00:56.320 --> 00:01:01.200
but I didn't. And also one of the things I'm doing this upcoming year is I'm trying to,

00:01:01.200 --> 00:01:07.020
I read a great article about practicing programming. I want to try to do, incorporate more practice

00:01:07.020 --> 00:01:14.140
outside of just doing my own work at work, but practicing extra things. And there's challenges

00:01:14.140 --> 00:01:19.820
and code things and little snippets and everything. But sometimes I just want like 20 minutes of reading

00:01:19.820 --> 00:01:26.640
reading something. And this is great. So I ran across this. It's from Michael Fogelman. It's the

00:01:26.640 --> 00:01:33.100
advent of code 2018 solutions. And it's pretty much he just talks through all the different,

00:01:33.100 --> 00:01:39.340
he went through all of the advent of code for 2018, and then he solved them in Python. And a lot of people

00:01:39.340 --> 00:01:44.740
have posted their solutions on GitHub. This is a nice write up that he has to describe how he solved

00:01:44.740 --> 00:01:48.000
them. And there's some nice code comments. It's really put together well.

00:01:48.000 --> 00:01:51.780
Yeah, I like it. You just sort of cruise through and see the problem, see the solution,

00:01:51.780 --> 00:01:57.700
see what you think. I find looking at other people's solutions of fairly simple programs,

00:01:58.020 --> 00:02:02.960
especially compared to your own. It's a pretty interesting experience. Like, oh yeah,

00:02:02.960 --> 00:02:07.120
I totally solved this. And then you look like, oh wait, they did that in two lines and mine took 10.

00:02:07.120 --> 00:02:10.160
Or why did they do it that way versus this? It's pretty cool.

00:02:10.160 --> 00:02:15.280
Yeah. Looking over, reading code is one of the ways to get better. So it's a good way to practice

00:02:15.280 --> 00:02:16.940
is reading other people's code.

00:02:16.940 --> 00:02:22.320
Yeah. And it's not like read the Django source code or read the request source code. And it's like a huge

00:02:22.320 --> 00:02:25.760
undertaking, right? These are 10, 2025 lines of code.

00:02:25.760 --> 00:02:30.020
Yeah. Yep. Definitely. So I dropped this in because I think I'm going to start

00:02:30.020 --> 00:02:35.420
trying to incorporate, sprinkle in some reading, reading of these in with my daily practice.

00:02:35.420 --> 00:02:39.760
Yeah. I think that's a good idea. Do you know what the most popular platform that Python runs on

00:02:39.760 --> 00:02:40.380
is, Brian?

00:02:40.380 --> 00:02:42.380
Probably Macs. Mac laptops.

00:02:42.380 --> 00:02:47.600
A lot of Mac, a lot of Mac laptops, a lot of stickers on them. That's what you'd believe if you

00:02:47.600 --> 00:02:52.640
were at a conference like PyCon or something, everyone's running around with their Apple logos glowing or

00:02:52.800 --> 00:02:57.640
sadly no longer glowing on the new Macs. But nonetheless, it feels like when you're in

00:02:57.640 --> 00:03:03.940
those environments, it's mostly Mac and some Linux and obviously server side Linux. But really,

00:03:03.940 --> 00:03:10.020
a lot of the surveys say most of the users, you know, by a pretty wide margin are actually on

00:03:10.020 --> 00:03:16.800
Windows. So we're talking students, we're talking corporate environments, a lot of folks who don't

00:03:16.800 --> 00:03:21.080
show up necessarily carrying those around at conferences, but that's where it is, right?

00:03:21.080 --> 00:03:21.320
Yeah.

00:03:21.320 --> 00:03:28.560
So the big news is that the PSF broadly and specifically Steve Dower, one of the core devs,

00:03:28.560 --> 00:03:36.800
whose works at Microsoft, has released Python 3.7 as an official app on the Windows 10 store.

00:03:36.800 --> 00:03:37.380
Nice.

00:03:37.580 --> 00:03:42.720
So there's all sorts of stuff that is really awesome from that. So that means you can just

00:03:42.720 --> 00:03:48.140
go to your Windows store and search for Python and say, yeah, I want that. You can actually already

00:03:48.140 --> 00:03:52.940
do that for like Ubuntu subsystems and stuff. So you can do that for Linux distribution, surprisingly,

00:03:52.940 --> 00:03:58.760
and run those as like subsystems in Windows, but not Python. And some of the stuff that's really cool is

00:03:58.760 --> 00:04:06.140
it automatically takes care of a couple of problems that were incompatibilities between Windows and the

00:04:06.140 --> 00:04:13.240
other operating systems. So for example, Python 3 is a command in the Windows 10 app store version,

00:04:13.240 --> 00:04:17.960
but not the one you actually install separately. So now if you see instructions like type Python 3,

00:04:17.960 --> 00:04:20.940
this, that, like that now works on Windows 2 also.

00:04:20.940 --> 00:04:21.660
That's nice.

00:04:21.660 --> 00:04:27.780
Yeah. So it's a little more similar. It automatically puts that stuff in the path. I believe the place

00:04:27.780 --> 00:04:33.300
where you pip install stuff no longer requires admin access to do it because it's under your user

00:04:33.300 --> 00:04:35.780
profile as part of the store stuff. So a whole bunch of good things.

00:04:35.780 --> 00:04:38.700
Have you talked to anybody to find out when we're going to get to the point where

00:04:38.700 --> 00:04:41.900
the default Python is going to be Python 3 anyway?

00:04:41.900 --> 00:04:46.340
That would be sweet, wouldn't it? You know, all the stuff I've seen about it is like,

00:04:46.340 --> 00:04:48.900
it would be great, but it also caused a lot of problems.

00:04:48.900 --> 00:04:49.380
Yeah.

00:04:49.380 --> 00:04:54.740
We saw that Red Hat Enterprise Linux is actually moving away from having a Python command at all.

00:04:55.040 --> 00:04:59.560
So now it's either Python 3 or Python 2 and you have to be super explicit everywhere.

00:04:59.560 --> 00:05:06.900
So I would love to see that, but I don't see it. On my systems, Python means Python 3 because I've

00:05:06.900 --> 00:05:10.540
changed the path around. So that works that way, but not everywhere, you know?

00:05:10.700 --> 00:05:15.300
Yeah. You recently talked about this and a lot of other things on Talk Python, right?

00:05:15.300 --> 00:05:22.200
Yeah. I had Steve Dower come over onto Talk Python and talk about his retrospective of Python's

00:05:22.200 --> 00:05:28.080
journey at Microsoft, which is actually really interesting. It sort of matches the open source

00:05:28.080 --> 00:05:32.820
journey from a very closed source company to way more open source. And there's a lot of cool stuff

00:05:32.820 --> 00:05:36.880
going on there. They have a ton of core developers working at Microsoft, actually. It's pretty neat.

00:05:37.040 --> 00:05:39.140
Yeah. That was a really interesting conversation. I like that.

00:05:39.140 --> 00:05:44.400
Yeah. Thanks. So there is one limitation on the Windows Store version of Python that maybe is

00:05:44.400 --> 00:05:49.400
worth throwing out there while we're talking about it is they don't have full write access to shared

00:05:49.400 --> 00:05:55.580
locations, like for example, the registry or SQL and backslash program files or stuff like that.

00:05:55.580 --> 00:06:00.840
Right. So it's kind of only has access to your user profile stuff, you know, whatever you can do

00:06:00.840 --> 00:06:06.220
without raising your permissions at UAC stuff. So that's a limitation that you may run into

00:06:06.220 --> 00:06:11.580
because the Windows Store apps are more locked down than regular apps. But still, I think this is

00:06:11.580 --> 00:06:14.900
super cool. You can go and just say, hey, you don't need to be an admin. You just go to your

00:06:14.900 --> 00:06:19.120
Windows Store, you click this little button and you also have Python 3 as a command. It's quite nice.

00:06:19.120 --> 00:06:23.880
Can you write stuff that's outside of your little environment? Not write stuff, but read it.

00:06:23.880 --> 00:06:27.200
Yeah. I'm pretty sure you can. Like you could read the registry. I would think things like that,

00:06:27.200 --> 00:06:32.020
whatever you would be able to do without that little, this program would like to use admin rights.

00:06:32.020 --> 00:06:35.320
Yes, no dialogue pop-up. I suspect you'd be able to do. Yeah.

00:06:35.400 --> 00:06:38.440
I think that's a good idea anyway. So it's going to be in the App Store.

00:06:38.440 --> 00:06:44.360
Yeah, exactly. So, you know, I would actually love to see that on macOS, right? If Python 3 was an

00:06:44.360 --> 00:06:48.780
option on macOS, because the auto-updating feature is pretty cool. Like you just wake up one day and

00:06:48.780 --> 00:06:52.020
boom, you have the next version of Python. Of course, that could cause its own problems,

00:06:52.020 --> 00:06:53.080
but it wouldn't be bad.

00:06:53.080 --> 00:06:55.760
Python 5? What's that?

00:06:55.760 --> 00:06:59.840
Oh my goodness. It's amazing and nothing works anymore. What happened?

00:06:59.840 --> 00:07:04.220
No, that's pretty cool though. I'm happy to see it getting some serious attention over there.

00:07:04.320 --> 00:07:06.040
Yeah. Definitely. All right. Well, when's next?

00:07:06.040 --> 00:07:11.760
There's a project so new that it like came in in November this last year. It's a project called

00:07:11.760 --> 00:07:12.900
Bocadio.

00:07:12.900 --> 00:07:15.340
Yeah, that's how I would say it as well. Yeah. Bocadio.

00:07:15.340 --> 00:07:16.120
Yeah.

00:07:16.120 --> 00:07:16.700
Yeah, I think so.

00:07:16.700 --> 00:07:21.180
Tagline is a modern Python web framework filled with asynchronous salsa. But the,

00:07:21.180 --> 00:07:24.360
I'm not really going to talk about that. I'm going to talk about article that the,

00:07:24.360 --> 00:07:30.440
the maintainer, it's a four month banca wrote an article called how I built a Python web framework

00:07:30.440 --> 00:07:37.280
and became an open source maintainer. And it's this really fascinating article talking about pretty

00:07:37.280 --> 00:07:41.200
much what he went through. He knew that there were a lot of other web frameworks already,

00:07:41.200 --> 00:07:46.580
but he, he built this to try to learn the internals of how to build a web framework and then just did it in

00:07:46.580 --> 00:07:51.400
the open. But there's some really great advice. One of the things he credits from somebody else

00:07:51.400 --> 00:07:57.820
called Funky Bob is reinventing the wheel is an awesome way to learn. And sometimes what you learn

00:07:57.820 --> 00:08:02.660
is just how much are your existing frameworks are doing for you. I thought that was cool.

00:08:02.660 --> 00:08:03.300
That was very cool.

00:08:03.440 --> 00:08:09.040
This thing went from like just inception to building it, to putting up docs and getting

00:08:09.040 --> 00:08:15.040
extra maintainers in like the course of a month in November. And now it's, it's still going,

00:08:15.040 --> 00:08:20.920
but there's like one of the discussions in the article is talking about how he tried to put as

00:08:20.920 --> 00:08:26.760
much in the read me as possible right off the bat, like a change log and contributing guidelines and,

00:08:26.760 --> 00:08:32.840
and how to work it and everything. But the read me got huge. So he, that migrated to

00:08:32.840 --> 00:08:40.200
a GitHub pages, static site generator doc site. And then also one of the things is,

00:08:40.200 --> 00:08:45.380
he had all of his to do items of what he wanted to work on next in a Trello doc in Trello,

00:08:45.380 --> 00:08:50.180
but nobody else can see that. So he moved, Trello issues to GitHub issues.

00:08:50.180 --> 00:08:57.960
And this process of trying to make, do a new project in a way that is open and encouraging other

00:08:57.960 --> 00:09:01.660
people to help out. And then at the end of the article, it goes through, I'm not going to go through

00:09:01.660 --> 00:09:07.080
all of these, but there's a whole bunch of tips on what to do with the project to make it encourage

00:09:07.080 --> 00:09:12.700
other people to get involved. And this is like a goldmine of information for people wanting to start

00:09:12.700 --> 00:09:13.700
an open source project.

00:09:13.700 --> 00:09:18.420
Yeah. If you're thinking about an open source project or how to make it grow, there's, you're

00:09:18.420 --> 00:09:23.580
right. There is an incredible amount of tips. I mean, there's probably 45 specific things like

00:09:23.580 --> 00:09:26.660
this helps, this helps, this helps, right? So that's, that's really awesome.

00:09:27.280 --> 00:09:32.100
Yeah. If all this information at the bottom, he could have written, written a book on this.

00:09:32.100 --> 00:09:33.780
and maybe he will, but yeah, maybe he will.

00:09:33.780 --> 00:09:36.920
But thanks, Floremund for putting this together.

00:09:36.920 --> 00:09:41.660
Yeah, it looks great. And the framework looks pretty nice as well. I like it. I feel like a lot

00:09:41.660 --> 00:09:48.820
of these web frameworks are like slight derivatives of the Flask API. They seem to all be centering

00:09:48.820 --> 00:09:52.440
around Flask for some reason, but you know, Flask is pretty good. So that's cool.

00:09:52.440 --> 00:09:52.900
Yeah.

00:09:52.900 --> 00:09:56.640
Speaking of cool, I heard Kubernetes is cool. Kelsey Hightower told us it was,

00:09:56.640 --> 00:09:59.100
and definitely showed us a cool demo at a PyCon.

00:09:59.100 --> 00:10:00.960
Yeah. I believe anything Kelsey says.

00:10:00.960 --> 00:10:07.660
Yeah, for sure. So Kubernetes is a way to basically orchestrate containers, right? Often you don't want

00:10:07.660 --> 00:10:12.300
to run one container. You want to run multiple ones, one with a database, a couple of web front ends,

00:10:12.380 --> 00:10:18.960
things like that. And it's really nice way to like do zero downtime deployment on top of that and so on.

00:10:18.960 --> 00:10:25.140
So DigitalOcean, who's sponsoring the show, of course, has just officially publicly released,

00:10:25.140 --> 00:10:31.700
no longer preview status, their DigitalOcean Kubernetes service. So it's like a managed service

00:10:31.700 --> 00:10:39.140
and you can basically sign up for it and configure a Kubernetes cluster in a couple of seconds and

00:10:39.140 --> 00:10:45.920
provision it and log in within a couple of minutes. So it's super easy to scale. You take inbound traffic

00:10:45.920 --> 00:10:51.580
and just access your data over block storage, pass it through your load balancers. It's all great.

00:10:51.580 --> 00:10:59.860
So they also say they saw a 2.4 times, not percent, times better price to performance compared to other

00:10:59.860 --> 00:11:05.340
providers. So I can definitely believe that DigitalOcean is awesome. So anyway, if you're thinking about this,

00:11:05.340 --> 00:11:12.020
check them out at pythonbytes.fm/DigitalOcean, get $100 free credit for new users and try your hand at some

00:11:12.020 --> 00:11:19.100
Kubernetes clusters. Nice. Yeah, indeed. You could even probably, you know, serve up Bocadio on Kubernetes.

00:11:19.100 --> 00:11:26.300
That'd be fun. Yeah. Cool. Well, one thing that we talked about recently, and so this is a little bit of a

00:11:26.300 --> 00:11:30.660
follow-up is the maintainability score. Do you remember what we were talking about with the

00:11:30.660 --> 00:11:34.680
maintainability score? It was like a sub idea of something that we were covering recently.

00:11:34.680 --> 00:11:37.040
I totally remember, but I don't remember the main topic.

00:11:37.040 --> 00:11:41.180
I don't. It's always so many things we cover every week. But yeah, it's one of the projects and it was

00:11:41.180 --> 00:11:45.660
like, hey, this has a maintainability score of A. And we're like, wait, where did you get that score?

00:11:45.660 --> 00:11:51.040
So a friend of the show, Anthony Shaw sent over, you know, he's done this project called Wiley.

00:11:51.040 --> 00:11:52.680
Did you guys talk about it on your show?

00:11:52.680 --> 00:11:54.220
We talked about it briefly, yeah.

00:11:54.220 --> 00:12:02.080
Yeah. So Wiley is a Python app for tracking and reporting on timing and complexity and tests and

00:12:02.080 --> 00:12:07.940
things like that. So what you can do is you can point this at your project and tell it to analyze it

00:12:07.940 --> 00:12:13.360
and then generate a bunch of reports. And it has two types of reports that are relevant to this

00:12:13.360 --> 00:12:17.560
maintainability index. It has just a number, like a percentage, and I think higher is better there.

00:12:17.680 --> 00:12:24.860
And also it has a rank from like A to F, like a grade score on it. So you can run this against

00:12:24.860 --> 00:12:29.280
your code and ask it. And then you can even graph that kind of stuff over time. So it's getting,

00:12:29.280 --> 00:12:34.440
on the reports, it'll say, ah, it's lost some maintainability or it's gained some maintainability,

00:12:34.440 --> 00:12:35.600
which I thought was pretty cool.

00:12:35.600 --> 00:12:36.540
Yeah, that is cool.

00:12:36.540 --> 00:12:37.220
Yeah.

00:12:37.220 --> 00:12:42.760
So check out Anthony's project. I'll link to it, of course, in the show notes. And if

00:12:42.760 --> 00:12:49.520
you can see how well or not well Wiley thinks your app is doing. Even has a GitHub pre-commit hook,

00:12:49.520 --> 00:12:51.240
as all the cool things do these days.

00:12:51.240 --> 00:12:55.280
Yeah. That's a fairly new project too. Wiley's only been around for a couple,

00:12:55.280 --> 00:12:56.720
two, three months or something.

00:12:56.720 --> 00:12:59.780
Yeah, absolutely. It's pretty new. Would you say it's awesome?

00:12:59.780 --> 00:13:02.360
I would say it's awesome. I think so. Yeah.

00:13:02.360 --> 00:13:03.200
What else is awesome?

00:13:03.200 --> 00:13:07.200
I kind of like the awesome lists. So awesome lists, if you're not familiar with them,

00:13:07.200 --> 00:13:12.200
are, they're usually on GitHub, but they're basically, the readme is filled with links to

00:13:12.200 --> 00:13:17.520
a whole bunch of other, other projects of a particular type. There's two awesome lists that

00:13:17.520 --> 00:13:23.920
I came across recently. One of them is awesome Python security resources. And the other one is

00:13:23.920 --> 00:13:32.220
awesome Flake 8 extensions. So as far as security resources, it covers tools and education resources.

00:13:32.220 --> 00:13:34.020
And then a couple of companies also.

00:13:34.020 --> 00:13:39.380
The very first one that it has listed here is secure.py, which we talked about just I think last week or just recently.

00:13:39.380 --> 00:13:43.540
Yeah. And we've also, I think we've talked about Bandit also for static analysis.

00:13:43.540 --> 00:13:44.080
Yeah.

00:13:44.080 --> 00:13:49.840
Some of these we've talked about. And, and then I also, I really liked that it also included some education resources.

00:13:49.840 --> 00:13:52.280
If you want to learn more about security.

00:13:52.280 --> 00:13:52.700
For sure.

00:13:52.700 --> 00:13:56.040
For your software. So this is a nice place to go for security stuff.

00:13:56.240 --> 00:14:09.580
And then I like Flake 8 anyway, as just as a tool by itself for static code analysis. But I like that it has a plugin system with it. And so there's lots of different extensions to Flake 8.

00:14:09.580 --> 00:14:15.140
So Brian, for the couple of folks out there who don't know what Flake is, Flake 8 is, give them a quick, the elevator pitch.

00:14:15.140 --> 00:14:21.580
I don't know the elevator pitch. It's not PEP 8 anymore. It's like PyCode style or something like that.

00:14:21.580 --> 00:14:26.140
Yeah. It's a format, basically the formatting conventions of the language, right?

00:14:26.140 --> 00:14:33.360
Yeah. Flake 8 itself runs the checks for those, but it, and I think the 8 is because it checks a whole bunch of other things.

00:14:33.360 --> 00:14:40.540
What it does cyclical, some complexity algorithm and gosh, you're putting me on the spot here, man.

00:14:40.540 --> 00:14:45.840
No, no, that's close enough though. But so basically it analyzes the quality of your code, right? But it only does so much.

00:14:45.840 --> 00:14:51.120
But it's definitely a static analysis. It's just looking at, looking at it just without running it.

00:14:51.120 --> 00:14:53.180
So you found a couple of plugins for it?

00:14:53.180 --> 00:14:59.360
Yeah. The extensions, there's a whole bunch of them. There's some security ones that actually overlap.

00:14:59.360 --> 00:15:06.060
The other, the security resources in the previous list, if you can run them from Flake 8.

00:15:06.060 --> 00:15:11.620
So like the static analysis that's available for security, like Bandit, I think there's a Flake 8 Bandit.

00:15:11.620 --> 00:15:19.880
There's also a couple of my favorites are, this is interesting. There's a Flake 8 pytest extension that I want to try this.

00:15:19.880 --> 00:15:25.800
It doesn't actually run your pytest. What it does is it, it checks to make sure that you've got pytest style assertions.

00:15:25.800 --> 00:15:31.760
So one of the benefits of pytest is just regular assertions and not like the unit test stuff.

00:15:31.760 --> 00:15:38.900
If you've converted from unit test to pytest, you might still have some of those other assertions laying around in this one.

00:15:38.960 --> 00:15:39.900
I'll try to get rid of those.

00:15:39.900 --> 00:15:50.780
Yeah. One that pops out to me is like Flake 8 dash docstrings, which actually checks the docstring code for you, which is pretty awesome.

00:15:50.780 --> 00:15:55.180
Validates this restructured text of your documentation. That's sweet.

00:15:55.180 --> 00:15:56.080
Oh, that's nice. Yeah.

00:15:56.080 --> 00:15:56.700
Yeah.

00:15:56.980 --> 00:15:58.440
So there's just so many in here.

00:15:58.440 --> 00:16:05.420
Yeah. And there was, I didn't write this one down. There was one that like checks for, it checks to make sure that you're not mocking things that didn't exist.

00:16:05.620 --> 00:16:12.980
So the point of mock is to fake out existing functionality so that you do something different.

00:16:12.980 --> 00:16:21.340
One of the things that you can muck up with is you can be mocking the wrong function name and it'll work just fine in your tests.

00:16:21.340 --> 00:16:22.620
Your code won't run.

00:16:23.020 --> 00:16:28.220
This plugin will check to make sure that you're mocking real existing methods and not made up methods.

00:16:28.220 --> 00:16:31.140
Yeah. Cool. Well, these are great. These are awesome finds, right?

00:16:31.140 --> 00:16:31.580
Yeah.

00:16:31.580 --> 00:16:38.000
Another thing that's awesome is logging. So remember a couple of weeks ago, we talked about Log Guru?

00:16:38.000 --> 00:16:38.800
Yeah.

00:16:38.800 --> 00:16:40.340
Log Guru? Log Guru? We don't know.

00:16:40.340 --> 00:16:40.880
Log Guru.

00:16:40.880 --> 00:16:44.280
We'll just try all the variations until one of them hits, I'm guessing.

00:16:44.280 --> 00:16:46.040
And of course, just kind of-

00:16:46.040 --> 00:16:47.080
I think it rhymes with kangaroo.

00:16:47.080 --> 00:16:52.660
It does. And so just like when we talked about GUI frameworks, we're like, oh,

00:16:52.660 --> 00:16:55.600
here's like a couple of them. And just people are like, oh, and did you know? Did you know?

00:16:55.600 --> 00:17:00.840
So here's another really cool logging framework that Robert Young sent over to us to say, oh,

00:17:00.840 --> 00:17:03.200
you talked about Log Guru. You should definitely check this out.

00:17:03.200 --> 00:17:05.660
So this is called Fast Logging.

00:17:05.660 --> 00:17:11.720
So Fast Logging is a replacement for the standard logging module, and it's mostly compatible,

00:17:11.720 --> 00:17:15.860
which is pretty cool. But would you guess from the name that it's faster?

00:17:15.860 --> 00:17:16.900
I should hope so.

00:17:16.900 --> 00:17:21.920
So basically the point is logging can be kind of slow, it turns out, in the standard logging module.

00:17:22.300 --> 00:17:28.320
But this one is faster. And not just like 20% faster, it's like five times faster for a regular

00:17:28.320 --> 00:17:32.300
file. And if you're doing rotating log files, it's actually about 13 times faster.

00:17:32.300 --> 00:17:36.420
So if you're doing a lot of logging and it's turning, basically the logging is slowing down

00:17:36.420 --> 00:17:38.020
your app, think about fast logging.

00:17:38.020 --> 00:17:39.120
Yeah. Nice.

00:17:39.280 --> 00:17:45.120
Yeah. And it has a bunch of cool features. So like if you install Colorama, which is a great

00:17:45.120 --> 00:17:51.240
color way to do output on the console, it'll actually do colored logging when it's logging

00:17:51.240 --> 00:17:57.360
to print, you know, standard out. You can set the maximum file size and rotating a lot of

00:17:57.360 --> 00:18:03.420
options on the rotating stuff. It'll also like Log Guru compress the older file, older log

00:18:03.420 --> 00:18:08.220
files, which can be 10x or more savings. Like those log files compress really, really well.

00:18:08.220 --> 00:18:13.860
You can do like only log every so often based on domains, different files, like all sorts of

00:18:13.860 --> 00:18:19.280
stuff. You get callbacks. One thing that's kind of cool is it'll do logging on background threads

00:18:19.280 --> 00:18:24.380
per file, which is pretty cool if you configure it. So if you're like, I want to log this stuff,

00:18:24.440 --> 00:18:29.920
but I know that might slow down my app and I don't want any slowdown. So this will basically

00:18:29.920 --> 00:18:34.880
push it off to a background thread, which will eventually pick it up and write it. So you can

00:18:34.880 --> 00:18:39.220
get, keep stuff flowing right along, maybe in a web request or something like that. It's pretty cool.

00:18:39.220 --> 00:18:40.640
Yeah. Yeah. Very nice.

00:18:40.640 --> 00:18:42.900
Yeah. So thanks Robert for sending that in. That's a good one.

00:18:42.900 --> 00:18:46.080
Brian, that's it for our official items. Got anything else?

00:18:46.080 --> 00:18:46.880
I actually don't.

00:18:46.880 --> 00:18:48.960
Nope. All right. Right on.

00:18:48.960 --> 00:18:49.380
How about you?

00:18:49.380 --> 00:18:53.960
Well, I have two things that I'd like to just throw out there really quick. First of all,

00:18:53.960 --> 00:19:00.840
I'm doing a live webcast, but also be recorded over on January 24th at 11 AM Pacific time,

00:19:00.840 --> 00:19:07.420
basically working and showing async and await in Python and building a little app that uses that.

00:19:07.420 --> 00:19:11.980
So if you got a free hour and you want to drop in, check that out, put the links in the show notes

00:19:11.980 --> 00:19:19.340
there. And we already talked about Anthony Shaw and his Wiley, but he also sent over a heads up,

00:19:19.340 --> 00:19:27.060
which I also got from GitHub to watch your YAML. YAML apparently had some pretty decent security

00:19:27.060 --> 00:19:31.840
vulnerability. Like, I don't know how many people know, but you can actually just straight up execute

00:19:31.840 --> 00:19:38.640
arbitrary Python code in a YAML file. That's bad, right? So like, yeah. So, Hey, upload your

00:19:38.640 --> 00:19:42.240
configuration file and we'll just run it for you. And like the configuration file is like,

00:19:42.760 --> 00:19:50.180
username is this password is that database format is this bang Python format, the system or do other

00:19:50.180 --> 00:19:56.800
bad things. Right? Like it was really crazy that the YAML format just lets you embed code into what

00:19:56.800 --> 00:20:01.340
is otherwise supposed to be a static file. All right. So the warning is that you're supposed to use,

00:20:01.340 --> 00:20:07.300
what's it called? Safe underscore load instead of load, but they've fixed some stuff to make that

00:20:07.300 --> 00:20:11.900
basically make that more obvious. And with a new version of PyYAML. So if you're using PyYAML,

00:20:11.900 --> 00:20:17.160
GitHub will give you a warning about this. Anyway, it seems like it could actually have a lot of

00:20:17.160 --> 00:20:21.700
consequences if you don't update that. So check that out. Yeah. But also if you're using PyYAML,

00:20:21.700 --> 00:20:27.140
updating to the newest version should fix that, right? Yes, you should. But what's weird is we talked

00:20:27.140 --> 00:20:33.840
about zero for the way you fix the PyYAML problem is you take a, an official, like, I'm just messing with it,

00:20:33.840 --> 00:20:39.980
like 1.3 release and you upgrade it to a beta release. So it's like, so you have to install

00:20:39.980 --> 00:20:44.200
the beta version to not have the security problem, which I don't know, take that for what it is.

00:20:44.200 --> 00:20:49.400
Yeah. Okay. Come on, PyYAML people. That's right. All right. Do you have a joke for us this week?

00:20:49.400 --> 00:20:55.000
I don't. All right. I have a joke. This is an oldie, but a goodie. It's about Python,

00:20:55.000 --> 00:21:00.860
which is pretty sweet. So if you're out there and you type Python on your terminal command prompt,

00:21:00.860 --> 00:21:05.880
and then you just import anti-gravity, like the command, right? Import anti-gravity.

00:21:05.880 --> 00:21:10.940
It turns out, have you done this, Brian, before? Yeah, but it's good to bring it up because some

00:21:10.940 --> 00:21:14.360
people don't know about it. Yeah, exactly. This is one of the better things built into the Python

00:21:14.360 --> 00:21:21.080
repo, honestly. And so what it does is it actually opens up an XKCD comic, which is a great joke

00:21:21.080 --> 00:21:27.660
about Python's packages and libraries. So there's a picture, there's a stick figure flying up in the air

00:21:27.660 --> 00:21:34.240
and the stick figure on the ground, obviously amazement on his blank face, stick face says,

00:21:34.240 --> 00:21:40.100
how are you flying? Python. I just learned it last night. Everything's so simple. Hello world is

00:21:40.100 --> 00:21:45.260
just print. Hello world. The guy on the ground says, I don't know. Dynamic typing, white space.

00:21:45.260 --> 00:21:49.900
Guy in the air says, come on, join us. Programming is fun again. It's a whole new world up here,

00:21:49.900 --> 00:21:55.800
but how are you flying? I just typed import anti-gravity. That's it. I also sampled everything

00:21:55.800 --> 00:22:01.180
in the medicine cabinet for comparison, but I think it's the Python. It's a good, it's a little bit

00:22:01.180 --> 00:22:05.740
of goody, right? Yeah. Yeah. And while you're playing on the command line, it's not a joke,

00:22:05.740 --> 00:22:12.660
but import this. It's another hidden Easter egg, not very hidden, but that it'll show you the Zen of

00:22:12.660 --> 00:22:16.800
Python. Yep. That's awesome. I'm going to save another import joke that you can do on the terminal

00:22:16.800 --> 00:22:22.260
or in the REPL for next time or time after. Okay. But yeah, it's, I really love it that

00:22:22.260 --> 00:22:27.440
these kinds of jokes and humorous things are built in there. It's not like Python has been sterilized of

00:22:27.440 --> 00:22:34.820
all humanity. Yeah. And anti-gravity connects Python with XKCD, which is kind of neat. And one of the

00:22:34.820 --> 00:22:40.520
things I like, I can't remember where to get these, but one of the things I like about XKCD is they often

00:22:40.520 --> 00:22:45.420
talk about things that you might not know about. There's another place that I can't remember where

00:22:45.420 --> 00:22:51.060
it discusses like why it's funny. So you can read about things you don't know about. Yeah, absolutely.

00:22:51.060 --> 00:22:56.340
Absolutely. Well, thanks for recording this week. You bet. It's always fun and I always learn something.

00:22:56.340 --> 00:23:00.880
So thanks a bunch. Bye. Thank you for listening to Python Bytes. Follow the show on Twitter via

00:23:00.880 --> 00:23:08.360
at Python Bytes. That's Python Bytes as in B-Y-T-E-S. And get the full show notes at pythonbytes.fm.

00:23:08.360 --> 00:23:12.980
If you have a news item you want featured, just visit pythonbytes.fm and send it our way. We're

00:23:12.980 --> 00:23:17.560
always on the lookout for sharing something cool. On behalf of myself and Brian Okken,

00:23:17.560 --> 00:23:22.300
this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and colleagues.

