WEBVTT

00:00:00.001 --> 00:00:05.440
Hello, and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.

00:00:05.440 --> 00:00:09.400
This is episode 38, recorded August 7th, 2017.

00:00:09.400 --> 00:00:14.300
I'm Brian Okken, and we have guest hosts filling in for Michael while he's on vacation.

00:00:14.300 --> 00:00:17.740
This week, we have Matt Makai from Full Stack Python.

00:00:17.740 --> 00:00:18.160
Hey, Brian.

00:00:18.160 --> 00:00:22.760
Hey. Now, you also worked with Michael on the Python Entrepreneur course, right?

00:00:22.760 --> 00:00:28.620
Yeah, exactly. And I've been on Michael's podcast a couple of times, so he's always a great interviewer.

00:00:28.620 --> 00:00:36.340
Yeah, I was having trouble not grinning and laughing during that, because I'm usually waiting for Michael to get done with the intro.

00:00:36.340 --> 00:00:41.100
So, hey, thanks a lot for stepping up and helping us with this show this week.

00:00:41.100 --> 00:00:45.780
Yeah, I'm happy to help while Michael's taking a nice little vacation so he can come back all rested and ready to go.

00:00:45.780 --> 00:00:52.420
And first off, I've got you starting, because why not? This is from a talk at PyCon, is that right?

00:00:52.420 --> 00:00:56.100
Yeah, so I was at PyCon this year. I try never to miss it.

00:00:56.100 --> 00:01:01.600
I would unfortunately miss PyCon last year, and I vowed never again, because it's just my favorite event every single year.

00:01:01.600 --> 00:01:03.540
So I caught this talk.

00:01:03.540 --> 00:01:08.880
This is actually my colleague Sam Agnew's talk, which was called Hacking Classic Nintendo Games with Python.

00:01:09.540 --> 00:01:15.260
And the gist here was he was using a Nintendo emulator named FCEUX.

00:01:15.260 --> 00:01:20.200
I actually don't know if that has a better pronunciation or whether people say it by the letters all the time.

00:01:20.200 --> 00:01:28.640
But he used that in order to change old school Nintendo games he was playing and interact with the audience during that PyCon talk.

00:01:28.640 --> 00:01:29.320
It was pretty awesome.

00:01:29.320 --> 00:01:33.820
I missed it. So tell us a little bit more about this hacking Nintendo games.

00:01:33.820 --> 00:01:37.440
Yeah, sure. So Sam was inspired by the PyNES project.

00:01:37.440 --> 00:01:43.800
And he basically saw that you could use Python to interact with Nintendo games.

00:01:43.800 --> 00:01:50.840
And since he grew up on playing the old school NES Nintendo system, he wanted to use some of the old games that he had.

00:01:51.280 --> 00:02:00.640
And basically emulate the games themselves, but also the way that the old Game Genie system worked, which was by hex editing the memory of the game itself.

00:02:00.640 --> 00:02:09.400
And so what Sam did in this talk was he created a little Lewis script, which would change the hex values in memory of a game.

00:02:09.400 --> 00:02:15.020
And then he created a Python application that attendees at the talk could text in different hex codes.

00:02:15.180 --> 00:02:19.320
And he was playing the game while attendees were changing the game on him.

00:02:19.320 --> 00:02:22.880
So it was kind of like adding cheat codes to the game while he was playing.

00:02:22.880 --> 00:02:31.440
So it was really cool to see sort of how he was able to interact with the audience, but also play some games that kind of brought out a little bit of the nostalgia factor.

00:02:31.440 --> 00:02:32.400
Oh, that's cool.

00:02:32.400 --> 00:02:34.400
Yeah, I'll have to check that out.

00:02:34.400 --> 00:02:45.740
And the one other thing I really liked about it was he made certain topics that sound pretty intimidating, like hex editing memory values into what I think is a relatively beginner-friendly way to introduce it.

00:02:45.740 --> 00:02:53.300
He basically takes the hex memory values, explains what they do, and then you can see the results when you edit the values.

00:02:53.300 --> 00:02:56.540
So definitely a topic or a talk worth checking out.

00:02:56.540 --> 00:03:02.560
And he also wrote a companion blog post that explains everything about what he did throughout the talk.

00:03:02.940 --> 00:03:11.160
Okay. I admit this morning I watched like just a small portion of it, and I just got to the point where he like changed the time.

00:03:11.160 --> 00:03:15.620
Like there was a game running, and we were watching the time left.

00:03:15.620 --> 00:03:16.640
He paused the game.

00:03:16.640 --> 00:03:18.520
Yeah, in Super Mario Brothers, the first one.

00:03:18.520 --> 00:03:20.020
Yeah, Super Mario Brothers.

00:03:20.020 --> 00:03:26.300
And then he changed the time back down to like zero, and suddenly, you know, his character died.

00:03:26.300 --> 00:03:28.000
And he said, okay, so that's how you hack it.

00:03:28.000 --> 00:03:28.820
The talk's over.

00:03:30.140 --> 00:03:35.960
Exactly, and he did that just through editing hex memory values directly to change the time, which was pretty nuts.

00:03:35.960 --> 00:03:38.380
So there was Lua involved also.

00:03:38.380 --> 00:03:40.320
So I was confused.

00:03:40.320 --> 00:03:48.400
I haven't watched the whole thing, but is the editing of the game in Lua and the Python was for the Flask app?

00:03:48.700 --> 00:03:54.520
Yeah, so the emulator itself, there's multiple emulators you can use in order to run NES games.

00:03:54.520 --> 00:04:00.800
But the one that he was most comfortable with actually had embedded Lua in order to script editing the hex memory values.

00:04:00.800 --> 00:04:08.800
So really, Lua was only being used to input the hex values into the memory and then read from a file that Python was writing to.

00:04:09.020 --> 00:04:18.520
So you can think of, like, there was a file on the system where his Python application was inputting into that file, and then Lua was reading from it and just shoving it into memory to change the game.

00:04:18.520 --> 00:04:22.220
So it was basically a file was being used as a bridge between Python and Lua.

00:04:22.220 --> 00:04:23.360
Okay, great.

00:04:23.360 --> 00:04:24.000
Cool.

00:04:24.880 --> 00:04:29.500
I love that the Python talks are recorded.

00:04:29.500 --> 00:04:38.580
And to be honest, when I was there, I didn't go to very many talks, but I just spend the year between Pycons just watching all of the old ones.

00:04:38.580 --> 00:04:39.340
Yeah.

00:04:39.340 --> 00:04:40.620
So, yeah.

00:04:40.620 --> 00:04:41.560
So, Nick.

00:04:41.560 --> 00:04:41.940
That's awesome.

00:04:41.940 --> 00:04:48.220
Speaking of conferences, I wanted to bring up an article that Eric Holscher put out just recently.

00:04:48.720 --> 00:04:55.440
And apparently, he brings it up at the beginning of his talks a lot, and he calls it the Pac-Man rule at conferences.

00:04:55.440 --> 00:05:04.060
And it's just a short little article, but I really like the visual of the little Pac-Man with a little gap.

00:05:04.060 --> 00:05:15.860
So the idea, and I'm just going to quote exactly what he says, is when you've got a bunch of people in a group, like when you're meeting new people at conferences or something, to make sure that there's a gap.

00:05:15.860 --> 00:05:20.500
So when standing in a group of people, always leave room for one person to join your group.

00:05:20.500 --> 00:05:27.420
Leaving room for new people when standing in a group is a physical way to show an inclusive and welcoming environment.

00:05:27.420 --> 00:05:38.600
And just the whole idea, I know that I started out totally as an introvert because I got into programming, not because I really enjoy hanging out with people.

00:05:38.840 --> 00:05:45.540
So it is a stretch for a lot of people, including myself, to try to go up to new groups of people and join conversations.

00:05:45.540 --> 00:05:56.000
And I thought this was a great tip to, when you're having a conversation in a group, to make sure that you're physically showing and visually showing that you're welcoming new members.

00:05:56.000 --> 00:05:57.760
Yeah, I agree.

00:05:57.900 --> 00:06:00.280
It's almost like pattern matching for developers.

00:06:00.280 --> 00:06:07.820
When there is a, when there's room for one more person, you feel much more comfortable with just sort of approaching the group and, and asking people what they're talking about.

00:06:07.820 --> 00:06:20.160
So I think it's really good advice, both on the side where you're in a group already, but also when you're not in a group that, Hey, there's, there's some people that may want to talk to you and they've left you a spot at the table or where they're standing.

00:06:20.340 --> 00:06:22.040
So Eric did a great job on this.

00:06:22.040 --> 00:06:23.280
Yeah, I think it's great.

00:06:23.280 --> 00:06:25.200
That was just a short one.

00:06:25.200 --> 00:06:29.600
And, you're going to talk about something that I really haven't had a chance to play with yet.

00:06:29.600 --> 00:06:36.080
And that's except for, I've had a chance to mispronounce it on this podcast and it's bokeh.

00:06:36.080 --> 00:06:36.700
Yeah.

00:06:36.700 --> 00:06:43.420
So if you take a look at the website, it actually can be pronounced two different ways, bokeh and bokeh.

00:06:43.420 --> 00:06:46.300
So chances are you pronounced it correctly.

00:06:46.300 --> 00:06:48.040
You just thought you incorrect.

00:06:48.040 --> 00:06:51.360
We were incorrect in your pronunciation, but bokeh.

00:06:51.360 --> 00:06:55.260
I usually just say bokeh is a, is a Python data visualization library.

00:06:55.260 --> 00:06:59.620
And the output is designed for presentations in web browsers.

00:06:59.620 --> 00:07:02.400
So you don't have to write any JavaScript.

00:07:02.400 --> 00:07:10.720
So, if you've ever used D3 JS, which is a fantastic data visualization tool, it's got a really steep learning curve.

00:07:10.720 --> 00:07:16.200
So if you really have just spent a lot of time in Python land, you can use bokeh to generate.

00:07:16.200 --> 00:07:19.820
These amazing data visualizations that are rendered in the browser.

00:07:19.820 --> 00:07:21.980
and you don't have to write any JavaScript yourself.

00:07:21.980 --> 00:07:25.100
So that's one thing that I love about this, this library.

00:07:25.100 --> 00:07:33.100
And so I highly recommend you check it out because it just had a new release, which was, V 0.12.6.

00:07:34.040 --> 00:07:35.120
Just back in June.

00:07:35.120 --> 00:07:42.960
And it had a whole bunch of improvements and they're, this development team is doing an amazing job and they're gearing up for a 1.0 release, which I think is just going to make it.

00:07:42.960 --> 00:07:46.280
I think it's going to make this library very, very popular very soon.

00:07:46.720 --> 00:07:48.940
For visuals in creating visuals in Python.

00:07:48.940 --> 00:07:52.220
The one thing I have used is Matt plot lip.

00:07:52.220 --> 00:08:01.080
So is there a kind of a rule of thumb or of when to use generating plots on the, on the client side versus the server side or.

00:08:01.080 --> 00:08:02.860
Yeah, no, I think that's a good question.

00:08:02.860 --> 00:08:06.720
And, and I haven't used Matt plot plot lip as much as okay.

00:08:06.720 --> 00:08:12.260
I've only used it a bit in Jupyter notebooks, my rough rule of thumb, but I could be totally wrong.

00:08:12.260 --> 00:08:14.760
So I would love to get emails if, if it's different.

00:08:14.760 --> 00:08:16.640
My general rule of thumb is okay.

00:08:16.640 --> 00:08:21.120
Is really fantastic for creating interactive visualizations in web applications.

00:08:21.120 --> 00:08:32.240
You can certainly use it in Jupyter notebooks as well, but I see Matt plot live as being sort of the quick and dirty solution to visualizing data in Jupyter notebook.

00:08:32.480 --> 00:08:33.160
scripts.

00:08:33.160 --> 00:08:35.360
So I would typically use Matt plot live.

00:08:35.360 --> 00:08:39.640
If I'm doing something that's like super early, I'm doing exploratory data analysis.

00:08:39.640 --> 00:08:44.100
Whereas bouquet is sort of the building a beautiful dashboard and you want bar charts.

00:08:44.100 --> 00:08:50.920
So you want some sort of interactive visualization that you can then have end users be working with.

00:08:50.920 --> 00:08:51.300
Okay.

00:08:51.300 --> 00:08:53.260
I think that's a great explanation.

00:08:53.260 --> 00:08:55.600
So yeah, I'll have to check this out.

00:08:55.600 --> 00:08:55.840
Yeah.

00:08:55.840 --> 00:08:57.220
So, and that's, and that's bouquet.

00:08:57.220 --> 00:09:00.880
And, and I actually, what's, what's funny is we, it always goes back to PyCon.

00:09:01.000 --> 00:09:03.660
I found out about this library at PyCon in 2015.

00:09:03.660 --> 00:09:14.600
Sarah Bird, who works on the core library, gave a fantastic talk where she essentially built an entire data visualization map, geomapping data visualization, like during her talk.

00:09:14.600 --> 00:09:16.220
And I was like, this is, this is incredible.

00:09:16.220 --> 00:09:18.560
So then I got a chance to use it a little bit.

00:09:18.560 --> 00:09:22.460
I wrote a flask tutorial on full stack Python that uses bouquet.

00:09:22.460 --> 00:09:28.920
And that's why I've been sort of, I don't want to say evangelizing, but I've been telling people how, how enjoyable it is to use this library.

00:09:29.260 --> 00:09:29.700
Yeah.

00:09:29.700 --> 00:09:30.140
That's great.

00:09:30.140 --> 00:09:30.600
Cool.

00:09:30.600 --> 00:09:31.640
I'll have to check it out more.

00:09:31.640 --> 00:09:32.460
Definitely.

00:09:32.460 --> 00:09:40.560
Well, next I've got another, another tool that I actually haven't used yet, but I just heard about it recently.

00:09:40.560 --> 00:09:45.300
And it's a tool called Mosh, which is a, it's a mobile shell.

00:09:45.640 --> 00:09:50.340
And the idea around it, it's kind of replacing SSH.

00:09:50.340 --> 00:10:00.160
So if you have to have a connection to another instrument to run command line commands and you, now we live in a time where we've often work on laptops.

00:10:00.300 --> 00:10:09.260
And then you close your laptop and go home or go somewhere else and open it up again, that connection's gone and you've got to reestablish your SSH.

00:10:09.260 --> 00:10:18.060
And there's also, you know, there's other problems with, with SSH, with keystroke, when you're displaying the interactiveness.

00:10:18.060 --> 00:10:26.200
And Mosh is an attempt to basically go down all the way to the protocol layer and redefine what gets transferred back and forth.

00:10:26.380 --> 00:10:31.820
There's a YouTube video that we're going to link to that it's actually, it's back from 2012.

00:10:31.820 --> 00:10:40.520
And it's very convincing as to why we would want to do mobile applications differently than we've done them in the past at just the byte level.

00:10:40.520 --> 00:10:44.580
I'm just kind of wondering if people use, are using it.

00:10:44.580 --> 00:10:47.920
And that's just why I brought it up is it looks cool.

00:10:47.920 --> 00:10:48.960
I want to try it.

00:10:48.960 --> 00:10:50.440
I wonder if anybody else has used it.

00:10:50.440 --> 00:11:00.640
And I haven't used Mosh myself, but it seems like SSH is a protocol that was designed to disconnect every single time I'm trying to write some code in front of an audience.

00:11:00.640 --> 00:11:14.360
So I will definitely have to check this one out, especially when I'm doing live code demos, because when your SSH connection drops in front of an audience and you've got to reconnect, it can be, it can be a real pain.

00:11:14.460 --> 00:11:15.280
So this is pretty awesome.

00:11:15.280 --> 00:11:26.060
And the video actually is of a, he's doing a, there's, I don't know who's in the presentation, but there's a person presenting and they, they're connected to another system.

00:11:26.060 --> 00:11:33.160
And right in the middle of typing a command, he changes his wifi connection to a different connection.

00:11:33.300 --> 00:11:35.060
And it just works.

00:11:35.060 --> 00:11:36.600
It like fixes itself.

00:11:36.600 --> 00:11:37.500
So it's cool.

00:11:37.500 --> 00:11:37.980
It's great.

00:11:37.980 --> 00:11:45.200
This is great having you on because you're talking about just about a bunch of things I've never, I've never used, but definitely heard about.

00:11:45.200 --> 00:11:49.220
And well, hopefully I get you excited enough to use them because there's some of my favorite tools.

00:11:49.220 --> 00:11:55.360
And the next up is a Pelican is full stack on use doing, do you use Pelican for full stack?

00:11:55.360 --> 00:11:55.820
I do.

00:11:55.820 --> 00:11:56.160
Yeah.

00:11:56.160 --> 00:12:02.920
So a full stack Python, people luckily noticed that it's pretty snappy and that's because it's not, it has no database backend.

00:12:02.920 --> 00:12:07.580
It's all just a bunch of flat files that are served up by a content delivery network.

00:12:07.580 --> 00:12:09.180
And that's all generated.

00:12:09.180 --> 00:12:12.320
I don't handwrite HTML, at least not for fun.

00:12:12.320 --> 00:12:16.780
I generate that with Pelican, which is a static website generator.

00:12:16.780 --> 00:12:22.880
So the way that I think about it is like static website generators basically have, I would say like three parts.

00:12:22.880 --> 00:12:28.520
You have your content, which might be written in restructured text or markdown, some sort of markup format.

00:12:28.520 --> 00:12:31.220
The second part would be a template engine.

00:12:31.220 --> 00:12:39.200
So most likely Jinja, a lot of people who use Django are used to the Django template engine, but Pelican's kind of built out of the box with Jinja.

00:12:39.660 --> 00:12:45.160
And then you have some Python code that puts the two together and then outputs typically HTML.

00:12:45.160 --> 00:12:50.560
It can also be other formats like XML or JSON, really any sort of output that you want.

00:12:50.560 --> 00:12:57.280
That is a file format, but I output HTML and then you can take those HTML files and you can host them anywhere.

00:12:57.520 --> 00:13:01.820
So the power is you have all your content in the markup format.

00:13:01.820 --> 00:13:05.120
So it's not like you're, again, modifying HTML directly.

00:13:05.120 --> 00:13:10.800
The static site generator does all the work for you with its, well, what are called generators.

00:13:10.800 --> 00:13:15.300
The Python code creates, takes in the input and then outputs those, those file formats.

00:13:15.300 --> 00:13:17.080
And then you can just, you can host them anywhere.

00:13:17.080 --> 00:13:22.960
So the way that I think about it is that it's a, it's kind of like a throwback to the early days of the web when everything was like really snappy.

00:13:22.960 --> 00:13:28.220
It was because you weren't connecting to databases via web application.

00:13:28.220 --> 00:13:34.980
It was just because you were being served up a single file or some multiple files that are basically just flat files.

00:13:34.980 --> 00:13:35.480
Yeah.

00:13:35.480 --> 00:13:37.840
There may be some Pearl on the back end, but.

00:13:37.840 --> 00:13:44.600
One of the things that's great about Pelican is, so it's, it's in under active development.

00:13:44.600 --> 00:13:52.120
And so the latest releases version 3.7.1, 3.7.0 was released at the end of 2016.

00:13:52.120 --> 00:13:57.160
And that was like a major bump with a lot of good Python three compatibility.

00:13:57.160 --> 00:14:00.960
In fact, I only use Python three six with Pelican now.

00:14:00.960 --> 00:14:01.880
It works fantastic.

00:14:01.880 --> 00:14:08.020
So it's ready to go Python three out of the box and it's had a bunch of major work done to it.

00:14:08.020 --> 00:14:09.380
A lot of bug fixes recently.

00:14:09.380 --> 00:14:14.500
So under active development, that's one of the things there's so many static site generators that are out there.

00:14:14.500 --> 00:14:17.980
It's relatively easy to create one as sort of a side project.

00:14:17.980 --> 00:14:20.140
But this one has been around for a long time.

00:14:20.140 --> 00:14:31.640
So I started using Pelican probably six, seven years ago now, and I still highly recommend it, which is if you're a developer and you've been using a tool for that long, I feel like that's a pretty good sign that it's a, it's a stable foundation.

00:14:31.640 --> 00:14:32.740
Yeah, definitely.

00:14:32.740 --> 00:14:36.780
I don't know if you remember what it was like when you first started using it though.

00:14:36.780 --> 00:14:43.560
So if I wanted to pick it up and maybe say like, let's say I've got like some, I wanted to create internal to a company.

00:14:43.560 --> 00:14:47.840
I wanted to create a little site to, I don't know, document some process or something.

00:14:48.240 --> 00:14:55.540
And, wanted to spin up a Pelican site, with a bunch of documents, I guess, in it.

00:14:55.540 --> 00:15:00.340
Is that something that's going to take a long time to learn how to use or is it pretty quick to pick up?

00:15:00.340 --> 00:15:01.380
No, it should be pretty quick.

00:15:01.440 --> 00:15:07.980
I mean, a lot of people think that static site generators just kind of for blogs, which is sort of the original purpose of a static site generator.

00:15:07.980 --> 00:15:16.340
When they first, when some of the first ones came out, they were mostly used with like a blog format, but you can create any type of website with a static site generator.

00:15:16.820 --> 00:15:22.900
And you can even, even create like single page applications if you combine it with some sort of JavaScript framework on the front end.

00:15:22.900 --> 00:15:26.460
So, yeah, so there's, I would say it's actually relatively easy to get started.

00:15:26.460 --> 00:15:30.580
I wrote a tutorial on this, how to create your first static site with Pelican and Jinja.

00:15:30.580 --> 00:15:37.660
And, that would actually get you up and running probably within, I don't know, 20, 30 minutes, do pip install Pelican.

00:15:37.660 --> 00:15:38.540
Wow. Okay.

00:15:38.540 --> 00:15:44.260
And then Pelican will, actually generate the boilerplate that you need with the Pelican quick start program.

00:15:44.260 --> 00:15:46.320
And then you, you have your first static site.

00:15:46.320 --> 00:15:54.860
Actually, you could probably have your first static site within five minutes and then you can start customizing it and have something that you could deploy very quickly after that.

00:15:54.860 --> 00:15:56.260
Well, that's definitely fast enough.

00:15:56.260 --> 00:16:02.640
And is your, is the tutorial, have, talk about, I guess it probably doesn't matter which Markdown you use.

00:16:02.640 --> 00:16:04.000
If you use Markdown or restructured.

00:16:04.000 --> 00:16:10.420
Yeah, I actually, I use Markdown on full stack Python, but on my personal site, mattmckai.com, I use restructured text.

00:16:10.420 --> 00:16:13.860
So, I kind of use each one interchangeably.

00:16:13.860 --> 00:16:17.840
in fact, you can use them interchangeably on the same, in the same site.

00:16:17.840 --> 00:16:20.320
So Pelican doesn't, yeah, Pelican doesn't really care.

00:16:20.320 --> 00:16:23.860
It'll just say, Oh, you've got five Markdown files, five restructured text.

00:16:23.860 --> 00:16:25.960
I think the ASCII doc is another format.

00:16:25.960 --> 00:16:28.740
You can kind of just take anything as input and it'll use that.

00:16:28.740 --> 00:16:31.400
It doesn't have to be segmented by projects.

00:16:31.400 --> 00:16:34.360
Does it tell by the extent file extension or something?

00:16:34.540 --> 00:16:35.060
Do you know?

00:16:35.060 --> 00:16:41.840
Yeah, you can, well, in the configuration settings, you can tell, you can tell Pelican which file formats you want and also which extensions.

00:16:41.840 --> 00:16:49.940
So if you don't want to pick up your restructured text files, you can just have it pick up the Markdown ones, but you can, you can configure all that stuff in the, in the configuration files.

00:16:49.940 --> 00:16:51.320
It's pretty, pretty extensible.

00:16:51.320 --> 00:16:51.920
Nice.

00:16:51.920 --> 00:16:52.520
Okay.

00:16:52.900 --> 00:16:56.920
So the last topic I want to talk about was something that just helped me just now.

00:16:56.920 --> 00:17:04.120
So in the last episode, I announced that I'm no longer writing the book, the book being Python testing with pytest.

00:17:04.120 --> 00:17:07.800
It's what I've been working on for like a year, but I was wrong.

00:17:07.800 --> 00:17:19.680
because right after I, we recorded that and I handed in all my documents to my editor, the pytest team came out with another version, the pytest 3.2.0.

00:17:19.680 --> 00:17:28.900
And I did, I had just recent, just like the week before retested all of my, examples in 3.1.3.

00:17:28.900 --> 00:17:30.420
So what do I do?

00:17:30.420 --> 00:17:34.420
And what I'm doing is, just making sure they all work.

00:17:34.420 --> 00:17:38.060
So right now I'm, I'm going through all of the book again.

00:17:38.060 --> 00:17:48.860
And instead of having to do this every time I've decided I'm going to build a test framework to not a framework, but I'm going to build a set of tests that check the, all of the examples.

00:17:48.860 --> 00:17:57.020
And make sure that the output is similar enough to the output I describe in the book so that it doesn't confuse somebody when they have a new version.

00:17:57.020 --> 00:18:02.000
And one of the things I'm using is a, is a tool called pytest watch.

00:18:02.000 --> 00:18:03.420
It's a pytest plugin.

00:18:03.420 --> 00:18:10.480
It's great because I've just got two windows open in, in two terminal windows while I'm editing these tests.

00:18:10.640 --> 00:18:14.420
One of the terminals is running pytest 3.1.3.

00:18:14.420 --> 00:18:18.500
And one of them is running pytest 3.2 in two different virtual environments.

00:18:18.500 --> 00:18:21.400
And I've got pytest watch just looking at the directory.

00:18:21.400 --> 00:18:25.620
And every time I hit save on the tests, both of them go off and run.

00:18:26.180 --> 00:18:32.860
And eventually when I get all done with this, I'll probably convert it to talks or something so that I can run them all the time.

00:18:32.860 --> 00:18:36.640
But for now, interactively, pytest watch is pretty cool.

00:18:36.640 --> 00:18:37.060
Wow.

00:18:37.060 --> 00:18:37.640
That's amazing.

00:18:37.640 --> 00:18:42.040
How, how much like code did you have to write in order to get that to be working with both versions?

00:18:42.040 --> 00:18:50.700
I'm actually using the, there's a part of pytest that I do cover briefly in the book that's called the pytester.

00:18:50.700 --> 00:18:57.760
And it's a, it's a plugin that is used for the intended uses for testing plugins.

00:18:58.040 --> 00:19:01.900
But it's also used by the test code for pytest itself.

00:19:01.900 --> 00:19:08.280
And it allows you to run a pytest session and capture the output and ask things about it.

00:19:08.280 --> 00:19:14.140
Like was the string in there and how many passes, fails, skips, things like that are in there.

00:19:14.140 --> 00:19:19.680
And so I'm, I'm writing the tests just as if I was writing like a plugin or something.

00:19:19.860 --> 00:19:25.960
And it's taking me, it's, it's about, it's not quick, but the format of each is pretty similar.

00:19:25.960 --> 00:19:33.220
And it takes me about a minute or so per example to get a test in place, but there's like 170 examples.

00:19:33.220 --> 00:19:36.300
So, you know, 170 minutes, but.

00:19:36.300 --> 00:19:40.120
Any way to speed that up or you're, you're, you're happy.

00:19:40.120 --> 00:19:41.840
You're happy with it right now.

00:19:41.840 --> 00:19:43.240
There probably is.

00:19:43.240 --> 00:19:46.900
The, the slow part really is just the me looking at it.

00:19:46.980 --> 00:19:51.500
I could probably automate the whole thing and get it done faster.

00:19:51.500 --> 00:20:12.880
But I also want to be reading the book and while I'm putting these together to make sure that, because there's sometimes there, there'll be, you know, something minor, like, I guess not really minor differences, but I don't really want to just say I want the exact same output because if they added, you know, a period here or there, that's not that big of a deal.

00:20:12.880 --> 00:20:13.160
Right.

00:20:13.160 --> 00:20:15.660
But I want the gist of it to be correct.

00:20:15.660 --> 00:20:16.420
So.

00:20:16.680 --> 00:20:16.780
Wow.

00:20:16.780 --> 00:20:17.320
Nicely done.

00:20:17.320 --> 00:20:18.000
Anyway.

00:20:18.000 --> 00:20:19.460
So that's that.

00:20:19.460 --> 00:20:21.220
And, we're done.

00:20:21.220 --> 00:20:22.060
Thanks a lot.

00:20:22.060 --> 00:20:22.400
Yeah.

00:20:22.400 --> 00:20:27.680
I want to, usually at the end, we, touch bases with each other to say what's going on.

00:20:27.680 --> 00:20:31.300
So I just learned today that Matt, that you work at Twilio.

00:20:31.300 --> 00:20:32.120
Yeah, I do.

00:20:32.120 --> 00:20:42.400
So Twilio for folks who, who don't know, it, makes, makes it easy for developers to add communications, like phone calling, messaging and video to their applications.

00:20:42.800 --> 00:20:53.900
so if you've ever wondered, you've gotten, you know, you're working on a feature and, you're in the middle of a sprint and your user story says, okay, send a text message to somebody like, well, how do I do that?

00:20:53.900 --> 00:20:58.120
How do I like interact with this global telecom network?

00:20:58.120 --> 00:21:00.260
Well, you could do that really easy with Twilio is API.

00:21:00.260 --> 00:21:01.500
So yeah.

00:21:01.500 --> 00:21:02.660
So that's my, my day job.

00:21:02.660 --> 00:21:07.140
So in addition to working on full stack Python, I work at Twilio, which has been, which has been really great.

00:21:07.220 --> 00:21:08.420
I've been there for almost four years now.

00:21:08.420 --> 00:21:09.280
That's great.

00:21:09.280 --> 00:21:13.480
And, you're also working on, there, a project called Twilio voices.

00:21:13.480 --> 00:21:13.960
Yeah.

00:21:13.960 --> 00:21:27.200
So Twilio voices is something, a new project I've been working on and it's, probably of interest to listeners because we pay developers $500 for each published technical blog posts that they, they have on the Twilio blog.

00:21:27.440 --> 00:21:42.260
So if anyone's listening and they, you want to try pie test watch and you want to learn, or you want to learn a new, open source project or something like that, if you just write some code and then you want to write a blog post about it, you can do that through Twilio voices and get paid 500 bucks.

00:21:42.260 --> 00:21:49.000
The way that I see it is like the 500 bucks is a good way to get past the procrastination stage of writing a blog post.

00:21:49.000 --> 00:21:53.520
And then we promote that blog post to everyone in our different channels.

00:21:53.520 --> 00:21:57.100
So a lot of times these blog posts can be read by tens of thousands of people.

00:21:57.100 --> 00:22:04.780
For example, there was one called a wedding at scale, how I automated my, with Python and Twilio and Google.

00:22:04.780 --> 00:22:14.280
I mean, basically it was a developer who was talking about how he automated all the text messaging and communication for his wedding through a Python script that he wrote, which was a really cool story.

00:22:14.280 --> 00:22:20.740
So the whole idea behind Twilio voices is people have all these awesome hacks and applications that they've built.

00:22:20.880 --> 00:22:25.440
Tell us a story about it and show us how show readers, how to build what you built.

00:22:25.440 --> 00:22:31.940
It doesn't have to use Twilio can be basically just any, any code that you've created, as long as it's a, if it's a cool story or a good tutorial.

00:22:31.940 --> 00:22:34.980
So it doesn't have to be pushing Twilio.

00:22:34.980 --> 00:22:36.400
It can be just about anything.

00:22:36.400 --> 00:22:40.340
no, cause we're a company for developers by developers for developers.

00:22:40.340 --> 00:22:42.040
and we've always been that way.

00:22:42.040 --> 00:22:46.320
So whether you're using Twilio or not, we want to see the code that people have written.

00:22:46.320 --> 00:22:55.700
And, one thing that's really great about this is every post goes through a rigorous review process, like an outline review, voice review, tech review to make sure all the code works.

00:22:55.860 --> 00:23:06.940
So that like people who write these blog posts, make sure that their output is like the best that they've ever created, which has been really cool to see people say like, I never could have written a blog post that was like this polished.

00:23:07.260 --> 00:23:11.940
So we, we kind of put it through the, through the ringer to make sure that it's, the highest quality post.

00:23:11.940 --> 00:23:12.980
That's pretty cool.

00:23:12.980 --> 00:23:17.780
I mean, you usually have to like pay money to interact with the editor.

00:23:17.780 --> 00:23:19.480
So that's nice.

00:23:19.480 --> 00:23:20.060
Cool.

00:23:20.060 --> 00:23:20.360
Yeah.

00:23:20.360 --> 00:23:21.880
You should, you should write something on testing.

00:23:21.880 --> 00:23:23.900
Maybe I should write a blog post.

00:23:23.900 --> 00:23:24.160
Yeah.

00:23:24.160 --> 00:23:25.380
We would, we would love to have it.

00:23:25.380 --> 00:23:26.660
So what are you, what are you been up to, Brian?

00:23:26.660 --> 00:23:31.620
Well, I, I'm not actually writing the book anymore, which is good, but I'm still working.

00:23:31.620 --> 00:23:32.380
Thanks.

00:23:32.380 --> 00:23:35.940
But I am working on book related activities, right?

00:23:35.940 --> 00:23:46.000
For this month, because it still is going through, it has to go through copy editing and figuring out marketing plans and all that, that good stuff.

00:23:46.000 --> 00:23:49.700
So I've got a couple of podcasts for testing code.

00:23:49.700 --> 00:23:59.240
One came out last week and I'll probably get, I'll do weekly ones, get them out, but it's still, that's still slow while I'm spending most of my free time on the book still.

00:23:59.240 --> 00:24:03.920
So other than that and my full-time job, yeah, that's what I'm up to.

00:24:03.920 --> 00:24:06.620
So you, hopefully you get some time to sleep then.

00:24:06.620 --> 00:24:07.740
Yeah.

00:24:07.740 --> 00:24:19.580
So I've been fascinated hearing about Matt and I've convinced him that I'm going to, I'm going to put him on the spot on the air and tell him that he's got to get on the testing code and talk about full stack sometime.

00:24:19.580 --> 00:24:20.280
So sure.

00:24:20.280 --> 00:24:21.320
Happy to do it.

00:24:21.320 --> 00:24:23.960
Thank you for listening to Python Bytes.

00:24:23.960 --> 00:24:27.120
Follow the show on Twitter via at Python Bytes.

00:24:27.440 --> 00:24:30.620
That's Python Bytes as in B-Y-T-E-S.

00:24:30.620 --> 00:24:36.480
And get the full show notes and links to things we talked about on the show at Python Bytes.fm.

00:24:36.480 --> 00:24:43.760
If you have a new story you'd like featured, just visit Python Bytes.fm and send it our way.

00:24:43.760 --> 00:24:47.180
We're always on the lookout for sharing something cool.

00:24:47.180 --> 00:24:48.840
This is Brian Okken.

00:24:48.840 --> 00:24:51.840
On behalf of myself, Michael Kennedy, and Matt Makai,

00:24:51.840 --> 00:24:55.820
Thank you for listening and sharing this podcast with your friends and colleagues.

00:24:55.820 --> 00:24:55.980
Thanks.

00:24:55.980 --> 00:24:57.520
Thank you.