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