Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


« Return to show page

Transcript for Episode #8:
Python gets Grumpy, avoiding burnout, Postman for API testing and more

Recorded on Tuesday, Jan 10, 2017.

00:00 Bytes Transcript

00:00 #8: Python gets Grumpy, Avoiding Burnout, Postman for API Testing and More

00:00 KENNEDY: This is Python Bytes. 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.

00:00 Brian. What’s up, man?

00:00 OKKEN: It’s going really good.

00:00 Glad to hear it.

00:00 feel like everybody’s kind of getting going after the winter break. We’re both in Portland and our world has been covered in ice repeatedly, recently. It’s been a bit of a strange start. There’s still Python news to talk about.

00:00 Yeah, there is. I’m going to start. There was a PyBay 2016. I actually don’t remember when that happened; 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, at least it was in the fall. The video came up in December. I was listening to it and I was kind of blown away.

00:00 Jessica was the director of the Python Software Foundation. She’s been involved with lots of stuff, like the Boston Python User Group and she’s the Diversity Chair for PyCon. I guess she’s an Engineering Director at Dropbox, which sounds cool. But anyway, this was a keynote speech or talk. She was talking about all of her work with Python is not really about Python but studying systems. There are some cool quotes.

00:00 how to program changes the way you think about, de-bug and interact with the world.”

00:00 learn asset of rules on how to build software, then you learn how you can change the rules.”

00:00 master a system that they know they can change.”

00:00 sorts of comments that she talks about, I guess I knew but I didn’t ever really think about before. She takes it and realizes that as programmers, we often take it for granted that we’re using a tool that we want to make better and we can just go in and make it better. It’s an open source thing. And that this should carry over to the rest of your life.

00:00 takes the idea and applies it to politics and voting and stuff. I guess she ran a polling station by herself and her husband did a different one, which actually is pretty cool. It’s neat to hear somebody say firsthand, ‘It’s not that hard to get it done.’ I like the idea of thinking about how the programmer mindset and how you can change the system that you’re working in. I think more people should apply that to their workplace a little bit. 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 and that’s great for some people. But for others I think that maybe it’s better to look at the system and your part of it and try to make it better yourself. Picture yourself in your manager’s shoes. Or if you’re manager, wouldn’t you want to hear from all of your employees that there’s something that could happen to make it a better place?

00:00 Yeah, I think it’s a great message. I really like Jessica’s work. I had her on Talk Python on Episode #30. She’s done so much for diversity and the way the Python community actually is today. Ten years ago it was very different.

00:00 of the things she brought up in that talk was that – I think she said 5 years ago, a handful of years ago – the number of women speakers at PyCon was like 1% and now it’s in the 30s, maybe low-40s percent. It’s dramatically different. There’s a lot of changes like that, that she was central at. I think she does a great bunch of work.

00:00 In that video, that was one of the questions. How did she do that? And the answer is awesome. She just emailed a lot of people and asked them to submit talks.

00:00 Sometimes, you know, you’ve just got to ask, right? You want the world to be a different way, sometimes you just have to ask or take the first step or whatever it is.

00:00 ideas that come to mind as you said that. One is, there’s a quote that goes something like this from Steve Jobs. “The world around you was made by people no smarter than you. You can change it.” Once you realize that you can’t just accept the world the way it is, you see that you can change it and you must.

00:00 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. You start to apply that thought to world. I think that’s really something valuable that people on this ‘learn to code/teach kids to code’ mission don’t get, but would be a powerful benefit to students and everyone.

00:00 And it’s another reason to teach more and more people to code. We don’t have to generate an entire generation of programmers but a generation that actually understood how computers work would be good.

00:00 It wouldn’t be bad. I definitely think the world needs more creators and fewer consumers, but now necessarily more programmers.

00:00 say that I’m a pretty happy guy, pretty optimistic guy; maybe to a fault sometimes. Usually people don’t say I’m grumpy. But today, I’m feeling a little grumpy.

00:00 Actually, I’m feeling grumpy also.

00:00 This time grumpy is good. Grumpy is interesting. The guys at YouTube, particularly a guy named Dylan Trotter, wrote a blog post on the Google tech blog – I don’t remember exactly which one, it’s in the links – called “Grumpy is a Python on Go Interpreter or Runtime.” At Grumpy.io it redirects to the GitHub repository. The built this thing, and it was really recently, like three weeks ago. What it is, is a transpiler. It takes Python, Legacy Python sadly, Legacy Python 2.7, and it compiles or transpiles it into Go Code, which is then compiled and run on top of the Go Runtime.

00:00 there’s a couple of interesting things. One, there is no interpreter. Two, it executes purely as Go, so all the features, and I really think the reason they’re doing this is the concurrency story around Go, maybe even a migration story. There’s a lot of interesting things that they can do if they can get Python to run on top of Go.

00:00 of the things that also caught my attention about this, is this seems to have really taken people, captured their enthusiasm. It’s on GitHub, they announced it a few weeks ago and it already has 6,000 stars. For a project that’s a few weeks old with 6,000 stars, that’s pretty amazing. I’m actually having Dylan on Talk Python to Me, Episode #95, which I think comes out next week. So, look for a bigger story there.

00:00 Is that one that’s already recorded?

00:00 No, I’m going to talk to him Thursday.

00:00 So, do you know what’s the reasoning? I get why you’d want Go for Python stuff, but is the language Go not enough and the Python language easier to write in?

00:00 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. But Go is big at Google. YouTube right now, the front end for YouTube, is written in CPython 2.7. I would speculate that they’re thinking of, how do they not stay on Python 2.7. Pretty interesting.

00:00 know, another thing that would make me grumpy, and not in the Python way but really grumpy is when I’m given a huge project, like tens of thousands or hundreds of thousands of code like, and say, ‘Here, look through this code base.’ And I look at some method or some set of classes and I’m like, ‘I don’t understand what effect this has. It seems to do nothing in this code and yet here it is.’ And I’ll tweak it and play with it and it doesn’t seem to have any effect and then I realize that the code is never called.

00:00 Yeah, it would be cool if there was a way to find some dead code.

00:00 You mean if there was a creature that could soar through the sky and would find these bodies and consume them and they would be gone, something like that? (Laughing)

00:00 Yeah, or maybe we could have a cheesy segue bot.

00:00 an article by Dougal Matthews called, “Finding Dead Code with Vulture.” Vulture is a Python tool that you can install with just Pip Install Vulture. It’s really easy to use. I downloaded it, applied it to some code I was working on and you can actually just point it to a directory and it looks at all the Python code there. It analyzes stuff and does call trees and what not, I don’t know how it works. It gives you a list of all the functions and variable and lines of code that are not used. It was just really fast and really easy to use; I liked it.

00:00 the comment from Dougal was, 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? There’s a way you can take your unit test and exclude them from the Vulture, which is kind of neat.

00:00 was thinking about the comparison. Normally, I would find this stuff using Flake8 but the example you gave, you wouldn’t want to try to fix all the Pep8 errors and things just to find dead code, so this might be a good use case for that. And also, there are some people don’t like static analyzers like Flake or whatever.

00:00 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 be sure that that’s true.

00:00 Yeah, it’s tough to do it with coverage and testing, I think, because like you alluded to, there might be some function that is never called but you might have written a test about it so it kind of looks like it’s live again.

00:00 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 maybe 3,4,5 function calls back in this chain, these are all kind of dependent on each other but nobody ever calls the first one. It’s really hard to tell, to follow all those chains and determine, actually this whole branch of code you’re trying to determine, just forget it, it’s gone. You have source control. Delete it.

00:00 That’s pretty cool. I like it.

00:00 Yeah. They did warn about false-positives, saying something wasn’t used when actually it was. Be a little careful. Systems that use conventions, like Pyramid of Django or something, you map a route to thing and it doesn’t look like you ever called that thing, but obviously it’s called by a URL. So, just be aware of those sorts of things. But yeah, it looks really cool.

00:00 of tools that are cool, I don’t get much meaningful mail these days but I do like this thing called Postman. Postman, I think it’s at GetPostman.com, is a cross-platform GUI app that lets you test and visualize and play with APIs.

00:00 I love my APIs.

00:00 I’ve actually been doing somethings that require me to write some APIs lately. Obviously, I can go into the dev tools in my browser or I could write some command line thing to test them, but this is really nice. You can create, ‘here’s how I call this function as an authenticated user with this data’ and you can actually save that in this UI. You can create them and share them across teams, integrate these into continuous integration for testing deployments or integration tests of your whole system.

00:00 really cool, it’s free, it’s cross-platform. It’s not written in Python, unfortunately, but it’s still a really cool system.

00:00 When you say API, are you referring to a rest API?

00:00 Yeah, it says APIs but I should make it clear, those are services. HTTP services, SOAP services, things like that.

00:00 Okay, great.

00:00 Not APIs like, ‘Pip install this package and call this function.’

00:00 When I’m testing or running on developing new APIs, it’s tiring and I get burned out on it. (Laughing)

00:00 Yeah, you know, you and I have been programming for a long time. I don’t know about you but I’ve certainly gone through a period of time when it’s like, ‘Ugh, more of this.’ It usually depends a little bit on the project. It’s not really the programming, it’s all the other stuff nit-picking at your time and energy.

00:00 Kenneth Reitz does a bunch of great work. He’s the “For Humans” guides. We talked about Maya last time, right?

00:00 Yeah, last episode we talked about Maya and he’s, of course, the author of Requests. He wrote this article called, “The Reality of Developer Burnout.” I’m glad he did it. I had heard that he was – I don’t remember, last year or something – suffering from burnout of being the main support person for an open source project.

00:00 Yeah, and he’s not the only one. I can’t remember the guy’s name, he’s in Lawrence, Kansas and he’s one of the founders of Django – also just got totally burnt out and had to step back. I remember there’s a half hour conference presentation that was like a goodbye, or something to that effect, if I’m remembering it correctly.

00:00 plenty of stories of people getting, not just requests but angry email for stuff they’re doing for free. Open source projects and so on.

00:00 Definitely. I don’t maintain a large open source project but I 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 this article. I think he has some decent advice. Some of the advice he gave was to keep producing but not at the same speed, but stop consuming so much on your social networks. He disconnected from Twitter for a while.

00:00 He didn’t quite pull a ‘410 gone.’ (Laughing)

00:00 Right, but just stop following people, stop looking at it so much.

00:00 also talked about delegating some more. 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 also, generate other hobbies; don’t do all of your free time just doing coding. There should be some non-programming hobbies. I thought it was a great article.

00:00 was poking around, trying to get links for the show notes. When I was looking at the Maya GitHub page, it said, “Say thanks to Kenneth.” I have never seen this before but apparently there’s a saythanks.io to Kenneth project. It just sends a little thank you note to the person who set it up.

00:00 That’s really awesome.

00:00 for our final topic, it brings us snapping back to the future, away from Grumpy and Python 2.7, back to current Python.

00:00 Yeah, and hopefully you’re not burnt out on template languages.

00:00 No, I’m still a big fan of server-side, templated web applications. One of the real popular ones is Jinja 2.x by Armin Ronacher. He’s the guy behind Flask. He just released Jinja 2.9. 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.

00:00 of the things that stood out, both to Hugh and to myself, was the deep integration with Python 3.6 and the asynchronous concurrency story around that. Armin says, while Jinja 2.x supported Python 3 years ago, it never really fully embraced the Python 3.x features because they wanted to make it basically lowest common denominator so it would work on Python 2.x as well. Now they say it actually supports async generators which fully support the async and await keywords, so it means if you pass some kind of generator that is an async generator to the template and it’s going to loop over them, it will await it as it does that. Which is fantastic. It’s just so cool to see async and await in a currency flow all the way to the HTML.

00:00 Where would this effect it? When does the template engine end up doing co-routines?

00:00 Well, the template engine runs after your view method. Your action method runs and you pass back the model. But the thing is, the model itself could have a collection that is a generator. And normally, you would just loop over it. Like I’ve got some kind of set of results and maybe that came from a database query or computed it from a service and you’re going to do a four loop over it and generate a bunch of ten and a hundred whatever, little sub-HTML pieces in your template. Even if that was asynchronous, that wouldn’t be treated that way, you’d just call it before. So, now it can do this in an await-able way. My understanding is that each one of those steps has to go to file or network or something, it’s like a database query and it’s flowing through as you pull the items out of the generator, it will free up the thread to go do other web requests while that part is running. It’s quite slick.

00:00 week in the Python world and we have a bunch of cool stuff. If you’re using Jinja, get the new version. If you’re feeling burnout, check out Kenneth Reitz’s things. If you’re doing APIs, check out Postman. Bring out the Vultures on that legacy code and check out Grumpy as well. Lots of cool things. And system programming as a larger concept with Jessica.

00:00 Those are good things to check out.

00:00 going on with You, Michael? Do you have any news you want to share?

00:00 I don’t really have too much news. I’m just working like crazy on a couple projects. Some stuff that I’m doing got me interested in Postman; I’m doing a bunch of API stuff now for a project that I’m working on. But nothing I’m ready to talk about.

00:00 about you? How’s the book?

00:00 It’s getting closer and closer. We’re now targeting, hopefully, a beta release for PyCon. I have a handful of people I’m trying to get a hold of to be technical consultants/technical editors to just read through it. I think it’s a couple week thing. If anybody’s listening and feel that they really want to contribute to making sure I don’t make any PyTest mistakes, hit me up and I’ll put you on the list.

00:00 Yeah, that sounds great. Get early access to the book and are you giving them credit? Do they get a little “Thanks to…”

00:00 Oh, yeah, definitely. It’s all handled through Pragmatic (Bookshelf/Publisher) so there’s a limited number of people. I don’t know how many people they’ll pick, but I want to give them a bunch of names.

00:00 Excellent. Glad to hear it’s still moving.

00:00 Thanks.

00:00 Thanks for sharing your stories with me. It was good to chat with and with everyone.

00:00 Thank you. Talk to you next week.

00:00 Bye.

00:00 you for listening to Python Bytes. Follow the show on Twitter via @pythonbytes and get the full show notes at pythonbytes.fm. If you have a news item you want featured, just visit pythonbyes.fm and send it our way. We’re always on the lookout for sharing something cool. On behalf of myself and Brian Okken, this is Michael Kennedy. Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page