WEBVTT

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

00:00:04.040 --> 00:00:10.620
your earbuds. This is episode 161, recorded December 12th, 2019. I'm Michael Kennedy,

00:00:10.620 --> 00:00:15.280
and Brian Okken is not here today. Instead, we have a very special guest, Anthony Herbert.

00:00:15.280 --> 00:00:15.860
Welcome, Anthony.

00:00:15.860 --> 00:00:17.400
It's nice to be here. Thanks for having me.

00:00:17.400 --> 00:00:20.660
Yeah, it's great to have you here. You're doing all sorts of cool stuff in the Python space,

00:00:20.660 --> 00:00:23.540
and I'm looking forward to sharing some of the week's news with you.

00:00:23.540 --> 00:00:27.940
Also want to say thank you to DigitalOcean. They're sponsored this episode, as they have

00:00:27.940 --> 00:00:32.160
many, many of them. So check them out at pythonbytes.fm/digitalocean and get a $50

00:00:32.160 --> 00:00:38.520
credit for new users. Anthony, people might know you from your website Pretty Printed. You do a lot

00:00:38.520 --> 00:00:40.600
of stuff with Flask and things like that, right?

00:00:40.600 --> 00:00:41.000
Yeah.

00:00:41.000 --> 00:00:47.540
Yeah, cool. So people have checked that out. That's the same Anthony. And you're here with a bit of a

00:00:47.540 --> 00:00:54.260
contrarian story on getting stuff solved, right? And I actually really subscribe to this idea as well

00:00:54.260 --> 00:00:56.940
about using crappy code when it makes sense. Tell us about it.

00:00:56.940 --> 00:01:01.260
This is from a talk by Larry Hastings. It's called Solve Your Problem with Sloppy Python.

00:01:01.260 --> 00:01:07.360
And in this talk, he basically advocates solving personal problems with sloppy Python, not problems

00:01:07.360 --> 00:01:12.600
that you would have at work, because that would be a huge issue. So in the talk, he gives three or

00:01:12.600 --> 00:01:19.040
four examples of how he solves problems that he has encountered in his everyday life. And three of the

00:01:19.040 --> 00:01:24.320
four have to do with string manipulation. So renaming files. And I think that's something that

00:01:24.320 --> 00:01:29.100
everyone has had to deal with at some point. I know I have to deal with it all the time.

00:01:29.200 --> 00:01:35.520
And another example is a script that he uses to install all the packages after reinstalling an

00:01:35.520 --> 00:01:39.700
operating system. So instead of going through and trying to install each package individually,

00:01:39.700 --> 00:01:44.740
what he does is he just writes a script and it installs everything that he uses. So Sublime,

00:01:44.740 --> 00:01:47.480
Chrome, and even the latest versions of Python.

00:01:48.080 --> 00:01:52.740
And as an example of some of the sloppy code that he has, when he goes to install the latest versions

00:01:52.740 --> 00:01:58.740
of Python, all he does is he goes to python.org and he scrapes the latest version of Python there.

00:01:58.740 --> 00:02:03.060
So he gets the version number, then he can go and download the source for that, build the source.

00:02:03.060 --> 00:02:08.680
And then he has the latest version of Python installed without him having to actually do anything.

00:02:08.900 --> 00:02:13.120
Yeah, I didn't catch that he actually was using that to build from source. That's pretty funny. Yeah,

00:02:13.120 --> 00:02:17.680
but he's doing a lot of cool stuff. And I like this message. Like I said, I kind of subscribe to it.

00:02:17.680 --> 00:02:22.860
It's there are times that you should put tons of energy into structuring beautiful code that's very

00:02:22.860 --> 00:02:27.640
maintainable and very abstracted. And like you mentioned, Anthony, when you were doing this

00:02:27.640 --> 00:02:32.360
on a team, if you create crappy code, your team members are not going to like you. They're like,

00:02:32.360 --> 00:02:35.520
oh man, I don't want to go work on that part of the code. Because, you know,

00:02:35.920 --> 00:02:40.760
it's always like there's like two features and three bugs. It seems to be the ratio or something

00:02:40.760 --> 00:02:44.980
like that. Right. But there's all these little things that, you know, like you don't need to do

00:02:44.980 --> 00:02:48.320
a lot of error handling. You're just going to run it. And it's just, it just needs to do this thing.

00:02:48.320 --> 00:02:52.640
And you're the one person looking at it. And if it doesn't work, it's going to be obvious. You'll

00:02:52.640 --> 00:02:58.140
get a big stack trace or trace back, something like that. Right. What the reason I like it is it allows

00:02:58.140 --> 00:03:02.140
people to say, instead of spending a lot of work on building something fancy to solve my problem,

00:03:02.260 --> 00:03:06.220
I can spend 10 minutes and solve it for the rest of my life. Right? Right.

00:03:06.220 --> 00:03:08.840
Do you have situations in your world where you do that?

00:03:08.840 --> 00:03:14.140
I have to move files around all the time. And what tends to happen is like I start to do it and

00:03:14.140 --> 00:03:19.000
I feel a bit stubborn at times. So I just continue doing it manually. And then when I'm done,

00:03:19.000 --> 00:03:23.060
I realize, you know, oh, I could have written a script for that. So what this talk basically

00:03:23.060 --> 00:03:28.660
reminds me to do is think about automating at first and do as much as I can in code and then

00:03:28.660 --> 00:03:33.280
minimize the manual parts. Like there was something I did recently where I had to cut

00:03:33.280 --> 00:03:37.640
out pieces of audio files, like starting at a certain time step and ending at a time stamp.

00:03:37.640 --> 00:03:42.120
And I had to do that for about 30 files. And it took me a couple of hours to do this. And

00:03:42.120 --> 00:03:46.840
Audacity has the ability to be controlled by a Python script. So perhaps I could have written

00:03:46.840 --> 00:03:50.820
a script to do that for me automatically instead of sitting in my computer and messing with audio

00:03:50.820 --> 00:03:51.880
files for a couple of hours.

00:03:51.880 --> 00:03:55.560
Yeah. And you know, you can do that for a few hours, but eventually at some point you're like,

00:03:55.560 --> 00:04:01.400
this is really hard. And in my own world, I've had a lot of these experiences where I'm to the point

00:04:01.400 --> 00:04:05.680
where I'm like, maybe I should hire someone to do this. And then like, wait, wait, wait, I bet I could

00:04:05.680 --> 00:04:09.540
do this in Python, you know, and then two hours later it's automated. I'm like, why was I ever thinking

00:04:09.540 --> 00:04:14.720
that? What a fool. So I threw out some examples onto the show notes of stuff that I was doing as well.

00:04:14.720 --> 00:04:19.040
So there's a bunch of little things that just make my life so much easier. If I export

00:04:19.040 --> 00:04:24.220
course sale data, I use Stripe, I got to get it out of their format as an Excel

00:04:24.220 --> 00:04:29.420
CSV. And then I got to convert it to something else that I process and filter and so on. And I was

00:04:29.420 --> 00:04:35.800
doing that by hand for years. And I, why am I always going into the sheet, deleting these columns,

00:04:35.800 --> 00:04:40.760
copying this stuff over there. And I just wrote a Python script. Now it's one line of command line

00:04:40.760 --> 00:04:46.500
call, it runs a Python script, and it transforms my stuff into something I can just paste into

00:04:46.500 --> 00:04:51.900
the right, you know, sheet, a Google sheet, sort of calculation place. Another one is like,

00:04:51.900 --> 00:04:57.180
I always have like titles and stuff that I want to make into file names or folder names,

00:04:57.180 --> 00:05:03.240
you know, think the title of this show or the name of a lecture, a video lecture in a course,

00:05:03.240 --> 00:05:08.000
I want to take the title and make the file name that. So I wrote this thing called URLify. And it was

00:05:08.000 --> 00:05:13.400
like 20 lines of code because I was sick of lowercase and putting dashes for spaces, taking away the dots,

00:05:13.400 --> 00:05:17.840
you know, taking away the punctuation. And I put that in as a gist, people can have it, I do tons of reporting

00:05:17.840 --> 00:05:22.680
this way, the deployment on my server, I turn that into the script that I can use with Python,

00:05:22.680 --> 00:05:28.560
sort of does a bunch of stuff with actually AS, async and await in there, which is pretty cool.

00:05:28.560 --> 00:05:33.720
Importing information from video files, because I don't want to go there and copy like, it's this long,

00:05:33.720 --> 00:05:37.320
and its name is this. So now I can just point it at a directory and it'll just rip that out of there.

00:05:37.320 --> 00:05:42.500
Same thing for like duration of audio files. There's all these cool little things that were

00:05:42.500 --> 00:05:46.760
nagging me that I had to do all the time. And I'm just like, you know what, this is getting some Python

00:05:46.760 --> 00:05:52.800
on it. Yeah, sounds good. Absolutely. So I mentioned async and await. And the place where async and await

00:05:52.800 --> 00:05:59.640
seems to have the most power, right, is around, well, network stuff. So it's either on the server side,

00:05:59.640 --> 00:06:04.800
where you have a framework, that is some kind of web server that can scale out better,

00:06:04.800 --> 00:06:08.620
because the web methods are async and await, or a client, something like requests,

00:06:08.620 --> 00:06:13.440
more like HTTPX or something like that, that supports an async way to talk to a bunch of different

00:06:13.440 --> 00:06:20.060
services or websites. So the next thing I want to cover is this little write up by Florimund Manca.

00:06:20.060 --> 00:06:28.040
And it's the introduction to ASGI, the emergence of async Python web frameworks. We've probably all heard

00:06:28.040 --> 00:06:35.560
of WSGI or WSGI, right? That powers Flask, and powers things like Pyramid and Django and so on. That's the web

00:06:35.560 --> 00:06:42.780
service gateway interface. And it's, you've got a request, give me the answer. And that just doesn't work when you

00:06:42.780 --> 00:06:47.920
want to allow multiple requests all run at the same time, right? If I'm going to have a bunch of async stuff, I got to let

00:06:47.920 --> 00:06:54.980
some pause and let some new ones come in and all that kind of stuff. So one of the areas where I think there's a ton of

00:06:54.980 --> 00:07:00.800
growth, and I'd like to get your opinion on this, Anthony, is around these new Python web frameworks that used to seem

00:07:00.800 --> 00:07:05.880
really clear. Like, yeah, there's Flask, Django, Pyramid, a few others. And now there's a new one every week. I don't

00:07:05.880 --> 00:07:07.880
even know what to keep track of anymore. How do you feel?

00:07:07.880 --> 00:07:12.060
Yeah, and I don't know what to keep track of either. Like, I don't even know where to start. So I haven't,

00:07:12.060 --> 00:07:17.620
haven't really looked into any of them closely. Some people on my channel have been telling me to look into

00:07:17.620 --> 00:07:18.100
Sanic.

00:07:18.100 --> 00:07:20.220
Yeah, Sanic's got a lot of traction. Yeah.

00:07:20.220 --> 00:07:22.500
That was the first one I heard about a couple of years ago.

00:07:22.500 --> 00:07:23.720
And it's still going pretty strong.

00:07:23.900 --> 00:07:27.480
I haven't looked into it yet. And it seems interesting. Like I've done a little bit of

00:07:27.480 --> 00:07:32.900
Node stuff in the past. And I know this is bringing Node-like functionality to Python. So I want to look

00:07:32.900 --> 00:07:39.020
into it, but I haven't looked into it deeply yet. And I noticed that Django, they just released 3.0,

00:07:39.020 --> 00:07:45.160
and they have support for ASCI. I don't think it's completely functional yet, but the beginnings of

00:07:45.160 --> 00:07:46.840
it are there. So I should definitely look into it more.

00:07:46.840 --> 00:07:50.640
Yeah, for sure. The foundations are there. And if you're a Flask person like you are,

00:07:50.960 --> 00:07:53.980
probably the best thing to actually start with might be Quart.

00:07:53.980 --> 00:08:00.180
So I don't know if you've heard of Quart, but Quart is a 100% compatible, even with the extensions,

00:08:00.180 --> 00:08:06.440
plugins and stuff for Flask API, but it also allows for async and await on the view methods.

00:08:07.000 --> 00:08:11.320
So basically, the way you convert from Flask to Quart is you replace the word Flask with the word Quart.

00:08:11.320 --> 00:08:18.960
If it's lowercase Flask, it's lowercase Quart. If it's uppercase Flask, it's uppercase Quart. And that's it. And then you have async methods. You do have to run it on something like UVicorn.

00:08:19.620 --> 00:08:26.140
But yeah, that's probably the path of least resistance, but it also doesn't take advantage of necessarily the best new features, right?

00:08:26.140 --> 00:08:27.700
That seems easy. I can try that.

00:08:27.700 --> 00:08:28.860
Flask to Quart.

00:08:28.860 --> 00:08:43.580
Yeah, you could definitely try that. The thing is, when I first did that, and I tested it out, I'm like, all right, let's see how much faster this is. And I made the mistake of just running it as it traditionally had been. And it was running on a WSGI server. So it couldn't do any of the async stuff. I'm like, it's just the same.

00:08:43.620 --> 00:08:59.020
What a sham. This is not working at all. Like, oh, maybe I need a different server to enable this. Yes, that is what was missing. So yeah, it's pretty cool. And the thing is, the slower the external systems that you depend upon are, the better your performance is going to increase, right?

00:08:59.020 --> 00:09:08.760
So if your database responds in 10 milliseconds, you can handle more requests if you switch it to async and await. But you're kind of doing more work in that 10 millisecond window.

00:09:08.760 --> 00:09:21.200
But if you're talking to a database that takes two seconds, or web services that take two seconds, all of a sudden, you have a whole two seconds of what was blocked up web server to now go do kick off a whole bunch more waiting or something like that, right? So it's pretty cool.

00:09:21.200 --> 00:09:22.000
I'll look into that more.

00:09:22.000 --> 00:09:37.360
Yeah, nice. So they give a few reasons why you might care about this. So they say speed, obviously, they're doing some tests. And they say things like, well, they're getting 60 to 70,000 requests per second. Whereas like synchronous flask and Django do like 10 to 20,000.

00:09:37.660 --> 00:09:50.220
Right? I mean, performance is always one of those things that's very hard to measure. And if you had a very slow flask gap, like I was describing, you would get a much bigger percentage boost and so on. So pretty cool.

00:09:50.220 --> 00:10:02.660
Yeah, so they link to a couple of different tools you might use UVicorn, which is a like G unicorn, but based on uv loop, which is the C implementation of asyncio event loop.

00:10:03.660 --> 00:10:21.660
And plugged into G unicorn, that's a good foundational production server. And then Starlette seems to be one of the best async frameworks, like you mentioned Sanic, and I talked about court. Starlette seems to be the foundation. It's like the foundation of FastAPI and some other ones. And it's its own framework. So it's pretty good.

00:10:21.660 --> 00:10:34.480
There's a bunch of other things that are interesting, like HTTPX, as a replacement for requests, where you have async there, ORM, which is an asynchronous ORM, because if you don't have an async database call, then what are you waiting on usually?

00:10:34.480 --> 00:10:42.140
So a bunch of cool little things to bring together. And if you're getting interested in this async and await plus web frameworks, check out this article here. It's pretty nice.

00:10:42.140 --> 00:11:01.100
Speaking of nice, let me tell you all about Digilotion. They're making Kubernetes easier with their container registry and one click apps. So when you create a Docker image, Docker containers, you've got to have a Docker file that says, here's exactly how to construct my Docker container.

00:11:01.100 --> 00:11:11.700
Maybe it has some files it copies in and all that kind of stuff. But you probably don't want to put that onto some public place like Docker Hub. You might, but you may well be really reticent to do that.

00:11:11.700 --> 00:11:29.140
So Digilotion introduced a new managed service, the Digital Ocean Container Registry. And it's in early access now, but you can check it out. It's simple, private, secure and fast. And you don't have to put your Docker file definitions up there somewhere where you would rather not put them.

00:11:29.140 --> 00:11:37.120
So check them out at python.bytes.fm slash digitalocean. You just get a $50 credit to get started. So what's this next one you got here, Anthony?

00:11:37.120 --> 00:11:53.440
So this is a blog called Python Insights. And it's from someone named Tim Martin. And in this blog, he just talks about the internals of Python. So how Python works behind the scenes. Because oftentimes when we write Python, we don't really think about what's happening when it actually gets executed.

00:11:53.760 --> 00:12:02.900
So on the first page, for example, he has posts like how context variables work, how the import statement works, and how even Python is converted to bytecode.

00:12:03.440 --> 00:12:15.080
And one post that I saw that was pretty interesting was called dictionaries preserve order. So when I first learned Python, some years ago, one of the things that I learned about dictionaries is there's no ordering to them.

00:12:15.420 --> 00:12:22.220
Because, you know, they're just hash tables, you put things in, and there's no guarantee on what order they'll come back when you go to look at the entire dictionary.

00:12:22.460 --> 00:12:32.200
Well, apparently, since Python 3.6 or 3.7, there is ordering now. So the order in which you insert things into the dictionary is the order that is always going to be there.

00:12:32.200 --> 00:12:39.280
So every time you look at the dictionary, you're going to see the things in the order that you inserted them. And this is something that I would never have suspected.

00:12:39.760 --> 00:12:53.700
But they changed the implementation of how the memory of dictionaries work in Python. And this is something that he looked into. So he goes to explain how all that works, how hash tables work in general, and why the ordering is there now in 3.7.

00:12:53.700 --> 00:13:02.760
Yeah, nice. There's a bunch of just cool little insights, like take that idea and just dive into it and explain it. It seems like a good place, especially if you're getting started and you want to dig into those ideas.

00:13:02.760 --> 00:13:05.800
Yeah, the more you know about how it works, I think the better off you'll be.

00:13:05.800 --> 00:13:20.060
Yeah, it's kind of cool they finally decided to make dictionaries ordered, right? It lets them be used in a few more places where maybe you actually need ordering and you're like, well, I could use a list and that'll have the order, but it'll be slow to get the items out. But maybe that's the tradeoff we have to make. And now you don't have to.

00:13:20.060 --> 00:13:28.100
Right, right. And I noticed in 3.8, they add a reverse function as well. Dictionaries can work with reverse. So if you want to reverse your dictionary for whatever reason, you can.

00:13:28.100 --> 00:13:39.280
Yeah, that's really taking the order seriously. So this next one, since you're a big web developer, I think will be interesting to you. And you're into Flask. This one is called Assembly. Have you heard of it?

00:13:39.280 --> 00:13:39.920
I have not.

00:13:39.920 --> 00:13:49.860
Well, when somebody recommended it, Louise Honda sent this over and said, oh, you should check out Assembly. My first thought was like, Assembly language. Like, I'm really not interested in Assembly language.

00:13:49.860 --> 00:14:11.780
But you know, you said it's a web framework. So let me check this out. And it turns out that this is like an API on top of Flask. So it has its own API. But deep down, it's really Flask, right? And the idea is, this person who wrote this project said, I would like to build my web application using the concept of object oriented relationships.

00:14:11.860 --> 00:14:24.900
So for example, if you want to have just bare routes, so like maybe a, just a slash for your homepage, you want to slash about for your about slash contact for slash contact or something like that.

00:14:25.060 --> 00:14:45.780
All you do is you create a class called index. And then you have functions, one called index, one called home and call them about and it automatically sets up all the routing. And at first, it sounds like, ah, you know, okay, how much is this really buying me in terms of, and that right, I could put app dot route and put that in there, you know, maybe use a module to structure things that way.

00:14:45.780 --> 00:15:12.540
But as you look through this more and more, there's just like all of these features. So I put a link in here, it says decisions made for you plus features. And I'll just go through this. And Anthony, you tell me like how these ideas hit you all in this one framework. So it has smart routing, which I just described. It has class names as part of the URL. So if I have a class called user account, the URL will be of all the stuff in there will start be prefixed with user dash account.

00:15:13.540 --> 00:15:42.360
Class methods can also be accessed in the same way, right? It'll put dashes and whatnot. It has a RESTful API, it automatically figures out the view to render. So in the templates folder, if you have an index class, in there, you make a folder. In that folder, you create, you know, I said there's a slash about, you put in an about.html, and you'll automatically find that and render that as part of the template by just returning a dictionary. So I like that. Although you can edit it with route. It also has built in markdown support.

00:15:42.360 --> 00:15:46.380
So if you have a markdown file, it'll process it and convert it to HTML.

00:15:46.380 --> 00:15:47.420
Okay, that's nice.

00:15:47.420 --> 00:16:00.780
Yeah, that's cool, right? It has built in support for passwords, and it uses bcrypt, which is an awesome thing to do it. It has session based support, you can use Redis, AWS S3, SQLite, Postgres, all these things as back end support for that.

00:16:00.780 --> 00:16:15.580
It has Active Alchemy, which is a different take on SQLAlchemy. So SQLAlchemy uses unit of work where you start the unit of work, you do a bunch of stuff, and then you commit it. And this one is more Active Record, so each thing gets a change, but it's still SQLAlchemy underneath.

00:16:16.060 --> 00:16:33.960
I'll keep going, because these are cool, like cross-site request forgery on all posts automatically, idiomatic HTTP errors, storage can be like S3, mail support, arrow for time, caching, pagination, assets, signals for dispatching messages to other parts of your app, and a bunch of other stuff.

00:16:34.060 --> 00:16:37.140
So that's a lot of things to add on top of Basic Flask.

00:16:37.140 --> 00:16:56.240
Yeah, it is. All those extra features sound great. The main part that I noticed was, you know, using a class to organize your routes. And, you know, that's a little strange to me. I'm used to just writing functions that are part of Blueprints, because I think that works so well, that I haven't thought of a reason to switch that up.

00:16:56.240 --> 00:17:10.760
But I'll definitely look into it, because I'm sure there's a reason why this was done. Like, I don't like to dismiss things right away, because, you know, I don't understand it. Like, if they spent the time to build this library, then there's a good reason. So I'll look into it, and I'll see what the advantages are of using a class for this.

00:17:10.760 --> 00:17:24.280
Sure. My two impressions, like, to me, the things that seem like two advantages, there's some other stuff that I didn't mention about RESTful APIs and whatnot. But the two big ones seem to be automatic URL generation and grouping.

00:17:24.440 --> 00:17:52.900
So if I have got like a blog class, and then a, you know, latest post, like that latest method, it automatically says that slash blog slash latest, and I don't have to think about that. I think that is one part that's interesting. Stuff that's grouped in that class is clearly grouped in a URL hierarchy. And then the other is the automatic discovery and rendering of the template, right? If your template structure looks like the shape of your classes, then it'll just find the template without you saying flask render template and give the template name.

00:17:53.060 --> 00:17:56.780
I don't know if that's enough to win people over. But I think that that's what they're going for.

00:17:56.780 --> 00:18:00.760
Okay. Yeah. And I always name my templates the same as the function. So that would definitely help.

00:18:00.760 --> 00:18:10.600
Yeah, I try to do that too. But this thing just says, and we're going to use that to figure out what to render and whatnot. So it's pretty new. And I think this is one of the challenges. There's all these cool and exciting ideas.

00:18:11.440 --> 00:18:29.720
But it's just getting started. And you don't know which one is going to survive, right? Like, you've been doing a lot with flask. And you're like, well, maybe I should look at Sanic. But maybe Sanic won't be here in two months. So maybe I shouldn't look at Sanic. What else should I look at? There's just so much churn, which is beautiful, because there's all these things coming. But at the same time, it means it's really kind of hard to pick a horse in the race.

00:18:29.720 --> 00:18:43.560
Yeah, flask has a huge problem with this. Like flask itself is fine. But so many extensions, you know, they're, they get popular, then there are no more maintainers after just a few months. So you have to find a new library if you want to get the latest.

00:18:43.560 --> 00:18:49.680
Yeah. All right. This next thing you have is pretty interesting. Some physical hardware, huh?

00:18:49.680 --> 00:18:56.820
Yeah. So this is an article by Lennon. It's called building a standalone GPS logger with CircuitPython using Adafruit and particle hardware.

00:18:57.560 --> 00:19:07.060
So I've never done anything with hardware because it seems kind of mysterious to me. So reading this post was interesting because it kind of showed how straightforward it is.

00:19:07.060 --> 00:19:17.940
Like, obviously, you have to figure out what components you need to build something. But in terms of writing the code to control all this with CircuitPython, which is a version of Python for microcontrollers, it's pretty straightforward.

00:19:17.940 --> 00:19:26.220
It reminds me of, you know, taking data from an API and just writing it somewhere. So to like a database. So in this case, you know, you have the GPS logger.

00:19:26.440 --> 00:19:33.560
So that's like your API in a sense. You have data coming from that. And you just take that data and you put it somewhere else. So it's really that straightforward.

00:19:33.560 --> 00:19:41.600
Obviously, you have some code to check if the hardware is working properly. But the actual code to do what you want is pretty straightforward.

00:19:41.600 --> 00:19:50.780
So he built this GPS logger because he wanted a way to track his GPS location over time instead of just having like the current location like your phone gives you.

00:19:50.780 --> 00:19:50.980
Right.

00:19:50.980 --> 00:20:06.060
And in a way that doesn't just drain your battery. So he shows you what components he had to purchase and how he put them all together. And then he gives you the code that he wrote to control all this. And I find it quite interesting. It makes me want to think about hardware projects I can attempt.

00:20:06.220 --> 00:20:16.620
Yeah, it doesn't seem that out of reach. Right. And it's not too expensive. One of the things that I think is really challenging about these hardware projects and Adafruit makes it better because they have all these options.

00:20:16.620 --> 00:20:31.160
But I'm like, all right, maybe this microcontroller thing would work and it's $10 and I probably need a battery. I don't even know how to hook the battery to the microcontroller. And then I need the GPS thing. But will that hook on this? Or do I need a board? It's just like all the little parts. I'm like, what even goes together?

00:20:31.160 --> 00:20:34.940
And so one of the cool things is it's like, here are the seven things I used. Right?

00:20:34.940 --> 00:20:35.240
Yeah.

00:20:35.240 --> 00:20:35.800
Yeah, that's cool.

00:20:35.800 --> 00:20:42.220
Yeah. So it makes it approachable. And there are tons of tutorials as well for the beginners who want to get into hardware.

00:20:42.220 --> 00:20:50.380
So I think I'm pretty sure once you learn like the basics of, you know, what works with what, I think you can do similar things to what he's done in this tutorial.

00:20:50.380 --> 00:20:58.280
Yeah, that's cool. So if you wanted to like go skiing and have a little trace of every bit you've done, you could just throw it into your backpack or whatever.

00:20:58.280 --> 00:21:07.800
And just at the end of the day, it goes for like four days or something on its battery. It's got a little SD card, right? Take a little SD card out and you just, you have all your data. You do whatever you want with it.

00:21:07.800 --> 00:21:08.280
Sounds fun.

00:21:08.280 --> 00:21:20.020
Nice. So let me wrap up our main items here with a little article that folks can use to maybe make a case for using Python or learning Python at your organization or for yourself.

00:21:20.180 --> 00:21:34.920
And it's called 10 reasons Python is good to learn and pretty straightforward. So, you know, obviously Python is popular. If you go and throw Python and all the other major languages into Stack Overflow trends, it's ridiculous.

00:21:34.920 --> 00:21:49.380
I did this recently. A couple of years ago, Stack Overflow covered this and talked about, they wrote an article called The Incredible Growth of Python and they predicted Python just blowing past JavaScript and Java and all that and just really going and the others kind of going and flattening off.

00:21:49.380 --> 00:21:57.360
If you go and put those same things into Stack Overflow trends now, Python is even more popular than they predicted and the other ones are going down more than they predicted. It's ridiculous.

00:21:57.360 --> 00:22:07.120
And so the question kind of becomes why. And I think that this article touches on some of them. But before I talk about it really quickly, I just wanted to throw out this idea that I have.

00:22:07.120 --> 00:22:15.080
And it's that Python is a full spectrum language. And this is an idea I'm trying to popularize about why Python is popular.

00:22:15.080 --> 00:22:24.880
So on one hand, maybe, you know, let's think of like a scientist, a biologist or physicist or somebody who's, they don't think of themselves as a programmer. Let's just go with biology.

00:22:25.180 --> 00:22:30.880
But the person has all this data and they can't properly analyze it and say Excel.

00:22:30.880 --> 00:22:35.820
So they got to use some kind of programming sort of quotes thing to work with it.

00:22:35.820 --> 00:22:43.620
One option is they could use MATLAB, but MATLAB is like thousands of dollars, like $800 a year continuously plus all the add-ons.

00:22:43.620 --> 00:22:48.160
And the other thing is you can't build real apps with those kinds of projects, right?

00:22:48.160 --> 00:22:55.120
Like nobody builds YouTube with MATLAB or, you know, Windows with MATLAB. They just, it just doesn't do that.

00:22:55.120 --> 00:23:00.360
On the other hand, you could pick other things that can do those sorts of things like C++ or .NET or whatever.

00:23:00.360 --> 00:23:03.960
And you're hit right from the beginning with all the complexity.

00:23:03.960 --> 00:23:14.860
Like the biologist, instead of just being able to add a reference to a couple of libraries, not even write a function, just write like 10 lines of just straight in the script Python code that solves your problem.

00:23:14.860 --> 00:23:19.660
That would be Python. And say .NET, you've got to have a namespace. You've got to have a static class.

00:23:19.660 --> 00:23:23.020
You've got to have a public static void. You've got to have like all the compiling, like all that stuff.

00:23:23.020 --> 00:23:26.860
You know, it's just, it hits you right from the beginning that's there to build these major apps.

00:23:26.860 --> 00:23:34.900
And so I think Python, one of the reasons it's so popular in bringing in people from these sort of edge cases of programming and computation is they can start really easy.

00:23:35.020 --> 00:23:43.860
But then over time, they just add a little more and a little more and all of a sudden, you know, they're like, oh, I just actually use machine learning to study ancient manuscripts with Python.

00:23:43.860 --> 00:23:48.500
But I'm not even a developer. What just happened? You know, what do you think about this idea, Anthony?

00:23:48.740 --> 00:23:55.240
Yeah, I think that's why people like especially people who have absolutely no background in programming.

00:23:55.240 --> 00:23:59.860
Like what I notice is when they look at Python, they feel they can understand it.

00:23:59.860 --> 00:24:06.100
Whereas when they look at something like JavaScript or C or pretty much anything else, like it looks difficult.

00:24:06.660 --> 00:24:09.500
It could be the exact same, accomplish the same thing.

00:24:09.500 --> 00:24:11.660
But Python just looks more approachable.

00:24:11.660 --> 00:24:14.000
You can kind of read it and understand what's going on.

00:24:14.000 --> 00:24:15.420
So people love it for that.

00:24:15.420 --> 00:24:19.200
And I think that's why so many people new to programming go with Python first.

00:24:19.200 --> 00:24:22.760
Right. It draws them into like, oh, hey, I can actually program in Python.

00:24:22.760 --> 00:24:28.760
But then they grow into real programmers doing real cool stuff with like scientific libraries and other things or Flask or whatever.

00:24:28.760 --> 00:24:30.860
And then they're kind of hooked, right?

00:24:30.860 --> 00:24:31.700
Then they're in that space.

00:24:31.700 --> 00:24:33.660
And I think that's part of the secret of Python's growth.

00:24:33.660 --> 00:24:36.340
But let me go through my listicle here nonetheless.

00:24:36.340 --> 00:24:42.120
So the 10 reasons that they claim in this article that Python's good to learn is it's free and open source.

00:24:42.120 --> 00:24:43.180
Obviously nice.

00:24:43.180 --> 00:24:45.580
It's popular, loved, and wanted.

00:24:45.580 --> 00:24:51.320
Hat tip to the Stack Overflow survey where they ask those exact questions.

00:24:51.320 --> 00:24:52.240
Who uses this?

00:24:52.240 --> 00:24:54.160
Who loves the technology they use?

00:24:54.160 --> 00:24:56.040
And who wants to use some technology they're not?

00:24:56.040 --> 00:24:57.220
And Python always ranks high there.

00:24:57.220 --> 00:24:59.540
It has a friendly and devoted community.

00:24:59.540 --> 00:25:01.600
Of course, elegant and concise syntax.

00:25:01.600 --> 00:25:05.800
Not all those semicolons and curly braces and type specifications.

00:25:05.800 --> 00:25:09.820
It's multi-platform for most of the platforms at least.

00:25:09.820 --> 00:25:12.440
Supports multiple programming paradigms.

00:25:12.440 --> 00:25:22.020
Just like no functions straight down the script versus actual functions versus functional programming versus object-oriented programming and so on.

00:25:22.020 --> 00:25:25.340
It has tons of libraries built in and third party.

00:25:25.580 --> 00:25:29.540
It's a general purpose programming library unlike my example with MATLAB.

00:25:29.540 --> 00:25:33.520
You can do stuff in it until you hit the limit that you just can't do anything else.

00:25:33.520 --> 00:25:35.540
And then it also integrates with other languages.

00:25:35.540 --> 00:25:37.040
C, C++.

00:25:37.040 --> 00:25:38.440
It's got tons of integration there.

00:25:38.440 --> 00:25:39.460
It has Rust integration.

00:25:39.460 --> 00:25:42.700
It has .NET integration and a bunch of cool stuff like that.

00:25:42.820 --> 00:25:48.820
So, anyway, there's a bit of a take on why Python is good to learn or why people are adopting it.

00:25:48.820 --> 00:25:49.820
All right.

00:25:49.820 --> 00:25:52.000
Well, Anthony, that does it for our main items.

00:25:52.000 --> 00:25:56.000
We've got a couple of, a little bit of time to just talk about a few extra things.

00:25:56.000 --> 00:25:59.100
Maybe you start first and tell us about what's going on in your world.

00:25:59.420 --> 00:26:02.000
I'm from prettyprinted.com and mostly the YouTube channel.

00:26:02.000 --> 00:26:04.580
So, URLs for YouTube are a little tricky.

00:26:04.580 --> 00:26:07.740
So, if you just go to YouTube and search for Pretty Printed, you'll find my channel.

00:26:07.740 --> 00:26:10.600
And I basically talk about Python web development there.

00:26:10.600 --> 00:26:15.420
I occasionally talk about other topics, but it's mostly Blask and Django that I talk about there.

00:26:15.420 --> 00:26:20.420
And then on my website, I have courses that I have available and I'm also trying to write more.

00:26:20.420 --> 00:26:23.840
So, hopefully, you'll see some articles there soon as well.

00:26:23.840 --> 00:26:25.340
So, that's what I do.

00:26:25.340 --> 00:26:28.000
And if you watch my videos, that would be great.

00:26:28.100 --> 00:26:28.500
Yeah, awesome.

00:26:28.500 --> 00:26:29.460
Yeah, you're doing good work.

00:26:29.460 --> 00:26:33.860
So, I have four quick announcements, maybe three announcements and a follow-up there.

00:26:33.860 --> 00:26:40.440
So, I was just a guest on the .NET Rocks podcast talking about Python for the .NET developer.

00:26:40.440 --> 00:26:46.900
So, if people are into .NET and they want to hear what does the world of Python look like from that perspective,

00:26:46.900 --> 00:26:52.080
maybe you're working at a company that mostly is a .NET shop, but you really love Python, right?

00:26:52.080 --> 00:26:52.700
Check that out.

00:26:52.700 --> 00:26:56.120
You can share that with your co-workers about why they should maybe pay a little more attention.

00:26:56.340 --> 00:26:59.360
So, I got a link to that episode that just came out yesterday.

00:26:59.360 --> 00:27:01.580
I got a link to that in the show notes.

00:27:01.580 --> 00:27:05.560
And then I also kind of tied together with that, these sort of one precipitated the other,

00:27:05.560 --> 00:27:10.120
is I've just released a new nine-hour course called Python for the .NET developer.

00:27:10.620 --> 00:27:17.740
So, the goal is to help all these .NET people take their skills like they know how to talk to databases using any framework or create websites using ASP.NET,

00:27:17.740 --> 00:27:24.660
like recreate all of that, take those examples and then recreate them in Flask or SQLAlchemy or so on.

00:27:24.660 --> 00:27:27.340
So, that's a really fun course if you're into the .NET space.

00:27:27.340 --> 00:27:30.460
Also, another course, Python for Decision Makers.

00:27:30.460 --> 00:27:35.500
Like, if you're thinking about whether Python makes sense for your organization or your team, check that out as well.

00:27:35.500 --> 00:27:37.060
Links to all those are in the show notes.

00:27:37.060 --> 00:27:46.320
And then finally, a couple episodes ago, I was talking to Brian saying one of the reasons I call my virtual environment folder, V-E-N-V,

00:27:46.320 --> 00:27:48.200
is it doesn't show up in Finder.

00:27:48.200 --> 00:27:52.920
And when I'm cruising through Finder and I get to one of my courses or one of my old projects,

00:27:52.920 --> 00:27:55.820
I want to be able to just look really quickly and say, does this have a virtual environment?

00:27:55.820 --> 00:27:59.460
Or do I need to hop over to the terminal and create one real quick?

00:27:59.460 --> 00:28:04.320
And by default, if it's .ENV, which many times it has been, it's hidden.

00:28:04.320 --> 00:28:04.920
You don't know.

00:28:04.920 --> 00:28:08.100
You've got to go in there and go into the terminal and just find out.

00:28:08.100 --> 00:28:10.600
It's not hard, but it's not like immediately obvious.

00:28:10.600 --> 00:28:12.080
It requires a little step, right?

00:28:12.080 --> 00:28:14.760
So, many people, too many to name.

00:28:14.760 --> 00:28:17.680
I mean, many people sent me this message, which kind of blew my mind.

00:28:17.780 --> 00:28:23.500
It said, if you're in Finder and you want to see hidden files, you hit Command, Shift, Dot,

00:28:23.500 --> 00:28:25.840
and it will refresh with all the hidden files.

00:28:25.840 --> 00:28:27.800
So, you see your .files and your .folders and whatnot.

00:28:27.800 --> 00:28:28.960
Did you know about this, Anthony?

00:28:28.960 --> 00:28:30.980
I did not because I do not use Mac.

00:28:30.980 --> 00:28:32.580
Right.

00:28:32.580 --> 00:28:34.240
So, this is not a problem that you have, right?

00:28:34.240 --> 00:28:34.960
What do you use?

00:28:34.960 --> 00:28:35.280
Windows?

00:28:35.280 --> 00:28:36.160
Yes, Windows.

00:28:36.160 --> 00:28:38.620
And I use the Linux subsystem.

00:28:38.620 --> 00:28:38.940
Nice.

00:28:38.940 --> 00:28:39.600
Yeah.

00:28:39.600 --> 00:28:41.720
And in Windows, this is more of a setting, right?

00:28:41.720 --> 00:28:46.840
You set in the Explorer, File Explorer, you say, I would like to see hidden files or not see hidden files.

00:28:47.360 --> 00:28:48.920
But in Mac, there's no such setting.

00:28:48.920 --> 00:28:50.200
So, apparently, it's a hot key.

00:28:50.200 --> 00:28:50.980
All right.

00:28:50.980 --> 00:28:52.700
Well, that's all my announcements as well.

00:28:52.700 --> 00:28:54.600
We always close this out, Anthony, with a joke.

00:28:54.600 --> 00:28:55.600
So, are you ready for a joke?

00:28:55.600 --> 00:28:59.500
By the way, I also would like to point out that they're not always funny, but we always try.

00:28:59.500 --> 00:29:00.320
Okay.

00:29:00.320 --> 00:29:00.740
I'm ready.

00:29:00.740 --> 00:29:01.480
All right.

00:29:01.920 --> 00:29:07.740
So, here, speaking of different languages and all that, here's a failed pickup line.

00:29:07.740 --> 00:29:10.420
So, this girl's hanging out with her friends at a bar.

00:29:10.420 --> 00:29:11.960
They're just hanging around.

00:29:11.960 --> 00:29:14.120
Some guy's like, wow, I'd really like to meet her.

00:29:14.120 --> 00:29:16.480
Maybe I could come up and say something clever.

00:29:16.480 --> 00:29:17.980
She looks like she might be a programmer.

00:29:17.980 --> 00:29:19.960
Maybe I'll say some computer thing.

00:29:19.960 --> 00:29:23.960
Comes up and he says, you know, maybe he's been watching too much of Jerry Maguire.

00:29:23.960 --> 00:29:26.560
He's like, you're the semicolon to my line of code.

00:29:27.280 --> 00:29:28.720
She responds, get out of your creep.

00:29:28.720 --> 00:29:29.400
I code in Python.

00:29:29.400 --> 00:29:34.440
You know, that might be the reason number 11 to learn Python.

00:29:34.440 --> 00:29:35.320
Yes, exactly.

00:29:35.320 --> 00:29:36.600
You can come up with better pickup lines.

00:29:36.600 --> 00:29:37.240
Exactly.

00:29:37.240 --> 00:29:39.060
You don't have to take that semicolon thing.

00:29:39.060 --> 00:29:41.740
No, it's pretty funny.

00:29:41.740 --> 00:29:42.060
All right.

00:29:42.060 --> 00:29:45.620
Well, Anthony, thank you for filling in for Brian and being here today.

00:29:45.620 --> 00:29:48.340
It was great to spend some time with you and talk about these ideas.

00:29:48.340 --> 00:29:49.580
And thanks for having me here.

00:29:49.580 --> 00:29:49.900
You bet.

00:29:49.900 --> 00:29:50.180
Bye.

00:29:50.180 --> 00:29:50.480
Bye.

00:29:50.480 --> 00:29:52.420
Thank you for listening to Python Bytes.

00:29:52.420 --> 00:29:54.960
Follow the show on Twitter via at Python Bytes.

00:29:55.060 --> 00:29:57.800
That's Python Bytes as in B-Y-T-E-S.

00:29:57.800 --> 00:30:01.040
And get the full show notes at Python Bytes.fm.

00:30:01.040 --> 00:30:05.260
If you have a news item you want featured, just visit Python Bytes.fm and send it our way.

00:30:05.260 --> 00:30:07.940
We're always on the lookout for sharing something cool.

00:30:07.940 --> 00:30:11.060
On behalf of myself and Brian Okken, this is Michael Kennedy.

00:30:11.060 --> 00:30:14.500
Thank you for listening and sharing this podcast with your friends and colleagues.

