Transcript #8: Python gets Grumpy, avoiding burnout, Postman for API testing and more
Return to episode page view on github00:00 This is Python bites Python headlines and news delivered directly to your earbuds. It's episode 8 recorded January 10th 2017 this is your host Michael Kennedy along here with my co-host Brian Okken. Hey Brian. What's up, man? That's going really good Yeah, glad to hear it. Glad to hear it We're kind of feel like everybody's still kind of getting going after the the winter break I know, you know, we're both in Portland and we've been like our world has been covered in ice repeatedly recently So it's been a bit of a strange start, but there's still Python news to talk about.
00:30 Yeah, there is. I'm going to start with actually, there was a PyBay 2016. I actually don't remember when that happened. It was sometime in the fall. I want to bring up one video, which is from Jessica McKellar titled "Breaking the Rules." From the talk, it sounds like it was pre-election.
00:51 So at least it was in the fall, but yeah, the video came up in December.
00:55 I was listening to it and was kind of blown away.
00:59 So Jessica was the director of the Python Software Foundation for several years and was, she's been involved with lots of stuff like the Boston Python user group.
01:08 And she's the chair for a diversity chair for PyCon.
01:12 She's, I guess she's an engineering director at Dropbox, which just sounds cool.
01:16 But anyway, the, the, this was a keynote, speech or a talk and she was talking about all of her work with Python was not really about Python but about studying systems and here's some cool quotes. "Learning how to program changes the way you think about debug and interact with the world and you learn a set of rules on how to build software and then you learn that you can change the rules and programmers master a system that they know they can change. And these sorts of comments that she talks about I guess I knew but I didn't really ever think about it before. And she takes it and she realizes that as programmers we often take it for granted that we if we were using a tool that we want to make better we can just go in and make it better.
02:06 It's an open-source thing and and that this should carry over to the rest of your life. She takes the idea and applies it to politics and voting and stuff.
02:17 I guess she ran a polling station by herself and her husband did a different one which actually is pretty cool but it's it's neat to hear somebody firsthand say it's not that hard to get it done. But I like the idea of thinking about how the programmer mindset and how you can change the system that you're working in and I think more people should apply that to their workplace a little bit. I've heard about people that are unhappy at their job and they like a cubicle farm or something and they get out and do an entrepreneurial thing and I that's great for some people but for others I think maybe it's better to look at this system and realize that you're part of it and try to make it better yourself. Picture yourself in your manager's shoes or your or manager's manager.
03:06 Wouldn't you wanna hear from all of the employees if there's something that could happen to make it a better place?
03:12 - Yeah, I think it's a great message.
03:14 I think, I really like Jessica's work and I actually had her on Talk Python on episode 30 and she's done so much for diversity and the way the Python community actually is today.
03:27 Like 10 years ago, it was very different.
03:29 - Yeah. - One of the things that she brought up in that talk was that, I think she said five years ago, but not, let's say a handful of years ago, the number of women speakers at BiCon was like 1%.
03:40 And now it's like in the 30s, maybe low 40s percent.
03:44 It's, you know, dramatically different.
03:47 And there's a lot of changes like that that she was central in.
03:50 So I think she does a great bunch of work.
03:52 - In that video, that was one of the questions, is how did she do that?
03:56 And the answer's awesome.
03:58 She just emailed a lot of people and asked them to submit talks.
04:01 - Yeah, and sometimes, you know, you just gotta ask, right?
04:05 And you want the world to be a different way, sometimes you just have to ask or take the first step or whatever it is, right?
04:11 Like I think two ideas that sort of come to mind as you said that, one is, there's a quote that goes something like this from Steve Jobs, like, "The world around you "was made by people no smarter than you, "and you can change it." And once you realize that, like you can't just accept the world the way it is, you see that you can change it and you kind of must, right?
04:31 And the other is, I really liked the notion of, once you learn to program, you control the system as much as it controls you, and you can change it, and you start to apply that thought to the greater world.
04:44 And I think that's really something valuable that people that are on this learn to code, teach kids to code mission don't get, but would be of powerful benefit to students and just everyone.
04:55 - And it's another reason to teach everybody, more and more people to code.
05:00 We don't have to generate an entire generation of programmers, but a generation that actually understood how computers work would be good.
05:08 It wouldn't be bad.
05:09 Yeah, I definitely think the world needs more creators, fewer consumers, but not necessarily more programmers, right?
05:16 You know, people say that I'm a pretty happy guy, pretty optimistic guy, maybe to a fault sometimes, but usually people don't say I'm grumpy.
05:26 But today I'm feeling a little grumpy.
05:29 I'm feeling grumpy also.
05:31 Yeah, and grumpy this time grumpy is good.
05:33 I think grumpy is good grumpy is interesting.
05:35 So the guys at YouTube, particular guy named Dylan Trotter wrote a blog post on the Google blog tech blog.
05:43 I don't remember exactly which one but it's in the links called grumpy is a Python on go interpreter or runtime.
05:50 So at grumpy.io there it redirects to the GitHub repository.
05:55 built this thing and it was released really recently like three weeks ago and what it is it's a transpiler. It takes Python, legacy Python sadly, so CPython 2.7, and it compiles it or transpiles it into Go code which is then compiled and run on top of the Go runtime. So there's a couple of interesting things. It's one, there is no interpreter. Two, it executes purely as Go so all the features and I I really think the reason they're doing this is the concurrency story around Go and maybe even a migration story, we'll see about that.
06:31 But there's a lot of interesting things that they can do if they can get Python to run on top of Go.
06:38 So one of the things that also caught my attention about this is this seems to have really taken people captured their enthusiasm because it's on GitHub.
06:48 They announced it a few weeks ago and it already has 6,000 stars.
06:53 or a project that's a few weeks old with 6,000 stars, that's pretty amazing.
06:57 So I'm actually having Dylan on Talk Python to me on episode 95, which I think comes out next week.
07:03 So look for a bigger story there.
07:05 - So is that one that's already recorded?
07:07 - No, I'm gonna talk to him Thursday.
07:09 - So what's, do you know what the reasoning, I mean, like I get why you'd want Go for Python stuff, but why is the language Go not enough and the Python language easier to write in or?
07:21 - Well, I believe, I don't know, there's certain things that they can't talk about or don't want to talk about, so I don't want to read too much into it for them.
07:29 But Go is big at Google.
07:32 YouTube right now, the front end for YouTube is written in CPython 2.7.
07:37 So I would speculate that they're thinking of how do they not stay on Python 2.7.
07:44 - Yeah, okay.
07:46 - Yeah, pretty interesting.
07:47 You know, another thing that would make me grumpy, not in the Python way, but really grumpy, is when I'm given a huge project, like, you know, tens of thousands or hundreds of thousands of lines of code.
07:58 And they said, here, look through this and understand this code base.
08:01 And I look at some method or some set of classes and I'm like, I don't understand what effect this has.
08:06 It seems to do nothing in this code.
08:08 And yet here it is.
08:09 And I'll tweak it and play with it.
08:11 And it doesn't even seem to have any effect.
08:13 And then I realized that code is never called.
08:15 - Yeah, hopefully, that'd be cool if there was a way to say you could find some dead code.
08:20 You mean like if there was like a creature that could like soar through the sky and then would find these bodies and like consume them, they would be gone?
08:27 Something like that?
08:28 Yeah, yeah, yeah.
08:29 Maybe, or maybe we could have like a cheesy Segway bot.
08:33 But anyway.
08:34 Exactly.
08:35 There's an article by Dougal Matthews called Finding Dead Code with Vulture.
08:42 And Vulture is a Python tool that you can install with just pip install Vulture.
08:47 And it's really easy to use.
08:48 downloaded it, applied it to some code I was working on, and you actually can just point it to a directory and it looks at all the Python code there and tells you, I'm sure it analyzes stuff and does call trees and whatnot, I don't know how it works, but it like tells, gives you a list of all the functions and variables and lines of code that are not used. It was just really fast and really easy to use. I liked it in the comment from Dougal was the, there's some people that use really aggressive unit testing and TDD strategies, which makes it such that every function is going to have a test for it. But what if that internal function isn't used by anything else? Well, there's a way you can take your unit tests and exclude them from the vulture, which is kind of neat. I was thinking about the comparison. Normally, I would find this sort of stuff by using Flake 8, but like the example you gave, you wouldn't want to try to convert, you'd fix all the like the PEP 8 errors and things just to find dead code.
09:51 So this might be a good use case for that.
09:54 And also there are some people that don't like static analyzers like Flake or whatever.
10:01 The other comment was that coverage, if you're running coverage over your code with your tests that should tell you the parts of code aren't used also however your test suite's got to be fairly complete in order for you to really be sure that that's true so yeah it's tough to do it with coverage and testing I think because like you alluded to there might be some function that that is never called but you might have written a test about it so then it kind of looks like it's live again right and the the thing where I find this to be really insidious is I'm looking at some function and I realize if I take it away this other function depends on it and if I were to take that away another function and then maybe like three or four or five function calls back in this chain these are all kind of dependent on each other but nobody ever calls the first one and so it's really hard to tell like to follow all those chains and determine like actually this whole branch of code that you're trying to deal with just forget it it's gone you have source control delete it yeah that's pretty cool. I like it. So yeah, yeah, they did warn about false positives saying something wasn't used when actually it was. So be a little careful like, you know, systems that use conventions, like you know, pyramid or Django or something, right? You map a route to a thing and it doesn't look like you ever call that thing. But obviously, it's called by you know, a URL, right? So just be aware, beware those sorts of things. But yeah, it looks really cool. Speaking of tools that are cool.
11:32 You know, I don't get much meaningful mail these days, but I do like this thing called postman.
11:38 Yeah, postman at I think it's at get postman.com is a cross platform GUI app that lets you test and visualize and play with API's.
11:51 I love my API's.
11:52 Yeah, so I've actually been doing some things that required me to write some API's lately and I'm like, you know, obviously I could go into the dev tools in my browser or I could write some, you know, some command line thing to test them.
12:04 But this is really nice.
12:05 You can like create, you know, here's how I call this function as an authenticated user with this data.
12:11 And you can actually save that in this UI.
12:12 And you can even create them and share them across teams, integrate these into continuous integration for like testing deployments or, or more like integration tests of your whole system.
12:24 It's really cool.
12:25 It's free.
12:26 It's cross platform.
12:27 written in Python, unfortunately, but it's still a really cool system.
12:32 - Question about that, when you say API, is that you're referring to like a REST API or some other web API?
12:39 - Yeah, it says APIs, but I should maybe make it really clear, those are services like HTTP services, SOAP services, things like that.
12:47 - Okay, great.
12:48 - Yeah, not like APIs like pip install this package and then call this function.
12:52 - Yeah, well, when I'm testing or running on developing a new API, sometimes it's tiring and I kind of get burned out on it.
13:02 - Yeah, you know, you and I have been programming for a long time and I don't know about you, but I've certainly gone through a period or two where I'm just like, ugh, more of this.
13:12 And it usually depends a little bit on the project.
13:15 It's not really the programming, it's kind of like all the other stuff, you know, nitpicking at your time and energy.
13:20 And so Kenneth writes, I'm gonna just keep going with writes not reads until I hear otherwise.
13:25 Kenneth writes, does a bunch of great work.
13:28 He's the, for humans guys.
13:30 We talked about Maya last time, right?
13:31 - Yeah, last episode we talked about Maya and he's of course the author of requests.
13:37 But he wrote this article called "The Reality of Developer Burnout" and I really, I'm glad he did it.
13:43 I had heard that he was, I don't remember last year or something, suffering from just like burnout of being the main support person for an open source project.
13:55 - Yeah, and he's not the only one.
13:56 Like, gosh, I can't remember the guy's name, but he's in Lawrence, Kansas.
13:59 He's one of the founders of Django.
14:01 Also, just got totally burned out and had to just step back.
14:05 And I remember there was like a half hour conference presentation that was kind of like a goodbye or something to that effect, if I'm remembering it correctly.
14:11 But yeah, there's plenty of stories of people getting not just requests, but like angry email for stuff they're doing for free, right?
14:21 Open source projects and so on.
14:23 - Definitely, and I think I'm not a, I don't maintain a large open source project, but they definitely maintain tools within our company, and I think a lot of people can relate to some of the things that Kenneth talks about in "Burnout" in this article.
14:38 But I think he has some decent advice.
14:41 Some of the advice he gave was to just keep producing, but possibly not at the same speed, but stop consuming so much on your social networks.
14:51 He like disconnected from Twitter for a while.
14:54 - He didn't quite pull a 410 gone.
14:57 - Right, but like just stop following people, stop looking at it so much.
15:02 And then he also talked about delegating more, trying to, it is a community, so try to get other people of the community to take over a lot of the roles that he had within the request community and then also generate other hobbies.
15:17 Don't do all of your free time just doing coding.
15:20 There should be some non-programming hobbies.
15:23 I thought it was a great article.
15:25 And I was poking around, trying to get links for the show notes, and I came across, when I was looking at the Maya, the GitHub page on Maya, and it said, "Say thanks to Kenneth." And I had never seen this before, but apparently there's a saythanks.io that's a Kenneth project that, it just sends a little thank you note to whoever, or the person that set it up.
15:52 So I thought that was a cool project.
15:55 - Yeah, yeah, that's really awesome.
15:57 So for our final one, our final topic brings us snapping back to the future, away from Grumpy and Python 2.7, back to current Python.
16:08 - Yeah, and hopefully you're not burnt out on template languages?
16:12 - No, I'm still a big fan of server-side templated web applications.
16:18 And one of the real popular ones is Jinja, Jinja 2 by Armin Roenicker, and he's the guy behind Flask.
16:25 And he just released Jinja 2.9.
16:28 This is really cool, and thanks to Hugh Blanford for sending us a note to say, "Here's a cool thing you should talk about on Python Bytes." So here we go.
16:36 And one of the things that was stood out both to Hugh and to myself was the deep integration with Python 3.6 and the asynchronous concurrency story around that.
16:49 Armin says, "While Jinja2 supported Python 3 years ago, it never really fully embraced the Python 3 features because they wanted to make it basically lowest common denominator so it'd work on Python 2 as well.
17:01 But now they say that it actually supports async generators, which fully support the async and await keywords.
17:09 So it means if you pass some kind of generator that is an async generator to the template and it's going to like loop over them, it will await it as it does that, which is fantastic.
17:21 That's just so cool to see async and await and the concurrency flow all the way to the HTML.
17:27 So where would this like affect it?
17:30 When does the template engine end up doing coroutines?
17:33 Well, yeah, so the template engine runs after your view method, your action method runs and you pass back the model.
17:41 But the thing is, the model itself could have a collection that is a generator.
17:45 And normally you would just loop over it.
17:47 Right.
17:48 So I've got like some kind of set of results.
17:51 And maybe that came from a database query or computing it from a service, who knows, and you're going to like do a for loop over it and generate a bunch of, you know, 10 100 little sub HTML pieces in your template.
18:04 Well even if that was asynchronous it wouldn't treat it that way, it would just call it before.
18:08 So now it can call, it can do this in an awaitable way.
18:13 So my understanding is that if each one of those steps like has to go to file or network or something or it's like a database query and it's sort of flowing through as you generate, as you pull the items out of the generator, it will free up the thread to go to other web requests while that part is running, whereas before it would.
18:32 Oh, that's very cool.
18:33 I like it.
18:34 Yeah, yeah, it's quite slick, quite slick.
18:37 Another week in the Python world and we have a bunch of cool stuff.
18:41 So you know, if you're using Jinja, get the new version.
18:44 If you're feeling burnt out, check out Kenneth Wright's things.
18:46 If you're doing APIs, check out Postman, bring out the vultures on that legacy code, and check out Grumpy as well.
18:53 Lots of cool things.
18:54 system programming as a larger concept with Jessica.
18:59 - These are good things to check out.
19:00 What's going on with you, Michael?
19:01 Do you have any news you want to share?
19:02 - Oh, I don't really have too much news.
19:05 I'm just working like crazy on a couple of projects.
19:08 The stuff, some stuff that I'm doing got me interested in Postman.
19:12 I'm doing a bunch of API stuff right now for a project that I'm working on, but nothing I'm ready to talk about.
19:17 How about you?
19:18 How's the book?
19:19 - It's getting closer and closer to a, we're now targeting a hopefully a beta release for PyCon but I am I have a handful of people I'm going to try to to get a hold of to be beta readers and not just not beta readers but technical consults to technical editors to just read through it I think it's a couple week thing but if anybody's listening and feel that they really want to contribute to making sure I don't make any pytest mistakes, yeah, hit me up and I'll put you on the list.
19:53 Yeah, that sounds great. Get early access to the book and are you giving them credit? Do they get like a little thanks too? Oh yeah, definitely. And it's all handled through Pragmatic, so there's a limited number of people, so I don't know how many people they'll pick, but I want to give them a bunch of names. Excellent. Well, glad to hear it's still moving. Yep, thanks.
20:15 Alright, thanks for sharing your stories with me and it was great to chat with with you and with everyone.
20:20 >> Oh yeah, thank you.
20:21 >> Yep, bye.
20:22 >> Talk to you next week.
20:24 >> Thank you for listening to Python Bytes.
20:26 Follow the show on Twitter via @pythonbytes, that's Python Bytes as in B-Y-T-E-S.
20:31 And get the full show notes at pythonbytes.fm.
20:35 If you have a news item you want featured, just visit pythonbytes.fm and send it our way.
20:39 We're always on the lookout for sharing something cool.
20:42 On behalf of myself and Brian Okken, this is Michael Kennedy.
20:45 Thank you for listening and sharing this podcast with your friends and colleagues.