WEBVTT

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

00:00:04.140 --> 00:00:10.200
your earbuds. This is episode 138, recorded July 3rd, 2019. I'm Michael Kennedy. And I'm Brian

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

00:00:14.580 --> 00:00:19.560
slash DigitalOcean. More on that later. Brian, how you doing? I'm good. Been recording a lot.

00:00:19.560 --> 00:00:24.340
Yeah, recording a lot and trying to survive a work move, huh? Yeah, I'm not looking forward

00:00:24.340 --> 00:00:29.480
to half an hour drive. Yeah, a work move is like when you get to move and your commute changes,

00:00:29.480 --> 00:00:33.840
but you don't get any say in it, right? Yeah, exactly. Yeah, I don't know if people know,

00:00:33.840 --> 00:00:39.180
but traffic in Portland and in the Northwest, it's rough, man. Yeah, but I mean, I lucked out. So for

00:00:39.180 --> 00:00:44.040
like nine years, I had a 10 minute commute. And I know a lot of people have worse commutes. Yeah,

00:00:44.040 --> 00:00:49.100
my commute is really rough. My studio area is like above my garage and the garage is detached.

00:00:49.100 --> 00:00:52.960
So I go across the sidewalk and periodically there's like a squirrel or something that will

00:00:52.960 --> 00:00:57.940
startle me a little bit. And that's like a rough commute for me. Yeah, I'm just kidding. No one

00:00:57.960 --> 00:01:01.800
should feel sorry for me on that regard. That's awesome. Nice. All right. Well,

00:01:01.800 --> 00:01:07.080
speaking of keeping everything like legit and keeping surprises out of it, that's probably where

00:01:07.080 --> 00:01:10.860
we should start, huh? Sure. You want to jump into the first item? Yeah, yeah. Flightgate,

00:01:10.860 --> 00:01:15.780
let's do it. Okay. I use Flightgate all the time. I actually put it on almost every project to make

00:01:15.780 --> 00:01:21.120
sure that I'm just not doing something stupid. So it does a whole bunch of different, I think we've

00:01:21.120 --> 00:01:25.740
talked about it before. But one of the things that I came across, this was submitted by Florian

00:01:25.740 --> 00:01:31.780
Dolitz, I think, is Flightgate Comprehensions, which is a plugin for Flightgate. You just install that

00:01:31.780 --> 00:01:36.940
also and it'll run automatically. People are used to list comprehensions, but there's a whole bunch of

00:01:36.940 --> 00:01:42.280
other things like dictionary comprehensions and things like that. Set comprehensions, yeah. Generator

00:01:42.280 --> 00:01:47.040
expressions, all these things, right? Yeah. There might be some old code that works fine, but maybe it

00:01:47.040 --> 00:01:53.240
would be easier to read if it was changed. So this is just some static analysis for your code to

00:01:53.400 --> 00:01:58.680
check different things to, you know, make your code look nicer. Awesome. Like some of the warnings are

00:01:58.680 --> 00:02:03.920
unnecessary generator. Rewrite that as a list comprehension or unnecessary list comprehension.

00:02:03.920 --> 00:02:09.120
Rewrite it as a dictionary comprehension and interesting stuff along those lines. So yeah,

00:02:09.120 --> 00:02:13.860
that's pretty cool. I'm going to hook it into all my projects. I haven't tried it yet to see if it's

00:02:13.860 --> 00:02:18.480
helping me at all yet, but it looks like a fun thing to add. Yeah, there's some nice little

00:02:18.480 --> 00:02:26.320
cleanups here and I'm just kind of always amazed at how similar the comprehensions are, but how different

00:02:26.320 --> 00:02:31.540
the resulting outcome of them are. You know, especially with list comprehensions, square brackets,

00:02:31.540 --> 00:02:38.140
and generator expressions, parentheses. One is like this lazily evaluated generated expression that can

00:02:38.140 --> 00:02:42.460
be used once. The other is a list, right? But it's like you just round the edges a little bit on the

00:02:42.460 --> 00:02:48.120
symbol and that's it. Yeah. And I always forget that set comprehensions are a thing. So nice,

00:02:48.120 --> 00:02:53.140
nice. Yeah. So these are great. I feel like these are in the category of Pythonic code that a lot of

00:02:53.140 --> 00:02:58.540
folks don't know about, don't use and so on. Right. They're like, well, in C++, what I would do is I

00:02:58.540 --> 00:03:03.680
would write a for loop. And so they have four in loops in Python. So I write that as like, actually,

00:03:03.680 --> 00:03:06.800
we have these comprehensions too. You don't need that. So pretty cool.

00:03:06.800 --> 00:03:14.100
Anytime I can move code reviews out of personal opinions and into a static analysis tool, it just

00:03:14.100 --> 00:03:19.040
makes the team smoother. Yeah, absolutely. I think it's really interesting psychologically that people,

00:03:19.040 --> 00:03:23.700
developers respond differently to criticism from a robot than they do from a human.

00:03:23.700 --> 00:03:27.320
Yeah. I mean, it's like a compiler warning or something at that point.

00:03:27.320 --> 00:03:31.380
Exactly. It's like, well, CI says you got to do it. So we all agreed that this is how it's going to be.

00:03:31.380 --> 00:03:37.160
So we do it rather than like, well, that's the guy that's always picky and always says to rewrite

00:03:37.160 --> 00:03:40.720
my code and it's not Pythonic. I don't want to invite him to lunch anymore.

00:03:40.720 --> 00:03:46.000
It's like somebody will pick up the torch and be the one person that's always telling other people

00:03:46.000 --> 00:03:51.060
that they're, they need to change their code because of style. And that just gets old. So yeah,

00:03:51.060 --> 00:03:56.720
let the computer do it. Exactly. And it's more consistent anyway, no matter how anal the person

00:03:56.720 --> 00:04:04.400
is the computer is more so. So this next item here is something that is near and dear to my heart.

00:04:04.400 --> 00:04:11.140
We've covered it before when it first came onto the scene, but it's now really ready to go. Now I

00:04:11.140 --> 00:04:15.960
want to just set the stage here that I think, you know, we've talked about this before. I can't remember

00:04:15.960 --> 00:04:22.600
where, but we've spoken about before that basically, you know, Python's growth is incredible. We've talked

00:04:22.600 --> 00:04:28.400
about that a bunch, but fast becoming one of the most popular languages, but there's really three areas in my

00:04:28.400 --> 00:04:36.700
assessment where Python could be, you know, it's weak or it could be dethroned or it could in the words of

00:04:36.700 --> 00:04:45.340
Russell Keith-Magee actually be an existential threat to the longevity of Python. And those are a proper way to

00:04:45.340 --> 00:04:52.020
build mobile applications with Python. I know we have Kivy and we have some stuff from Russell stuff

00:04:52.020 --> 00:04:57.720
as well. Right. But those are like sort of, well, we'll get it working. It's kind of proof of concept.

00:04:57.720 --> 00:05:02.280
It's not like a visual designer drag and drop. Here's how you push this button to publish the app. So,

00:05:02.280 --> 00:05:07.880
right. Like there's not really a proper way to build mobile apps for Python. That's an existential threat.

00:05:07.960 --> 00:05:16.220
Number two is I would like something like the Slack app in Python. Build that. Yeah. Good luck with that.

00:05:16.220 --> 00:05:21.760
Right. Like probably not. So there are ways to do stuff like that, but it's always either like some

00:05:21.760 --> 00:05:27.580
kind of kludge or it's, yeah, you can build it, but it's going to look like from 1994. Nobody wants that.

00:05:27.580 --> 00:05:28.980
I mean, Qt's pretty good.

00:05:28.980 --> 00:05:32.520
Qt is pretty good. Yeah. Qt is pretty good. I'm thinking, you know, TK Enter. It's like,

00:05:32.520 --> 00:05:36.860
it's definitely showing its age, right? For example. So yeah, those are great. And so like,

00:05:36.860 --> 00:05:40.860
GUI is probably the least existential threat of these, but it's very clear,

00:05:40.860 --> 00:05:47.420
closely tied to this last one, which is sharing your application with end users. Somebody who doesn't

00:05:47.420 --> 00:05:51.080
care whether or not your program is written in Python, they would just want to run your program.

00:05:51.080 --> 00:05:55.280
How does that happen? Oh yeah. Yeah. That's a problem. And you,

00:05:55.280 --> 00:05:59.520
what was really interesting was there's a while ago I talked about Gita Van Rossen being interviewed

00:05:59.520 --> 00:06:06.160
on, I think it was the AI, the MIT's AI podcast. It was a super interesting interview and a lot of

00:06:06.160 --> 00:06:11.080
great stuff that he said, I think they talked about it there with him. If it wasn't there,

00:06:11.080 --> 00:06:15.860
it was him being interviewed somewhere else. And basically they said, well, how do you feel about

00:06:15.860 --> 00:06:21.000
this deployment story? It doesn't seem like a weakness. And Gita's thought was, well, you can

00:06:21.000 --> 00:06:26.580
really use a lot of the Linux package managers to solve a lot of these problems. Like if I want Python

00:06:26.580 --> 00:06:33.100
there, I can apt install Python three. If I need to get pip, I can apt install Python three dash pip

00:06:33.100 --> 00:06:41.500
and so on. And it was very clear, like his whole thinking about what getting an application to a

00:06:41.500 --> 00:06:48.080
user meant was getting it properly set up on a server or like a developer gets the tool set up on

00:06:48.080 --> 00:06:52.800
their Linux dev machine, which is all well and good. But you know, the most important thing is how do I

00:06:52.800 --> 00:06:58.500
give an icon thing to a person on a Mac or on windows? They can double click and then their thing

00:06:58.500 --> 00:07:03.160
runs. You know what I mean? Yeah, sure. Sure. I mean, for all the people that need a dev tool on

00:07:03.160 --> 00:07:10.500
Linux, there are a hundred more, a hundred times more who need an application as an end user. You

00:07:10.500 --> 00:07:15.100
know what I mean? Okay. Yeah. So if we want to get, if I want to get something like say, if I've created

00:07:15.100 --> 00:07:21.600
some data science tooling and I want to give that to my team, I would like to say, here's like a DMG or

00:07:21.600 --> 00:07:26.200
an MSI installer, you double click it and then you run. I don't care what version of Python you got

00:07:26.200 --> 00:07:30.180
set up or anything like that. Right? So I think that's the third problem is like, how do we get

00:07:30.180 --> 00:07:35.860
like end applications users? And the reason I think it's partly, it's kind of this chicken and egg

00:07:35.860 --> 00:07:40.880
problem. I feel like partly the reason it's not got a lot of attention in the Python space is because

00:07:40.880 --> 00:07:47.500
it's so bad. It's like so nearly impossible that people just generally don't do it. So there's like not a

00:07:47.500 --> 00:07:51.200
lot of demand for people creating those types of applications to get them out because it's like,

00:07:51.200 --> 00:07:55.660
why would you use Python for that? It's like, doesn't even make sense. Right? There's Pi installer,

00:07:55.660 --> 00:08:03.340
but it's also good, but it has some limitations. And so the thing I want to cover again is Pi oxidizer.

00:08:03.340 --> 00:08:10.840
And the reason is it's now officially released. It has its first release. And I had been watching the

00:08:10.840 --> 00:08:16.780
GitHub repository, you know, as like, you can say, go watch this repository. And my email just like blew up.

00:08:16.780 --> 00:08:20.700
Like I couldn't, I just go and like was constantly cleaning up like pull requests,

00:08:20.700 --> 00:08:26.060
issues, all this kind of stuff. Like people were just going crazy on their repository.

00:08:26.060 --> 00:08:26.600
Okay.

00:08:26.600 --> 00:08:31.940
It's just got a ton of traction. So that's out. And I just want to kind of highlight some of the stuff.

00:08:31.940 --> 00:08:38.200
The guy who created it, gosh, Gregory created it. And he's done some awesome stuff. He wrote a really

00:08:38.200 --> 00:08:42.820
nice article, which I'm linking to here. And it covers a lot of the reasons why you would want it.

00:08:43.420 --> 00:08:51.120
So at PyCon 2019, like I said, Russell Keith-Magee said, basically, this distribution problem is like

00:08:51.120 --> 00:08:56.200
a potential black swan event for Python, right?

00:08:56.200 --> 00:08:58.560
I still don't know what that means, but sure.

00:08:58.560 --> 00:09:05.460
An unseen super negative thing coming out of the blue that's going to dramatically disrupt it somehow.

00:09:05.800 --> 00:09:09.680
I don't know if I would call it that. But I definitely think that distribution is like

00:09:09.680 --> 00:09:14.720
a reason people would not be using Python first term. I don't know if I see it as like this negative

00:09:14.720 --> 00:09:18.200
sense, but I definitely see it as a, it could be so much more, right?

00:09:18.200 --> 00:09:21.840
Yeah. I mean, Python's so great everywhere else. It'd be cool if it was great there too.

00:09:21.840 --> 00:09:23.220
Exactly. Why is it not good there?

00:09:23.220 --> 00:09:23.440
Yeah.

00:09:23.540 --> 00:09:27.940
Gregory said, basically, I'm going to create this project called PyOxidizer and it uses Rust

00:09:27.940 --> 00:09:35.640
to bundle up your Python code into an executable application. A .app thing on Mac, a .exe on

00:09:35.640 --> 00:09:42.140
Windows, and a statically linked binary executable on Linux. So it works on all the different platforms.

00:09:42.140 --> 00:09:48.180
And what's cool is it takes all the dependencies you have. So if you depend on say pandas or whatever,

00:09:48.360 --> 00:09:52.780
right, it'll bundle that up. It bundles the version of Python that you build it against,

00:09:52.780 --> 00:09:56.620
right? So you're guaranteed you'll have 3.7 no matter what system you put it on,

00:09:56.620 --> 00:09:58.260
if you build it against 3.7.

00:09:58.260 --> 00:09:58.600
Okay.

00:09:58.600 --> 00:10:04.080
And what's really interesting is the way it works is it builds a single executable and then

00:10:04.080 --> 00:10:08.180
your Python code is loaded from bytecode in memory.

00:10:08.180 --> 00:10:08.680
Oh, wow.

00:10:08.680 --> 00:10:14.460
Right? So like it actually creates your Python files. It creates PYC files. So pre-computed

00:10:14.460 --> 00:10:23.380
PYC bytecode and then loads that out of memory. So it actually runs faster than if you ran the code,

00:10:23.380 --> 00:10:27.020
it starts faster than if you ran the code in regular Python.

00:10:27.020 --> 00:10:27.440
Okay.

00:10:27.440 --> 00:10:31.800
Some tools care about starting fast. Some don't, right? Like a website doesn't really care about

00:10:31.800 --> 00:10:33.900
starting fast. But a command line thing...

00:10:33.900 --> 00:10:36.320
If you're going to write an editor, you want it to just pop open.

00:10:36.400 --> 00:10:42.280
Exactly. So the other problem with the other ways in which this was done was they would basically

00:10:42.280 --> 00:10:47.520
zip up your Python code and maybe unzip it and then try to run it from there in memory thing.

00:10:47.520 --> 00:10:50.560
So you also kind of leaks your source code a little bit, right?

00:10:50.560 --> 00:10:51.320
Yeah, I guess so.

00:10:51.320 --> 00:10:57.820
So if this is embedded as a binary, it's less obvious for people to go poking around that this

00:10:57.820 --> 00:11:02.640
is Python code that they can go read and mess with, right? Like technically, I know it still could

00:11:02.640 --> 00:11:07.020
be messed with. But it's not like, well, here's the directory of Python files. What is this doing

00:11:07.020 --> 00:11:11.200
in my applications route? You know what I mean? Let's go play with those, right? So this is pretty,

00:11:11.200 --> 00:11:15.940
there's just a lot of interesting things here. The article that Gregory put out announcing it,

00:11:15.940 --> 00:11:20.320
it's pretty broad and it's really compelling. So it seems like this project is really taking off.

00:11:20.320 --> 00:11:25.880
I definitely think it would change the landscape if we had something like this legitimately working

00:11:25.880 --> 00:11:30.580
well across the board on all the OSes. I think it would actually drive people to build more

00:11:30.580 --> 00:11:36.420
GUI based apps because there would be a much more clear path on how to get those applications

00:11:36.420 --> 00:11:40.720
to end users, not just developers and developer tools and servers.

00:11:40.720 --> 00:11:41.140
Yeah.

00:11:41.140 --> 00:11:44.960
Cool. Well, anyway, PyOxidizer, it seems to be catching fire and that's pretty awesome.

00:11:44.960 --> 00:11:46.080
Yeah, it is cool. I like it.

00:11:46.080 --> 00:11:47.320
All right, what you got? What's the next one?

00:11:47.320 --> 00:11:53.280
Well, speaking of sharing code, one of the things that people do is not with end users,

00:11:53.340 --> 00:11:58.900
but with just other developers is to take a script. You've got like just a, you know,

00:11:58.900 --> 00:12:04.180
you created a script, a little module or something, and it works on your machine. You want to share it

00:12:04.180 --> 00:12:09.940
with other people. Even that there's a little bit of a barrier between writing a simple script and

00:12:09.940 --> 00:12:16.000
packaging it up properly and getting that running. So it's one of the things I'm actually working on a

00:12:16.000 --> 00:12:21.980
write-up, trying to do a write-up of all that with experimenting using it with using Flit and pytest

00:12:21.980 --> 00:12:28.120
and Tox and Coverage to make sure it's well tested and structured well and all of that.

00:12:28.120 --> 00:12:33.000
That's cool. Because you were, before you were sort of a fan of creating a source directory for your

00:12:33.000 --> 00:12:37.240
packages and, but that ran into trouble with like Flit, right? Or some Flit or Tox?

00:12:37.320 --> 00:12:42.000
That's the thing. With Coverage, you want to be able to, I want to be able to test or run against

00:12:42.000 --> 00:12:48.540
the installed version, not the local version. So I want to do all of the packaging, install it into

00:12:48.540 --> 00:12:54.700
an environment, and then run the test against that. And that was hard to do. I thought it was hard to

00:12:54.700 --> 00:13:01.120
do. And a lot of people were recommending using an intermediate source directory to hide the local

00:13:01.120 --> 00:13:06.720
code from Tox and from, well, not really from Tox, but from Coverage and pytest so that you were

00:13:06.720 --> 00:13:12.340
really loading the installed one. I didn't know there was a thing here. And I'm highlighting

00:13:12.340 --> 00:13:18.020
a feature of Tox that's called ChangeDir. And it's really simple. You just put this in your test

00:13:18.020 --> 00:13:24.600
environment lines in Tox, in your ToxAny file, and just say, change the directory to like my test

00:13:24.600 --> 00:13:29.740
directory. And then, voila, you can't see the top level source code anymore.

00:13:29.740 --> 00:13:30.440
Oh, that's cool.

00:13:30.440 --> 00:13:35.540
Problem solved. So I've got a longer explanation. I'm going to talk about this on,

00:13:36.120 --> 00:13:40.140
I have on episode 80 of Test and Code, which will be out by the time this is out.

00:13:40.140 --> 00:13:45.440
But I was amused because I'm walking through an example. And I'm trying all these things to make

00:13:45.440 --> 00:13:51.020
sure they work. And the example project I built was a markdown converter using regular expressions.

00:13:51.020 --> 00:13:56.740
And I thought this was really funny because of the news that came out recently that Cloudflare

00:13:56.740 --> 00:13:59.420
went down because of a regular expression.

00:13:59.420 --> 00:14:05.800
A single regular expression. And Cloudflare is like the intermediary to so many applications

00:14:05.800 --> 00:14:07.340
out there. That's bad.

00:14:07.340 --> 00:14:13.240
Big chunk of the internet not working because Cloudflare was pegged on one regular expression.

00:14:13.240 --> 00:14:16.820
I don't even know how to do that. I don't know how to make a regular expression that...

00:14:16.820 --> 00:14:21.720
I do simple regular expressions. So I don't know how to do something that's quadratic in

00:14:21.720 --> 00:14:23.740
nature. But I thought it was funny.

00:14:23.740 --> 00:14:27.400
Mine tell me they're not working right away. But they say that too frequently.

00:14:27.400 --> 00:14:28.360
Yeah.

00:14:28.700 --> 00:14:31.140
Why is this not finding the match? Oh, well.

00:14:31.140 --> 00:14:34.860
Since I thought that was... I was using regular expressions and I thought it was funny that

00:14:34.860 --> 00:14:40.160
somebody else reminded me of that Mel Brooks quote that it's tragedy when it happens to me.

00:14:40.160 --> 00:14:45.000
It's comedy when it happens to you. So I'm laughing at Cloudflare, but I wouldn't be laughing

00:14:45.000 --> 00:14:46.060
if I was working there.

00:14:46.060 --> 00:14:51.520
Yeah. If your pager was going off at three in the morning, the humor would be entirely sucked

00:14:51.520 --> 00:14:53.340
out of that situation. Yeah, that's rough.

00:14:53.340 --> 00:14:53.660
Yeah.

00:14:53.660 --> 00:14:57.160
Before we get on to the next one, let me just tell you all about Digital Ocean. I try to highlight

00:14:57.160 --> 00:15:01.420
one of the features of what they've got going on. Like I said, many times our infrastructure

00:15:01.420 --> 00:15:07.380
runs on Digital Ocean and they do a great job. So one of the things you might not want to deal

00:15:07.380 --> 00:15:11.620
with is setting up a Postgres server, backing it up, setting up the right scaling infrastructure

00:15:11.620 --> 00:15:17.280
and all that. So Digital Ocean has this great feature where you can get a managed Postgres database

00:15:17.280 --> 00:15:21.560
as a service, which solves a whole bunch of problems like figuring out what the optimal

00:15:21.560 --> 00:15:26.820
database infrastructure footprint is or scaling it as your app grows or

00:15:26.820 --> 00:15:31.780
creating highly available and failover infrastructure, all that kind of stuff you want,

00:15:31.780 --> 00:15:36.780
but you don't want to deal with it or deal with like when the pager goes off because it stopped

00:15:36.780 --> 00:15:42.160
replicating or it wouldn't scale or whatever. Just go to Digital Ocean and check the box to get your

00:15:42.160 --> 00:15:47.780
managed Postgres database and let them deal with it all. So that's really nice. Runs right there in

00:15:47.780 --> 00:15:51.940
that data center. So you're all good. Check them out at pythonbytes.fm/Digital Ocean.

00:15:52.160 --> 00:15:56.420
They're big supporters of the show and highly recommended. All right. So this next one, Brian,

00:15:56.420 --> 00:16:01.720
I think has some pretty interesting possibilities and maybe ties back to my item that I spoke about

00:16:01.720 --> 00:16:07.520
before creating like a new type of apps or opportunities for more apps. Now it used to be if you wanted to

00:16:07.520 --> 00:16:12.760
have some kind of communication, you'd have to go install like weird plugins into your browser.

00:16:13.300 --> 00:16:19.360
So you could do, I don't know, some kind of real time chat or video communication. But recently,

00:16:19.360 --> 00:16:23.900
these things have just been working all on their own, right? Things like Zencaster and whatnot.

00:16:23.900 --> 00:16:29.220
Now it could just do like live communication in the browser. And that's because of WebRTC and ORTC.

00:16:29.220 --> 00:16:36.420
The Web Real Time Communication is an open project that provides browsers and mobile apps real time

00:16:36.420 --> 00:16:44.200
communication. And then the open ORTC one is basically a similar style of communication.

00:16:44.200 --> 00:16:44.600
Okay.

00:16:44.600 --> 00:16:51.420
The item I want to talk about is this implementation for Python that uses asyncio. So you can write

00:16:51.420 --> 00:16:57.880
Python applications that then communicate with other things like browsers or mobile apps and whatnot

00:16:57.880 --> 00:16:59.180
that use WebRTC.

00:16:59.180 --> 00:16:59.720
Oh, cool.

00:16:59.840 --> 00:17:06.260
Yeah. So it's called AIO RTC. AIO is for asyncio and then RTC, well, you know, for the protocol.

00:17:06.260 --> 00:17:12.240
So it's pretty cool. It follows pretty close to the JavaScript counterpart, which is how you would do

00:17:12.240 --> 00:17:18.260
it in the web. But it uses a lot of Pythonic constructs like the popular JavaScript ones use promises.

00:17:18.260 --> 00:17:26.300
So this AIO RTC uses coroutines, which is cool. And events are emitted using the PyEventMeter,

00:17:26.300 --> 00:17:31.160
which is all good. The main ones, like the main one is if you want to explore these communication

00:17:31.160 --> 00:17:36.260
protocols are all baked into the browsers and they come in native code. But if you want to explore like

00:17:36.260 --> 00:17:41.700
a more understandable version, a more hackable version, this one is all just in Python, which is

00:17:41.700 --> 00:17:46.000
pretty cool for understanding how it works. They also talk about some of the kinds of apps you could

00:17:46.000 --> 00:17:51.820
build, right? So like you can create some new things in the Python ecosystem. For example, you could

00:17:51.820 --> 00:17:57.980
build a server handling both signaling and data channels and apply like computer vision to the

00:17:57.980 --> 00:18:01.320
video frames using OpenCV like in real time or something cool like that.

00:18:01.320 --> 00:18:01.960
Oh, that'd be neat.

00:18:01.960 --> 00:18:06.360
Yeah. So people doing fun stuff with video communications. If you want to write a Python

00:18:06.360 --> 00:18:11.700
application that can participate in that and you want it to be nice and modern using async and await and

00:18:11.700 --> 00:18:15.260
asyncio, well, this is a pretty cool AIO RTC.

00:18:15.260 --> 00:18:15.780
Yeah.

00:18:15.780 --> 00:18:18.760
Yeah. Speaking of communications, you got another one, right?

00:18:18.880 --> 00:18:23.720
This was a listener's suggestion and I can't remember who submitted it, but I think it's,

00:18:23.720 --> 00:18:27.620
and they even have the, it's called a prize. I think that's how you pronounce it. Is that right?

00:18:27.620 --> 00:18:34.040
A prize. Yes. To inform or to tell someone, to make one aware of something. They've apprised me of

00:18:34.040 --> 00:18:36.800
the situation. Really? Yes. Okay. Carry on. Sorry.

00:18:36.800 --> 00:18:37.460
Okay.

00:18:37.460 --> 00:18:45.160
So a prize is for push notifications and their tagline was push notifications that work on just about every

00:18:45.160 --> 00:18:50.580
platform. It's kind of a shim layer to put between your app and multiple notification services.

00:18:50.580 --> 00:18:57.600
So it sends notifications to things like, Telegram. They say Telegram push bullet. Never

00:18:57.600 --> 00:19:03.520
heard of either of those Slack and Twitter. Yes, I have heard of those, but also things like a discord,

00:19:03.520 --> 00:19:11.460
getter mail gun matter. Most Microsoft teams, even sending SMSs through Twilio or Nexmo that's

00:19:11.460 --> 00:19:17.620
supported email notifications supported for that. Some things that are, you want to just email people,

00:19:17.620 --> 00:19:21.700
but if your server's on fire, you might want to send an SMS to somebody.

00:19:21.700 --> 00:19:23.380
Yeah, that's cool. It's really cool.

00:19:23.380 --> 00:19:27.280
It looks pretty neat. The API looks nice. It looks like it'd be pleasant to work with.

00:19:27.280 --> 00:19:30.320
So I think this is a good one to highlight. It looks neat.

00:19:30.320 --> 00:19:34.380
Yeah. Some of the stuff that stood out to me is Growl and Windows notifications.

00:19:34.380 --> 00:19:35.980
Do you know what Growl is?

00:19:36.080 --> 00:19:40.440
So Growl is, I don't know if this is the way it still works in macOS, but you know,

00:19:40.440 --> 00:19:43.620
the little toast notifications that come up in the top right in macOS?

00:19:43.620 --> 00:19:44.320
Oh yeah. Yeah.

00:19:44.320 --> 00:19:45.280
Yeah. Growl does that.

00:19:45.280 --> 00:19:45.700
Oh, okay.

00:19:45.700 --> 00:19:49.400
But you might have to have a little daemon installed. I can't remember if it natively

00:19:49.400 --> 00:19:54.600
talks to Mac. I don't think so. I think Growl is like before that was built into the OS,

00:19:54.600 --> 00:19:58.480
but basically it does that. And then Windows notifications like similarly, but instead of

00:19:58.480 --> 00:20:01.100
being the top right, they're in the bottom, right? So they're not at all the same thing.

00:20:01.100 --> 00:20:05.700
And it also supposedly supports matrix. So I don't know if that texts Keanu Reeves or

00:20:05.700 --> 00:20:06.920
Yeah, exactly. Yeah.

00:20:06.920 --> 00:20:11.360
I know Kung Fu. Okay. Sorry.

00:20:11.360 --> 00:20:17.480
Yeah. No, this is really cool. If you've got to communicate with Gitter, if this, then that,

00:20:17.480 --> 00:20:22.540
all those different things, you know, Cisco teams, Microsoft teams, all those, rather than

00:20:22.540 --> 00:20:28.140
integrate with all of their APIs or Twilio or whatever, just like bring this in as like a

00:20:28.140 --> 00:20:29.680
facade over all that. It's great.

00:20:29.680 --> 00:20:34.660
Yeah. So this last thing I want to talk about is a new web framework. And I feel like the web

00:20:34.660 --> 00:20:42.360
in Python is getting really interesting and also a little more hard to choose the right thing to do

00:20:42.360 --> 00:20:47.140
because it used to be, oh, Django Flask. There's Pyramid also. I like Pyramid. And there's,

00:20:47.140 --> 00:20:51.760
there's a few others. There was Cherry Pie that's not used that much anymore. So I guess I'll choose

00:20:51.760 --> 00:20:55.100
between those three, right? Like that was kind of like the end of the thought, but now there's like

00:20:55.100 --> 00:20:59.500
hundreds like of little things, right? There's black sheep that we talked about. There's mace

00:20:59.500 --> 00:21:05.980
tonight and there's Jepronto and there's, well, there's WebSana as well. So WebSana is a new

00:21:05.980 --> 00:21:10.980
framework. And I think it's super interesting because it, you know, it kind of brings some

00:21:10.980 --> 00:21:19.720
more beginner friendliness or CMS friendliness to some of the micro framework story. So we've got

00:21:19.720 --> 00:21:24.960
another way you might break up the web framework thinking process as well as I want an app that's

00:21:24.960 --> 00:21:29.660
kind of like, I've got to work the way it works, but I can block in the, I can like slot in these

00:21:29.660 --> 00:21:34.720
big blocks and have stuff I want like Django. So like I can have an admin backend where I just like

00:21:34.720 --> 00:21:41.340
have like an Excel, like view of my database if I want that, for example. Right. But if you want to

00:21:41.340 --> 00:21:45.240
not work the way Django works, well, too bad you work the way Django works. That's how you use Django.

00:21:45.440 --> 00:21:49.420
Right. On the other hand, you could use Flask or Pyramid where it's kind of like, well, here's how

00:21:49.420 --> 00:21:55.800
you process a request. Whatever else you do, that's on you. Right. It's up to you. So a lot of people

00:21:55.800 --> 00:22:00.400
kind of like that more fine grained stuff like, well, I think I'll use SQLAlchemy here and I'm going to

00:22:00.400 --> 00:22:04.640
use like this for managing passwords. And here's how I do my users and email and all that. Right. You get

00:22:04.640 --> 00:22:08.780
to choose all those little bits, but then you got to choose all the bits and build with it and so on.

00:22:08.780 --> 00:22:17.080
So this WebSona framework is built on Pyramid, SQLAlchemy, and obviously Python 3, but it adds a lot

00:22:17.080 --> 00:22:23.820
of the features people might choose Django for, but in like a super modern and cool way. So I really,

00:22:23.820 --> 00:22:28.940
really like it. Their description is WebSona is a full snack Python web framework for building web

00:22:28.940 --> 00:22:34.960
services and back offices with admin interfaces and user signup processes. That's good. Yeah. So it says,

00:22:34.960 --> 00:22:39.300
well, they say, well, when should you use it? Well, it's focused on internet facing sites when

00:22:39.300 --> 00:22:44.840
you have a public or private signup process and an admin interface face. And the sweet spot includes

00:22:44.840 --> 00:22:49.860
custom business portals, software as a service products, which are too specialized for off the

00:22:49.860 --> 00:22:55.960
shelf solutions, read WordPress, Squarespace, like all these things you're like, oh, you could use that.

00:22:55.960 --> 00:23:00.400
Well, for like 80%, you could use that. Then, then what, then where do you go? Right. So WebSona can

00:23:00.400 --> 00:23:04.440
now be a place that you might go for that. Cool. This might be take off. Yeah, I think it really

00:23:04.440 --> 00:23:10.760
good. And so they talk about, they're focused on like core business logic. So you can, you know,

00:23:10.760 --> 00:23:15.160
they build all, have all the building blocks. Like you want to sign up with Google with your Gmail.

00:23:15.160 --> 00:23:19.660
Yeah. You just like put that in there and it just, now you can sign up for the, your app with Gmail.

00:23:19.660 --> 00:23:24.240
It's nice. You can get started real easy. Lots of docs. Yeah. It's just all about being productive.

00:23:24.240 --> 00:23:27.740
So they have a whole bunch of infrastructure built up and just like kind of fill in the pieces.

00:23:28.260 --> 00:23:34.800
It's a little more Django-esque, but then like raw pyramid is, but it's kind of nice that you have

00:23:34.800 --> 00:23:40.580
this blended option. So I think it's looks really promising. They have a lot of cool things like

00:23:40.580 --> 00:23:47.020
asynchronous task processing and other stuff like that, that really makes it feel like pretty modern

00:23:47.020 --> 00:23:52.540
and cool. Yeah, definitely. Yep. It looks like it's tested using pytest also. Yeah. It's tested using

00:23:52.540 --> 00:23:58.000
pytest. It's deployed using Ansible. Let's see what else. There's a couple of things like,

00:23:58.000 --> 00:24:03.840
yeah, that is super cool. It automatically comes with the top OWASP top 10 security vulnerabilities

00:24:03.840 --> 00:24:08.960
limit, like restricted. So like they figure out what are like the top 10 reasons websites have

00:24:08.960 --> 00:24:13.200
security problems and they built into the infrastructure by default to block all those

00:24:13.200 --> 00:24:17.660
like cross-site scripting and whatnot. They have asynchrony built in and they even comes,

00:24:17.660 --> 00:24:24.920
it even has a IPython notebook shell. So instead of just having like a grid view of admin stuff,

00:24:24.920 --> 00:24:28.860
I can type in, they're like, oh, well, if you need to do admin tasks, like log in and just fire up,

00:24:28.860 --> 00:24:34.120
you know, Jupyter on the backend and just start like manage it like that way. Right. So that's like,

00:24:34.120 --> 00:24:39.840
all right. So it's like a web shell to your, your server, keep that super locked down, but you know,

00:24:39.840 --> 00:24:43.940
still pretty awesome. So there's a bunch of like really interesting ideas here that I think are

00:24:43.940 --> 00:24:48.500
quite cool. The documentation is pretty thorough. It even includes like, okay, once you get this

00:24:48.500 --> 00:24:53.160
stuff working, how do you deploy it somewhere? Yeah, exactly. This is quite new, but it also

00:24:53.160 --> 00:24:57.140
looks really promising to me and I hope it, I hope it takes off because I feel like this is like a

00:24:57.140 --> 00:25:02.940
really nice modern take on what a modern Python web app framework should look like. Yeah, cool.

00:25:02.940 --> 00:25:07.740
All right. Well, that's it for our main topics. Brian, you got something you want to share with us

00:25:07.740 --> 00:25:12.460
just quickly at the end. Yeah, I was going to mention, so I did, we mentioned in my move,

00:25:12.460 --> 00:25:19.000
the move at work has been caused my schedule to be crazy. And I don't know when to interview people.

00:25:19.000 --> 00:25:24.240
If you've been paying attention to testing code, the episodes have been kind of solo episodes lately

00:25:24.240 --> 00:25:29.600
because I don't have to schedule myself. It's just whenever I can do it. And later on in July,

00:25:29.600 --> 00:25:34.560
things should settle down. And so if I've bugged you to do an interview or you've asked me

00:25:34.560 --> 00:25:39.220
and I haven't gotten back to you, get back to me again and we'll schedule that. So that should go

00:25:39.220 --> 00:25:42.800
on. Yeah, right on. You're doing a great job with testing code. There's a lot of stuff been coming

00:25:42.800 --> 00:25:47.800
out nice and steady and a lot of good shows there. All right. Thanks. How about you? Well,

00:25:47.800 --> 00:25:51.880
I just released another course that I've been working on for a couple of months on and off,

00:25:51.880 --> 00:25:56.560
and it's called Building Data-Driven Web Applications with Flask and SQLAlchemy,

00:25:56.560 --> 00:26:01.320
speaking of micro frameworks. So I had a similar course on Pyramid and a lot of people said,

00:26:01.420 --> 00:26:06.200
hey, Pyramid's awesome, but we really need to know Flask because that's what we use our

00:26:06.200 --> 00:26:10.360
company or that's what I'm trying to understand for a job or whatever. So I'm like, all right,

00:26:10.360 --> 00:26:15.660
well, let me go and build the Flask version of this course. So basically the idea is we spend about

00:26:15.660 --> 00:26:21.080
10 hours recreating PyPI.org from the ground up with Flask and SQLAlchemy.

00:26:21.080 --> 00:26:24.100
Oh, that's cool. Yeah. I'm going to have to check that out too.

00:26:24.100 --> 00:26:28.400
Yeah, absolutely. So people can check that out. Links from the show notes are just training.talkpython.fm.

00:26:28.400 --> 00:26:33.040
That's the latest course. And you know, no time to rest. As soon as we're done recording here,

00:26:33.040 --> 00:26:37.320
it's time to start the next, continue on the next one I'm working on. So I'm really excited to have

00:26:37.320 --> 00:26:41.280
this out. I think a lot of people will appreciate it. And it was really fun to write because you got

00:26:41.280 --> 00:26:43.760
to explore like a lot of these ideas we were just kind of just talking about.

00:26:43.760 --> 00:26:46.720
Yeah. I'll be hopefully working on a course here pretty soon too.

00:26:46.780 --> 00:26:51.020
I'm very excited about that. Yeah. I'm not really sure we're ready to share what the topic is yet,

00:26:51.020 --> 00:26:53.420
but it's going to be in high demand and very popular.

00:26:53.420 --> 00:26:57.900
Yeah. I'm looking forward to it. Yeah. Complete secret. Nobody will know what it is until it shows

00:26:57.900 --> 00:27:01.100
up. Yeah. Computer vision, IoT probably, but I'm not going to...

00:27:01.100 --> 00:27:05.560
Yeah, maybe. Yeah, sure.

00:27:05.560 --> 00:27:07.780
Or something else. Probably.

00:27:07.780 --> 00:27:13.060
Yeah. So speaking of jokes and sarcasm, a SQL query goes into a bar,

00:27:13.060 --> 00:27:15.740
walks up to two tables and asks, can I join you?

00:27:15.740 --> 00:27:19.100
I really like that.

00:27:19.100 --> 00:27:21.560
Yeah, it's pretty bad, but...

00:27:21.560 --> 00:27:22.060
That's good.

00:27:22.060 --> 00:27:22.880
It's a good one.

00:27:22.880 --> 00:27:29.040
Yeah. So I don't have a joke, but I saw this on Twitter and I tracked up.

00:27:29.040 --> 00:27:30.180
I did watch this. Yes.

00:27:30.180 --> 00:27:34.200
The reset procedure from GE light bulbs. It's so funny.

00:27:34.200 --> 00:27:36.960
These are smart, in quotes, smart light bulbs.

00:27:36.960 --> 00:27:37.300
Yeah.

00:27:37.300 --> 00:27:43.280
And you may have like paired them to your device, but then you lost your phone or you gave the

00:27:43.280 --> 00:27:47.280
light bulbs to your friend. You're like, well, how do I reset my light bulb? Right?

00:27:47.280 --> 00:27:52.140
Yeah. Because you can't just like turn it off and turn it on because that's what light bulbs do. So

00:27:52.140 --> 00:27:57.080
you have to do something else. And this procedure that they've got is hilarious. And it's like,

00:27:57.080 --> 00:28:01.840
turn it off for five seconds, then on for eight seconds, then off for two seconds,

00:28:01.840 --> 00:28:05.600
then on for eight seconds. And if you go through this like five times...

00:28:05.600 --> 00:28:09.380
It goes on and on because like, what if somebody accidentally turns it off for five seconds,

00:28:09.380 --> 00:28:13.860
on for two seconds, on for eight seconds, then off for eight seconds, but didn't mean to reset

00:28:13.860 --> 00:28:19.260
their bulb. You got to do like three more rounds of that. It's insane. Yeah. So yeah. Yeah. You will

00:28:19.260 --> 00:28:20.360
link to the video for that.

00:28:20.360 --> 00:28:26.040
At the end, it's like, if that didn't work, maybe it's an old firmware version. Try this other,

00:28:26.040 --> 00:28:27.400
even worse procedure.

00:28:29.460 --> 00:28:34.360
Awesome user interface experience. So I love it. What do you do when like the only interface you

00:28:34.360 --> 00:28:39.740
have is like power on power off? This apparently is it. Yeah. But the register like noted that you

00:28:39.740 --> 00:28:45.820
could put a hole in it and people could poke it with a like clothespin or whatever. Oh, you mean like

00:28:45.820 --> 00:28:51.740
my router and like all these other normal pieces of technology? Yeah. The reset button. Exactly.

00:28:51.740 --> 00:28:57.400
Yeah. Maybe they don't want people poking metal things into bulbs because it's like too close to

00:28:57.400 --> 00:29:03.380
poking it right to the socket. Because people are always poking metal into light sockets. Yeah.

00:29:03.380 --> 00:29:10.020
Exactly. Exactly. All right. Well, yeah, people can go check this out and it's intended to be

00:29:10.020 --> 00:29:13.760
serious, but it's actually kind of funny. Yep. All right. Well, thanks a lot, Michael.

00:29:13.760 --> 00:29:15.240
You bet. Thanks for being here. See you. Bye.

00:29:15.240 --> 00:29:20.040
Thank you for listening to Python Bytes. Follow the show on Twitter via at Python Bytes. That's

00:29:20.040 --> 00:29:25.720
Python Bytes as in B-Y-T-E-S. And get the full show notes at pythonbytes.fm.

00:29:25.720 --> 00:29:29.940
If you have a news item you want featured, just visit pythonbytes.fm and send it our way.

00:29:29.940 --> 00:29:34.540
We're always on the lookout for sharing something cool. On behalf of myself and Brian Okken,

00:29:34.540 --> 00:29:38.880
this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and