WEBVTT

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

00:00:04.640 --> 00:00:11.180
your earbuds. This is episode 133, recorded May 30th, 2019. I'm Michael Kennedy. And I'm Brian

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

00:00:14.860 --> 00:00:20.560
slash DigitalOcean. More on that later. Brian, how you been? I'm doing well. How about you? I am

00:00:20.560 --> 00:00:26.960
as well. The summer is here. The weather is nice. Getting to finally emerge from being stuck by the

00:00:26.960 --> 00:00:32.120
rain inside for all these years or all these months, I guess, in Portland. So very, very happy.

00:00:32.120 --> 00:00:36.260
Everyone's got a little bit of a smile from the weather, I think. Yeah, definitely. It's nice.

00:00:36.260 --> 00:00:41.720
You know what I think also might make you smile is knowing that a bunch of cool features are already

00:00:41.720 --> 00:00:46.500
included in Python before you have to even go grab a library. Yep. There are a whole bunch of built-ins.

00:00:46.500 --> 00:00:54.020
And I'm highlighting an article from Trey Hunter called Python Built-ins Worth Learning. And this

00:00:54.020 --> 00:01:00.940
comes from, he does a lot of training new people into Python. And some people sometimes feel a little

00:01:00.940 --> 00:01:06.920
overwhelmed about all the stuff they need to learn. This is an interesting quote he has. He said there's

00:01:06.920 --> 00:01:13.140
69 built-in keywords or built-in functions with Python. There's more keywords. But anyway,

00:01:13.140 --> 00:01:19.680
he said he estimates that most developers only need about 30 of them. But the 30 that you need is

00:01:19.680 --> 00:01:25.700
different depending on what you're doing. And I think that's probably fair. So he split all of these

00:01:25.700 --> 00:01:33.060
69 keywords into a bunch of categories. I guess there's five categories. Commonly known, overlooked

00:01:33.060 --> 00:01:40.200
by beginners, learn it later, and maybe learn it eventually. And you'll likely not need these.

00:01:40.200 --> 00:01:45.340
And for the most part, I agreed with him. And I think it's kind of a fun thing to look at,

00:01:45.460 --> 00:01:49.900
especially somebody new to the language, or if you're helping somebody out. I'm not going to go

00:01:49.900 --> 00:01:54.720
through the entire list. It's a big list. But I wanted to highlight a couple of them. The ones that

00:01:54.720 --> 00:02:05.020
he said are often overlooked by beginners are sum, enumerate, zip, bool, reversed, sorted, min, max,

00:02:05.020 --> 00:02:11.200
any, and all. And of those, I think people will figure out that there's probably a way to do this. But

00:02:11.200 --> 00:02:16.500
the zip feature is something that people don't get right away. And so practicing that a little bit is

00:02:16.500 --> 00:02:19.860
good. Enumerate also, but be careful.

00:02:19.860 --> 00:02:23.340
Yeah. Enumerate stands out as like a super important one.

00:02:23.340 --> 00:02:24.260
Yeah.

00:02:24.260 --> 00:02:30.320
You can have a lot of non-Pythonic patterns. Like if I want to do a loop over some collection,

00:02:30.320 --> 00:02:34.900
and I want to print out like, number one is this, number two is that, kind of like generating this

00:02:34.900 --> 00:02:40.020
ordered list that he has right here on his article, right? You might go, well, the foreign loop doesn't

00:02:40.020 --> 00:02:43.940
work because I don't get the index or, you know, whatever, right? There's a bunch of nice little

00:02:43.940 --> 00:02:45.840
cases where enumerate really, really helps.

00:02:45.840 --> 00:02:50.540
Yeah. And there's a good list for somebody to read through. He's also got descriptions of all of

00:02:50.540 --> 00:02:54.760
them. It's a fairly lengthy article, but it reads pretty quick. All the stuff you already know,

00:02:54.760 --> 00:03:00.760
you'll just skim past and the stuff that you don't stands out. I didn't know about any and all at first

00:03:00.760 --> 00:03:07.440
for if there's any values in a list that are true or making sure that all of them are true. Those

00:03:07.440 --> 00:03:13.380
sometimes are useful. And then I wanted to jump to a little bit. There's in his category of learn it

00:03:13.380 --> 00:03:19.240
later, there's a bunch of them, but one of the things in there is a get attr for get attribute.

00:03:19.240 --> 00:03:24.460
I kind of disagree. I think that you ought to learn that a little bit earlier because the behavior of

00:03:24.460 --> 00:03:30.000
getting an attribute and then defaulting to a different value is very important and it's hard

00:03:30.000 --> 00:03:35.240
to do otherwise. Yeah. If you're going to get an attribute of an object and it might not have that

00:03:35.240 --> 00:03:43.660
attribute, but you know what value you want anyway, get attr is great. Yeah. I like using overloading get

00:03:43.660 --> 00:03:50.160
attr for basically nicer dictionaries, maybe with default values. So we have default dict and we have

00:03:50.160 --> 00:03:55.820
some other things like regular dicks and so on. But if you want to kind of treat them like JavaScript

00:03:55.820 --> 00:04:02.640
type of objects where you can just say object dot value, right? You can't do that with normal

00:04:02.640 --> 00:04:06.660
dictionaries and even with default dictionaries, you can't make it give the default value. But if you

00:04:06.660 --> 00:04:13.680
say derive from like dictionary, but then also implement get attr, you could actually add it. So it has that

00:04:13.680 --> 00:04:19.680
nice little cleaner syntax, I think. Yeah, you can. I often just use dictionaries, but then I use the get

00:04:19.680 --> 00:04:25.340
accessor. Yeah, exactly. You can get a default for. Yeah, cool. So this is a good one. I definitely

00:04:25.340 --> 00:04:29.580
think it's worth skimming over. Even as somebody who's not a beginner, it's kind of like, all right,

00:04:29.580 --> 00:04:35.380
well, here, let's try this. So here's the ones I likely don't need or maybe I don't really know.

00:04:35.380 --> 00:04:40.140
Let me go through and see what I know. Well, there's round. I know that one. There's abs and hash

00:04:40.140 --> 00:04:44.760
and objects. Okay, all those. Oh, wait, there's div mod. What is div mod? And for example, right?

00:04:44.760 --> 00:04:47.940
So it's kind of fun to just go through and see which ones like you do know, because there's

00:04:47.940 --> 00:04:52.260
certainly some I don't. Yeah. And it's also I think it's a fun article for people to bookmark. And it's

00:04:52.260 --> 00:04:57.180
just as they're learning, come back to every couple months and learn something new. Yeah, absolutely.

00:04:57.180 --> 00:05:03.460
So a while ago, Brian, we spoke about GitHub being acquired by Microsoft. And that actually

00:05:03.460 --> 00:05:09.560
created quite the kerfuffle. A lot of folks saw that as like an ominous sign.

00:05:09.560 --> 00:05:16.500
I personally didn't see it that dark. I thought it was actually kind of a mixed bag. But and looking

00:05:16.500 --> 00:05:20.980
more into it, like the state of GitHub, I feel like this is a probably a pretty positive thing in the

00:05:20.980 --> 00:05:26.020
end. Right? Do you remember that? Yeah, we're starting to see consequences, outcomes, benefits,

00:05:26.020 --> 00:05:31.080
however you want to perceive this next round of announcements. But there's actually two announcements

00:05:31.080 --> 00:05:38.400
that I'm gonna highlight in the show about that. And the first one is I think is really cool. So for

00:05:38.400 --> 00:05:42.400
example, we have a Patreon for Python bytes. And the way that works is people can say how I would like

00:05:42.400 --> 00:05:46.260
to support you guys doing this will donate a dollar to a month, whatever, right? Something small like

00:05:46.260 --> 00:05:53.640
that. And there's been a lot of failed attempts for this in open source. So like, hey, on my open source,

00:05:53.640 --> 00:06:00.620
read the docs, I'm going to put a PayPal button says donate. And it probably reaped like a massive $39

00:06:00.620 --> 00:06:06.440
that year or something, right? Like it just, it's not a way in which people do those types of things.

00:06:06.440 --> 00:06:12.680
But I think Patreon legitimately works, right? At least for folks who are really like creators are

00:06:12.680 --> 00:06:18.240
really like focused on that. I've seen some really successful people there. So GitHub has just launched

00:06:18.240 --> 00:06:22.960
this thing called sponsors. Have you heard of this? Yeah, and I'm pretty excited about it. I'm pretty

00:06:22.960 --> 00:06:28.900
excited about it too. And first, when I first heard the news, I thought, okay, GitHub sponsors is a way to

00:06:28.900 --> 00:06:35.040
sponsor open source projects. So maybe I'm a big fan of Flask. So I go to Flask, and I can give money

00:06:35.040 --> 00:06:39.900
to them. Or maybe I'd like to see Pyramid doing more. So I'll go donate some money to Pyramid or

00:06:39.900 --> 00:06:45.920
something like that. But it turns out it is like this Patreon model for GitHub. But it's not just for

00:06:45.920 --> 00:06:51.140
projects. It's also for people, which I thought was pretty cool. So anyone who contributes to open

00:06:51.140 --> 00:06:56.700
source, whether through code, documentation, leadership, mentorship, design is eligible to be sponsored.

00:06:56.700 --> 00:07:00.040
Yeah, that's pretty cool. Is it like a beta or something?

00:07:00.040 --> 00:07:04.800
You can't just go sign up. You've got to like, request early access, or I don't know what the

00:07:04.800 --> 00:07:08.360
terminology they used there was. But yeah, it's not fully open, but it's getting started.

00:07:08.360 --> 00:07:12.540
There's also some things about their matching funds and the fees.

00:07:12.540 --> 00:07:17.540
Yeah, that's pretty sweet. So they said there will be no fees charged. All right, like Patreon,

00:07:17.540 --> 00:07:23.140
I don't know what they take like 7%, 10%, something like that, to run Patreon as part of what they

00:07:23.140 --> 00:07:28.240
donate. So GitHub says 100% of the fees go to developers or 100% of the money that's given

00:07:28.240 --> 00:07:33.700
goes to developers. There's no fees other than credit card fees, which like the world just has

00:07:33.700 --> 00:07:41.360
to accept 3% on all transactions, apparently. But I believe there's a little like star in the first

00:07:41.360 --> 00:07:46.900
year or something like that. Like, I don't think that's a permanent thing. Also, a little star in the

00:07:46.900 --> 00:07:51.940
first year, maybe not the first year of the program, but first year of your sponsorship is

00:07:51.940 --> 00:07:57.680
GitHub will match. So suppose you get $6,000. No, that's not. Yeah, let's suppose you get $6,000.

00:07:57.680 --> 00:08:02.740
GitHub will match up to $5,000 of whatever you've gotten. So you would actually get $11,000 in

00:08:02.740 --> 00:08:03.540
contributions that year.

00:08:03.540 --> 00:08:09.580
That's really cool. And it also encourages people to even donate a small amount to a developer that

00:08:09.580 --> 00:08:15.360
they depend on because they know that that money is going to get doubled. So that's pretty cool.

00:08:15.460 --> 00:08:19.620
Yeah, I'm pretty excited about this. I think we need to wait till it becomes a little more public.

00:08:19.620 --> 00:08:24.460
I haven't seen anywhere I can go sponsor somebody. It's more like, hey, sign up. And I think they're

00:08:24.460 --> 00:08:29.240
building the list of people to be sponsored. But yeah, this is super cool news. And I'm excited

00:08:29.240 --> 00:08:35.100
about it. I wonder how this will, if this will make open source even more viable in countries that

00:08:35.100 --> 00:08:40.940
don't have the same cost of living, but also not the same income levels as say the US and Europe,

00:08:41.300 --> 00:08:45.460
right? Like the Western world, right? So if I live somewhere where the average monthly income

00:08:45.460 --> 00:08:52.060
is 500 bucks, if I can get 500 bucks in contributions on GitHub, right? Maybe that's like a better way to

00:08:52.060 --> 00:08:54.320
spend my time. I don't know. It could be really interesting there.

00:08:54.320 --> 00:09:00.440
Yeah, there should probably be like a list of Python people that are available for this so we could find

00:09:00.440 --> 00:09:00.920
them or something.

00:09:01.040 --> 00:09:05.200
Yeah, it'd be really cool if like, if there's some kind of list or some people could maybe send it in

00:09:05.200 --> 00:09:07.500
or put it in the comments or something. That would be great.

00:09:07.500 --> 00:09:08.020
Yeah, cool.

00:09:08.020 --> 00:09:08.980
Yeah, what's next, Brian?

00:09:08.980 --> 00:09:14.640
One of the things I wanted to do is play with some REST frameworks. And so I ran across this article

00:09:14.640 --> 00:09:24.560
called Build a REST API in 30 minutes with Django REST framework. And it sounds like it'll fit within my

00:09:25.040 --> 00:09:31.100
within my lunch break. So this is nice. So it's Bennett Garner. And it includes like from the very

00:09:31.100 --> 00:09:36.880
beginning, setting up a virtual environment, setting up Django, then creating a model in a database with

00:09:36.880 --> 00:09:41.100
the Django ORM. Is it ORM or ORM? How do people normally say that?

00:09:41.240 --> 00:09:46.320
I think it goes either way, like SQL and SQL. But I think I think ORM is a little more popular,

00:09:46.320 --> 00:09:48.900
at least in the spaces I've heard people talk about.

00:09:48.900 --> 00:09:55.180
And then setting up installing and setting up Django REST framework, and then serializing the model.

00:09:55.180 --> 00:10:00.180
Okay, I see. I haven't read the article yet completely. So I'm not sure what this means.

00:10:00.180 --> 00:10:06.720
But then creating URI endpoints, is that universal resource? I don't know what that is,

00:10:06.760 --> 00:10:10.760
and how to serialize the data. But it's got pretty pictures. And it goes through it in a

00:10:10.760 --> 00:10:15.940
little example of a hero database with a hero name and alias. So it's a fairly simple toy model.

00:10:15.940 --> 00:10:19.880
But I'm going to use it to try to learn Django REST framework rather quickly.

00:10:19.880 --> 00:10:23.720
Yeah, that's cool. Yeah, Django REST framework looks nice. I haven't done a whole lot with it. But

00:10:23.720 --> 00:10:28.160
it definitely seems nice. And this is a really good introduction. So well done, Bennett.

00:10:28.160 --> 00:10:33.280
Speaking of well done, before we move on to the next news about GitHub, let me just tell you

00:10:33.280 --> 00:10:37.800
a little bit more about DigitalOcean. So DigitalOcean has now made their Kubernetes,

00:10:37.800 --> 00:10:44.360
their managed Kubernetes cluster generally available. So if you're trying to do Docker and containers and

00:10:44.360 --> 00:10:49.400
basically run your containers in production, Kubernetes is a super good option for that.

00:10:49.400 --> 00:10:54.580
And so all you got to do is go over to DigitalOcean, sign up, fire up their cluster,

00:10:54.580 --> 00:10:58.140
and it'll, you know, within a minute or two, you'll have your cluster up and running.

00:10:58.140 --> 00:11:03.400
And you could just start issuing Kubernetes commands to it, running your containers over

00:11:03.400 --> 00:11:07.020
there and get your stuff all working. So definitely give that a shot. Check them out at

00:11:07.020 --> 00:11:13.580
pythonbytes.fm/DigitalOcean. Get a $50 credit for new users. So help support the show. And

00:11:13.580 --> 00:11:18.260
they're doing good stuff. We can definitely recommend it. I told you I have two pieces of news on GitHub.

00:11:18.520 --> 00:11:22.520
And the second one is that, have you heard of Dependabot?

00:11:22.520 --> 00:11:23.380
I have not.

00:11:23.380 --> 00:11:32.520
So Dependabot is interesting. The idea is that most open source stuff is built upon layers and layers

00:11:32.520 --> 00:11:40.280
and layers of little libraries, right? In Python, we have PyPI. And if you pip install a thing,

00:11:40.280 --> 00:11:45.440
you know, that thing may pip install three other things as dependencies, and those may have two other

00:11:45.440 --> 00:11:49.940
ones, right? So if I pip install requests, it's going to install even like five or six other

00:11:49.940 --> 00:11:56.240
little things that it needs to do its job, for example, right? So knowing, is there some kind

00:11:56.240 --> 00:12:01.140
of security problem? Or is there even just a new version that maybe I would like to have of that

00:12:01.140 --> 00:12:06.760
would be really nice to know, right? If I could say somehow put it in my requirements files, you know,

00:12:06.760 --> 00:12:11.380
pin the versions in your requirement files, which is a good idea for apps, maybe not for libraries,

00:12:11.380 --> 00:12:16.020
but definitely for apps. So say, these are the versions I'm working with in my website,

00:12:16.020 --> 00:12:21.160
or whatever. If GitHub could say, hey, you know, there's a new version of the Stripe API,

00:12:21.160 --> 00:12:27.240
the Stripe package, and here's its changes, and help us automatically upgrade to that. That would be

00:12:27.240 --> 00:12:28.060
super cool. Yeah.

00:12:28.060 --> 00:12:33.060
So that's basically what Dependabot does. It looks at your requirements. And it's not believe it's not

00:12:33.060 --> 00:12:37.500
just for Python, like it could look at your npm for your static JavaScript and all that kind of stuff,

00:12:37.500 --> 00:12:43.020
right? So sort of spanning all the different dependencies that you might have across even

00:12:43.020 --> 00:12:48.680
programming languages, you could say, hey, this week, there's a whole bunch of changes, and it will

00:12:48.680 --> 00:12:54.120
actually create a pull request. So check for updates, then it'll create a pull request for stuff that's

00:12:54.120 --> 00:12:59.640
out of date, individual pull requests for each dependency, right? That's kind of cool, I guess,

00:12:59.640 --> 00:13:04.360
if you can just check them all off. And then basically, that should trigger your CI, right,

00:13:04.360 --> 00:13:09.100
as it does for normal PRs, verify everything's working, you can check that in, accept, you know,

00:13:09.100 --> 00:13:11.200
merge it, and keep rolling. So that's pretty cool, huh?

00:13:11.200 --> 00:13:16.160
Yeah, definitely. If you got your CI set up to test all merge requests, then it'll just go ahead and

00:13:16.160 --> 00:13:17.760
run your tests against it, make sure that...

00:13:17.760 --> 00:13:21.840
Right, right. And probably the first step of your test is to create a virtual environment and pip install

00:13:21.840 --> 00:13:26.260
the requirements, or npm in it, or npm install them, or whatever you're going to do, right?

00:13:26.260 --> 00:13:31.700
So that's all good. What does this have to do with GitHub? Well, GitHub has now bought Dependabot,

00:13:31.700 --> 00:13:35.840
which used to be a commercial paid service. And now it's a free service of GitHub.

00:13:35.840 --> 00:13:37.400
Yeah, that's actually pretty cool.

00:13:37.400 --> 00:13:42.080
Yeah, so I think it's pretty awesome. Basically said, if you already have an account at Dependabot,

00:13:42.080 --> 00:13:47.600
well, that's free. And if you're not using it, you should definitely think about something to this

00:13:47.600 --> 00:13:53.080
effect, right? Think about using something like this. Because I use something called PyUp at pyup.io.

00:13:53.320 --> 00:13:59.560
And it's been around a little more Python focused since maybe even before Dependabot. And I definitely

00:13:59.560 --> 00:14:04.420
like it. I'm not sure what this announcement means for it. It could be negative news for the PyUp folks,

00:14:04.420 --> 00:14:10.220
I would imagine. But the service that both of these are providing is really valuable. Like on Monday

00:14:10.220 --> 00:14:15.200
mornings, I wake up, I go check my email, and I see all the changes. Sometimes they're super minor,

00:14:15.200 --> 00:14:20.320
like Bodo Core has been updated. Like, okay, I don't really care that much, but I guess I'll accept that,

00:14:20.320 --> 00:14:24.800
right? But other times, there's been some bug fixed, or there was a security vulnerability that's

00:14:24.800 --> 00:14:27.960
been fixed, and it's really helpful. So just, you know, you get in the habit of just like,

00:14:27.960 --> 00:14:32.600
accepting the merge, the pull requests once a week or whatever, and it's good.

00:14:32.600 --> 00:14:39.120
As you said, as they're coming in one at a time, and you're accepting them, if something goes through

00:14:39.120 --> 00:14:42.100
and starts breaking stuff, you can roll back pretty easily.

00:14:42.100 --> 00:14:46.800
Yeah, yeah, absolutely. And then like, yeah, the act of actually quickly rolling back is just to like,

00:14:48.380 --> 00:14:54.480
requirements.txt, or the pyproject.toml, or whatever it is, right? It's a minor, minor change.

00:14:54.480 --> 00:15:01.280
Cool. So we've talked a lot about legacy Python, modern Python, Python 2 versus Python 3. We've

00:15:01.280 --> 00:15:03.820
kind of moved beyond that debate, or have we?

00:15:03.820 --> 00:15:10.140
Well, I don't know. I was wondering, questioning whether it was too painful still, but you know,

00:15:10.140 --> 00:15:16.600
the transition's been going on for a while, so I think it's okay to joke about it. And I think it's

00:15:16.600 --> 00:15:24.980
a guy named Charles Leifer. He's the person behind the PeeWee ORM, but he wrote an article called

00:15:24.980 --> 00:15:32.460
New Features Plan for Python 4.0. And this is totally a spoof article. It's not real,

00:15:32.460 --> 00:15:38.120
but it's funny, and it made me laugh. So one of my favorites, I just pulled out a few of the favorites.

00:15:38.120 --> 00:15:42.780
He has a long list of things that are humorously going in 4.0 that are not really.

00:15:43.080 --> 00:15:49.940
So PEP 8 has been updated. There's the long, or will be updated, the long debate between whether

00:15:49.940 --> 00:15:55.280
or not you should have 79 characters or 100 characters. They're compromising at 89.5.

00:15:55.280 --> 00:16:02.140
Nice. You can only put skinny characters on the last part, like an exclamation or a dot,

00:16:02.140 --> 00:16:03.960
but definitely not like a zero.

00:16:04.200 --> 00:16:07.100
Yeah. No. Or capital Z. You can't do that.

00:16:07.100 --> 00:16:07.440
Nope.

00:16:07.440 --> 00:16:13.160
So all new libraries and standard lib modules must include the phrase for humans somewhere

00:16:13.160 --> 00:16:13.760
in their title.

00:16:13.760 --> 00:16:15.300
I agree.

00:16:15.300 --> 00:16:20.440
Type hinting has been extended to provide even fewer tangible benefits and will be called

00:16:20.440 --> 00:16:21.380
type whispering.

00:16:21.380 --> 00:16:24.300
I do like that name.

00:16:24.300 --> 00:16:29.260
And you can make stuff go faster by adding async before every other keyword, including

00:16:29.260 --> 00:16:34.540
if, when, if, and all those things. You can just add async before everything. It'll make

00:16:34.540 --> 00:16:42.700
it go faster. And then notable items left out of 4.0, still no switch statement, and absolutely

00:16:42.700 --> 00:16:44.020
no improvements to packaging.

00:16:44.020 --> 00:16:49.160
That's pretty funny. I like it. I like it. Yeah, that's a good article.

00:16:49.160 --> 00:16:49.560
Yeah.

00:16:49.560 --> 00:16:50.100
I don't know.

00:16:50.100 --> 00:16:51.560
89 and type whispering.

00:16:51.560 --> 00:16:53.500
Type whispering is pretty sweet.

00:16:53.500 --> 00:16:58.620
All right. So last item I want to cover for us today is something called black sheep.

00:16:58.620 --> 00:17:05.600
Now, I felt like for a long time, like the web framework story in Python was fairly stable.

00:17:05.600 --> 00:17:10.840
Django, flask, pyramid, some of the other stuff, bottle, and a few things had kind of been around

00:17:10.840 --> 00:17:18.340
and they, they were kind of doing their thing. But this whole need for modern asynchronous framework

00:17:18.900 --> 00:17:26.720
involving say maybe type hinting for validation or the async keyword has just like unleashed all these

00:17:26.720 --> 00:17:32.360
little web frameworks, right? So we've got molten, Sanic, Jepronto, a whole bunch of others,

00:17:32.360 --> 00:17:39.020
API star. Well, there's another one called black sheep that is here and people can check that one out.

00:17:39.020 --> 00:17:54.300
So black sheep looks pretty cool. It is a fast HTTP server and client micro framework. So it has both the server side and the client side. So it's both like trying to be kind of a replacement for flask, but also for requests.

00:17:54.300 --> 00:18:16.060
Okay. Yeah. And it's built on asyncio and Cython, which we talked about last week, uv loop and HTTP tools. So it's kind of bringing in a lot of good stuff. And one of the things you'll notice really quickly when you work with it is it's flask like, like, and I, this, I think is one of the more interesting parts of just thinking about these web frameworks.

00:18:16.940 --> 00:18:23.660
If somebody were to ask you, Brian, which one is more popular, Django or flask? I don't know. Do you, do you have a sense of where that might land?

00:18:23.660 --> 00:18:24.400
No, no.

00:18:24.400 --> 00:18:45.660
I think the latest stats put it just pretty much even, right? Both of them at like 40% or something like this. Right. And I think actually flask is like growing faster than Django. So I think flask is maybe a little more, it's maybe a little bit more of a vote in that because it's both like it's raw numbers are matching, but now it's also, I think, growing more quickly.

00:18:46.080 --> 00:18:58.000
But what is really interesting here is so many of these new little frameworks basically take the flask API and give it like a solid hat tip, but then try to do their own thing.

00:18:58.000 --> 00:19:07.960
So for example, to create a web app in black sheep, I get, I say app equals application or black sheep dot application, black sheep dot server dot application, I guess.

00:19:07.960 --> 00:19:15.420
And then I say at app dot route on some web function. Right. But there's a couple of differences, right?

00:19:15.420 --> 00:19:26.900
Also, so I could say async def function because it's async enabled natively based on uv loop, which is probably the best option. And you also pass in the request objects instead of not.

00:19:27.260 --> 00:19:46.180
So what I think is really interesting is like flask and Django, they're kind of neck and neck doing their battling, but all these other little frameworks seem to be like, we're going to take flask and change it a tiny bit in ways that we feel it's like, could be better deficient, or we just like this better over and over and over.

00:19:46.180 --> 00:19:52.620
So there's like all these little flask like API. So in that sense, I think flask is sort of winning the API side of the world.

00:19:52.620 --> 00:20:01.300
Yeah, I don't even know if it's a fair comparison. I know you can do lightweight things in Django and you can do large applications in flask.

00:20:01.460 --> 00:20:11.920
But in general, they are in a different realm. Generally, I think that people are writing larger applications. More people are writing larger applications in Django.

00:20:12.520 --> 00:20:22.640
And for the lightweight stuff, you're going to use flask or some of these other things. For instance, there's probably a lot of flask applications that absolutely have no front end. They're rest only.

00:20:22.640 --> 00:20:23.300
Right, right.

00:20:23.300 --> 00:20:33.680
Yeah, I think you're right. I think that that is generally the trend that people use Django for larger stuff. They probably appreciate the back end admin section and things like that.

00:20:33.680 --> 00:20:36.880
All right. So for Blacksheep, let me just talk about a few interesting things.

00:20:36.880 --> 00:20:47.340
So it has like built in support for multi processing, which is cool. It has like its own middleware, has routing much like flask does. It uses some really interesting features.

00:20:47.340 --> 00:20:58.020
So for example, you can have chunked encoding where if I'm going to send like bits of response over time, so like it can come down progressively to the browser or the consumer.

00:20:58.020 --> 00:21:01.920
It uses the yield keyword for that. That's pretty killer, right?

00:21:01.920 --> 00:21:02.240
Yeah.

00:21:02.320 --> 00:21:13.520
It has special strategies for handling exceptions, automatic binding of route and query parameters, pass to the methods, automatic reloading, all sorts of stuff.

00:21:13.520 --> 00:21:25.340
And then like I said, it also has this client option. So it has user-friendly SSL behavior by default, and it uses HTTP connection pooling.

00:21:25.460 --> 00:21:40.780
So much like async or AIo HTTP client rather than it is like requests. So it's kind of like your joke. You have to create async with block to create a client, and then you can call it like get, post, put, all that kind of stuff.

00:21:41.280 --> 00:21:50.040
But yeah, it's pretty cool. So it has sort of both sides of the story. And I guess you could just use only the server or only the client, but they're kind of all together there.

00:21:50.040 --> 00:21:58.060
Yeah. And it'll be interesting to watch. We're in an interesting place where we can like just see how many of these are going to be still around in two or three years.

00:21:58.060 --> 00:22:06.300
That's a real challenge. I think about like, would it make sense to create content around some of these various libraries or write articles or just, you know, whatever.

00:22:07.060 --> 00:22:16.920
Use them potentially. It's great that a thousand little flowers are blooming, but you know, the lawnmower is coming, right? They won't all exist. They won't all be kept up.

00:22:16.920 --> 00:22:24.520
And you know, if there's 20 little web frameworks, each with a hundred or a thousand GitHub stars, like what ones are going to last?

00:22:24.700 --> 00:22:35.660
So I don't know. I don't even know if they have to last, right? Like I think some of these ideas could be really interesting. Like, okay, maybe something that they're doing that's really cool here around like chunked encoding makes its way into flask.

00:22:35.660 --> 00:22:42.520
And the async stuff makes its way into flask. And eventually like, well, it's not different enough from flask anymore that we'll just keep using flask, right?

00:22:42.520 --> 00:22:46.100
But I think these little experimentations are super cool. And that's why I wanted to highlight it.

00:22:46.100 --> 00:22:59.220
Yeah, I think so too. And I do look forward to seeing what the flask equivalent of like the official, if it's flask or whether it's something else that's sort of the de facto standard for if you want something like flask, but asynchronous.

00:22:59.220 --> 00:22:59.600
Yeah.

00:22:59.600 --> 00:23:00.140
What do you use?

00:23:00.140 --> 00:23:06.740
Yeah, it's definitely cool to see a lot of options out there. Well, that's it for our main items, right? Anything else you want to touch on?

00:23:06.840 --> 00:23:08.640
I don't have anything extra. How about you?

00:23:08.640 --> 00:23:33.460
I got a couple of things. One, kick it off, I guess, with the PSF. So the PSF board elections, not to be confused with the steering council, which is like the core developer management stuff. This is the PSF board itself. Those elections are starting to get going. So you can suggest, nominate people now. You can submit a nomination. And on June 7th, the election will actually begin.

00:23:33.680 --> 00:23:51.320
So until June 1st, you can nominate anyone. And I believe they've changed the rules around who can be nominated to just like pretty much anyone that people want to nominate. So I think there might have been rules of how you had to participate previously to be eligible, but it seems like it's pretty wide open at this point.

00:23:51.320 --> 00:23:52.280
Neat.

00:23:52.280 --> 00:24:19.820
So also on that same page, I realized that I knew about this before, but it kind of pointed out, it says you can contribute to the PSF by purchasing a PyCharm license and all proceeds benefit to the PSF. So I think this is like a one month thing going on here. But if you buy a copy of PyCharm, you'll get apparently 30% off and all the profit I'm guessing goes to the PSF. Probably not revenue because they got to pay people and whatnot.

00:24:19.920 --> 00:24:20.400
That's neat.

00:24:20.400 --> 00:24:24.680
Yeah, that's a pretty good deal. So yay JetBrains for doing that. That's great.

00:24:24.680 --> 00:24:39.440
And then I guess two other really quick ones. Just want to remind people that if they want to take some of my classes, they can go to training. talkpython.fm/apps, install one of the mobile apps, iOS or Android. And there's a couple of free courses in there. So people can check that out.

00:24:39.840 --> 00:24:58.260
And then one more reminder before it kicks off next week, I'm doing my webcast next week called 10 tools and techniques Python web developers should explore. So it has a bunch of ideas of things that maybe you've heard about, maybe you haven't. But if you're doing stuff on the web, you definitely should think about.

00:24:58.760 --> 00:25:12.280
So cool stuff like ingrok or async or database migrations or let's encrypt, all those little things, a bunch of cool little tips, some of the stuff we even found on the show. So that's free. And that's around for next week.

00:25:12.280 --> 00:25:20.340
Is that one of those things where if I sign up and get emails about it, but I don't actually can't actually watch it during the webcast, can I watch it later?

00:25:20.340 --> 00:25:31.740
Yeah, I should be able to. And actually, honestly, it should just be I'm doing this with the collaboration with Wentelect and it just should be on their YouTube channel like a couple days later, even if you don't sign up. But yeah, sign up and you'll get notified. Yeah.

00:25:31.740 --> 00:25:32.340
Cool. Thanks.

00:25:32.340 --> 00:25:35.260
Yep. You bet. Well, that was all serious, but we also have some jokes.

00:25:35.260 --> 00:25:35.680
Yeah.

00:25:35.680 --> 00:25:38.480
So you know how I like to pick on you because you're a fan of Vim?

00:25:38.480 --> 00:25:39.200
Yeah.

00:25:39.200 --> 00:25:47.740
But in a very nice and warm hearted way. So I've chosen a couple of things that I feel like might touch on that theme.

00:25:47.740 --> 00:25:48.520
Yeah, they're good.

00:25:48.520 --> 00:25:51.140
In programming, how do you generate a random string?

00:25:51.140 --> 00:25:52.400
Use the random module.

00:25:52.400 --> 00:25:56.820
One option. Or you put a first year computer science student in Vim and ask them to save and exit.

00:25:56.820 --> 00:25:59.980
This is funny.

00:26:00.740 --> 00:26:12.080
So another one is imagine you're at a restaurant. Some guy falls over. He starts choking. The waiter runs over and goes, oh, my gosh, he's choking. Is anyone here a doctor? Some programmer stands up and goes, hey, I'm a Vim user.

00:26:12.080 --> 00:26:16.080
That doesn't make any sense.

00:26:16.080 --> 00:26:21.460
It's the programming equivalent of how do you know if someone is a marathon runner?

00:26:21.460 --> 00:26:22.560
I don't know.

00:26:22.560 --> 00:26:23.580
Don't worry. They'll tell you.

00:26:23.820 --> 00:26:45.360
Okay. So I was chuckling about these the other day and I tried to describe it to my daughter, my nine-year-old daughter. I knew that I had to like get some backstory. And I said, so this is sort of funny because in Vim, if especially you're in terminal mode, you save and exit by doing escape, colon, WQ.

00:26:45.900 --> 00:26:52.380
And if you're really serious about an exclamation point also. And she's like, that's a terrible interface.

00:26:52.380 --> 00:27:03.240
She has a good sense. How interesting. Funny, funny. Cool. All right. Well, thanks for the laughs and covering all these items as always.

00:27:03.240 --> 00:27:04.120
Yeah. Thank you.

00:27:04.120 --> 00:27:04.460
Yeah.

00:27:04.580 --> 00:27:15.120
Thank you for listening to Python Bytes. Follow the show on Twitter via at Python Bytes. That's Python Bytes as in B-Y-T-E-S. And get the full show notes at pythonbytes.fm.

00:27:15.120 --> 00:27:22.020
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.

00:27:22.020 --> 00:27:28.560
On behalf of myself and Brian Okken, this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and colleagues.

