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 #82:
Let's make a clear Python 3 statement

Recorded on Wednesday, Jun 13, 2018.

00:00 KENNEDY: Hello, and welcome to PythonBytes, where we deliver Python news and headlines directly to your earbuds. This is Episode 82 recorded June 13th 2018. I'm Michael Kennedy.

00:10 OKKEN: And I'm Brian Okken.

00:11 KENNEDY: And we have, I think, quite a big episode. I'm sure people have heard about this thing with GitHub. What do you think?

00:20 OKKEN: I think so, probably.

00:21 KENNEDY: It's definitely, when the news about Microsoft buying GitHub came out, it definitely made some waves. So we're going to talk about that. Before we do, though, let's say thanks to DigitalOcean. DigitalOcean is sponsoring this episode and many of the PythonBytes ones. So check them out at pythonbytes.fm/digitalocean and get $100 credit, which is pretty awesome. So we'll do the GitHub conversation at the end. We'll focus on that. But, Brian, you've got something about a document named REST APIs first.

00:47 OKKEN: So there's Doug Farrell. I think we've highlighted some of his writing before. I'm not sure, but I definitely remember the name. But he wrote on the Reveal Python site an article called: Building and Documenting Python REST APIs with flax flax, with Flask and Connexion. So one of the things, as you know, I've been playing with a little command line application on testing code. But I wanted to add a REST API, and so this caught my eye. I had also heard of Swagger, so this is one of the things that I like about this article is it talks about, first of all, it doesn't assume that you already know what you're doing, which is nice. It does talk about what REST is and what REST isn't. It has a nice explanation of REST and how that works with web APIs. And then I know a lot of people, I think a lot of people use Swagger as a definition. It's a YAML definition language to define what your API connections are, and so this article uses that. And then also, to implement a little CRUD application. And then I had never heard of this Connexion module or package and there's a--

02:06 KENNEDY: Connexion with an X, yeah.

02:08 OKKEN: So Connexion that takes a Swagger file, and it helps you to implement the API with Flask. It's a fairly brief read, but I haven't done the demo yet, but I'd like to. And one of the things that Swagger gives you, if you aren't familiar with Swagger is it, if you use it, you automatically get these cool user interfaces for your API that humans can read. So it's kind of a self documenting API system. So taking advantage of that is nice.

02:42 KENNEDY: That's really cool. I definitely have heard of Swagger, and I think Swagger's pretty cool. I've checked it out some for some of the APIs I've done. I've never heard of Connexion, it's like, so basically, you give it your Swagger file and just say, yeah, do that. And it more or less does, huh? That's pretty cool.

03:00 OKKEN: There are some pieces leftover that you have to tie everything together, so that this article goes through that. And one of the nice things also that I, I've seen a lot of REST API tutorials that kind of leave the ending, then you just have a REST API with nothing using it. This article finishes it up with a web application that uses the API with some Java Script plugging into it. So it talks about that, which is good 'cause I wanted to play with this. I'm not a Java Script person. So having somebody write that for me so I can play with it, that's cool.

03:36 KENNEDY: Thanks, Doug, for saving Brian all the work. And it turns out that Connexion comes from Zalando, which is the largest online fashion platform in Europe. I actually had them on Talk Python awhile back, which is interesting. I didn't put those two together, although I'm pretty sure we talked about that, at like two years ago and I just forgot.

03:56 OKKEN: Zalando, I like that name, cool.

03:57 KENNEDY: It's very cool.

03:57 OKKEN: It's nice.

03:59 KENNEDY: I'm probably mispronouncing it, actually, but that's all right. That's pretty standard fare for our podcast, right? Nice, yeah, that's a good pick, I really like it. I think Doug's article is well done, and it's super thorough. So, yeah, if you're looking to get into writing APIs with Flask, then this is worth checking out. And certainly the Swagger Connexion aspect is kind of unique, I think. So Mypy, that's Guido van Rossum's main project, as far as I can tell right now. Him and some folks from DropBox are working on Mypy, which is a static type checker for Python, right? That's pretty cool.

04:34 OKKEN: I haven't heard much about it yet, or recently so.

04:37 KENNEDY: They're still doing stuff on it, as far as I can tell and it's coming along. The big news that I got for this next item is, there's now a plug-in for PyCharm for Mypy, which is pretty cool, so you just hit, you're in your PyCharm project, you hit a hotkey and then you just get full Mypy type checking.

04:55 OKKEN: OK, that's cool, yeah, I like that.

04:57 KENNEDY: It's pretty awesome, so yeah. This is why Ivan Levkivskyi. See, what did I say about this one? So yeah, thanks, Ivan. This is really awesome and it's great. So Ricky Titi asked what on Twitter. I had linked to the conversation says, PyCharm already has type checking, right? So if you pull it up, it'll say, hey, you're calling this function, and it's using it wrong or you're trying to pass an int then it takes a string or vice versa. Says, why would I care about this plug-in in the PyCharm, which already does that kind of stuff? So Ivan had a few bits of feedback, he said, "Well, Mypy is a little bit more strict and precise than PyCharm. It's a lot more configurable with rules, and it type checks the entire program all at once, not just what's loaded in your project." So that's pretty cool. And then sometimes people use Mypy as part of a continuous integration path, and you might want to run Mypy quickly before you do a push just to know what the outcome will actually be. So hotkey, and then you commit, pretty sweet.

06:03 OKKEN: I'll have to check that out, it's nice, cool.

06:05 KENNEDY: I've been pretty much just leaning on the PyCharm type validation whenever I use it. But I can certainly see projects where Mypy has lots of value, and it's still my working theory that the reason they're so heavily working on it at DropBox is, they're trying to use Mypy to convert to Python 3 safely, maybe even automatically.

06:24 OKKEN: OK, well, speaking of automatic--

06:25 KENNEDY: That's my working theory based on no data other than outside observation.

06:29 OKKEN: Was that like a really cool segue that I just missed? OK. What if you had like a tool that could just automatically upgrade for you?

06:39 KENNEDY: That would be fantastic!

06:41 OKKEN: I know that there's, so there's a 2to3 already, but it's fairly non-invasive, the 2to3. I think it, Python still ships with that, doesn't it? I think so.

06:50 KENNEDY: I think so.

06:52 OKKEN: And I've used it a couple times, and it's, but it's pretty conservative. It's basically to get you over the hump from 2 to 3. But what if you want to go farther? One of the things that I want to do is, I want to take some of the code I was using prior to Python 3.6 and be able to convert some of the strings to f-strings because they're nicer to read, and this'll do it for me. I found a tool called pyupgrade, and it's a tool and it also be a pre-commit hook that automatically upgrades your syntax to new versions of the language. And it does all sorts of stuff, not just f-strings, and the f-strings also is optional. So it doesn't do it by default. If you're converting to Python 3.5, don't do that.

07:36 KENNEDY: It'll crash.

07:37 OKKEN: But for instance, the set literals have changed. You can have an easier to read set literal syntax. Also dictionary comprehensions and some things like that. Unicode's changed a little bit, and yeah, anyway, being able to automatically do that is pretty fun.

07:53 KENNEDY: That's pretty awesome, and 2to3 is make it run on Python 3. Whereas this looks like make it embrace Python 3.

08:02 OKKEN: Definitely, and yeah, dictionary comprehensions are just awesome. So that way you'll use the better syntax.

08:09 KENNEDY: That's pretty awesome. And then you have another one for documentation, right?

08:12 OKKEN: This is a pretty short little thing I thought I'd go along with this is, and we've all heard of Black, and we've talked about it a few times on the show. An extension to this is blacken-docs. It runs Black on your RST and markdown files for any of the code examples inside of there. It makes sure that those are blackened also, so that's fun.

08:38 KENNEDY: That's pretty awesome. You've got, maybe, like a little bit of demo code for your project that shows how to use it, and that's in your documentation. You could blacken it and, boom, it's formatted like the rest of your code, right?

08:49 OKKEN: I think blacken-docs also, I was thinking it runs as a pre-commit hook, but I'm not sure if it does or not. Actually, I don't think we've talked about pre-commit, so maybe that's for another time.

09:00 KENNEDY: Let's talk about that. But definitely, so it's sort of as part of your GitHub check-in, just magic happens. Or your git check-in, yeah, awesome. All right, speaking of awesome, DigitalOcean, they're pretty awesome, both as an infrastructure provider and for supporting the show. You can go from zero to a running server in about 60 seconds. They have a bunch of cool different types of servers. They even have one-click apps. You want a Ghost blog server on Linux, press a button, 30, 40 seconds later, you have it all set up and running. Super nice, like I said, you get $100 credit for new users, if you go to PythonBytes.fm/digitalocean and check them out. All of our stuff is running on it. At least all of the PythonBytes, and my things are running on it, which has been super flawless, super happy customer and going to continue to be. And if you want to be as well, get a credit, check them out, pythonbytes.fm/digitalocean. So, we've talked about Python, and we've talked about Legacy Python. And I believe that that original terminology of Legacy Python was from Matthias Bussonnier who is from the Jupyter Project. Actually, I had him back on Episode 44 of Talk Python. And he's part of this project called python3statement.org. So this was sent over by Bruno Alla. Thank you for that, Bruno. And the idea is to have these projects make a public statement of dropping support for Legacy Python sooner.

10:27 OKKEN: We've seen that for some projects already, right?

10:30 KENNEDY: That's right, and you'll see, you can go there, and you can see the ones that are listed. So they say they now have 44 projects that have pledged to drop Legacy Python in less than 30 months, and some already have, which is awesome, like Django for example. I don't know if Django is even listed there, but they should be. Maybe they didn't make a pledge but they did it. Anyway, to basically shows you various projects that are committing to it. And the main motivation is we have tools and we have techniques to support Legacy Python, but at the same time, it's like a small but constant friction on newcomers, on adding new features. You just have to keep making sure your code works, right? Like when, I think it was Django, when they switched to Python 3 only, they were able to drop a bunch of code and actually get smaller and have less to maintain. So that's pretty awesome. They say over there on their site, they say they're keen to see Python 3 reach its full potential. And they think that they don't want to, they're happy to have these projects support Python 2 to help smooth that transition but not forever, right? Actually, one of the things I like about the site is, they have a really nice Why switch to Python 3? With articles from, say, Brett Cannon and other folks. It's pretty cool.

11:40 OKKEN: It also has a timeline, a visual timeline that you can see the different projects that have signed up for this.

11:45 KENNEDY: Oh, that's nice!

11:46 OKKEN: And when they're...

11:47 KENNEDY: So this seems a pretty heavily dominated by the data science crowd, and I think that's because the folks that put the Python3statement.org together are data science people, and they just have greater interactions and leverage on those projects. So I'd like to see other projects, like Django could come and be part of this, and it would take them zero effort, right? 'Cause they're already doing that in Jinja2 and things like this. So, yeah, I just want to encourage people, if they have a project, to go over there and make a statement.

12:15 OKKEN: I'd like to see more projects do that, too, 'cause there's a lot that I utilize that aren't on here. And they make it real easy, you can either, they said that they've got a GitHub issue tracker. You can just submit an issue with your project information and have somebody else do it, or you can submit a pull request on this tool to pull in the information, so both those are cool ideas. So no reason to not do it.

12:37 KENNEDY: That's right, I definitely love it. Soon, we will speak of Legacy Python in the past.

12:42 OKKEN: Well, there's an elephant in the room.

12:44 KENNEDY: It is! Don't you mean a really giant octopus cat thing?

12:49 OKKEN: Octopus cat thing?

12:50 KENNEDY: The octocat, that's the logo of GitHub.

12:53 OKKEN: OK, 'K, got it. Forgot about the cat part of it, so...

12:56 KENNEDY: The head is the cat, and the bottom is an octopus. I don't know. It's a pretty non-standard sort of creature, but it's like a platypus, but it's the cat octopus version.

13:05 OKKEN: Oh, OK.

13:05 KENNEDY: It is definitely big news, and I think... The Twitter was blowing up with people, both somewhat cautiously optimistic, I would say, to totally freaked out. And that is that Microsoft has paid or agreed to pay $7.5 billion for GitHub.

13:23 OKKEN: That's a lot of money.

13:24 KENNEDY: It is a lot of money. When I first heard about that, I was a little bit on the slightly negative side of things, like, aw, man, really? The more I've looked into it, the more I feel like this is probably a positive thing. So you and I haven't really had a chance to talk about this. You've been hanging out at the Eiffel Tower and stuff fun like that, so--

13:44 OKKEN: This is our first chance to get to chat.

13:47 KENNEDY: So tell me, what's your thought on this?

13:49 OKKEN: Well, I, like you, was a little bit on the negative side at first, and then, actually, you shared with me a article called: Everyone complaining about Microsoft buying GitHub needs to offer a better solution. And it's not just a glib article. It's actually a nice article that talks about some of the history. One of the reasons why I like it, it talks about it from the GitHub side of saying really GitHub needed to go somewhere. So it was still, I didn't know that GitHub was taking VC funding and didn't have a good roadmap ahead of it to, or at least there's the speculation is, there wasn't a sound model to continue 'cause they way GitHub makes, I mean, GitHub spends money, clearly, but it makes money on the enterprise side, and it kind of makes sense to have, so this article talks about the three potential, it makes sense to have it be bought, and to be bought by somebody that already has ties into enterprise, have an enterprise sales staff and stuff like that. It said potentials were really Microsoft, Amazon, or Google. I think that's what that listed.

14:56 KENNEDY: Pretty much, yeah.

14:57 OKKEN: And that makes sense, from that standpoint. So on the side of being able to sell GitHub enterprise, those three totally would make sense. And so I actually, after reading that, I'm like, uh, actually, I would've been OK with any of those people buying it. And Microsoft is not the evil empire that it use to be. So I guess I'm kind of OK with it. So, how 'about you?

15:21 KENNEDY: That's sort of where I came around to as well. I did a lot of looking into this, a lot of research the first few days when this was out to sort of figure out, OK, I have a gut reaction, but how should I feel about it? I didn't realize how much trouble GitHub was actually in. They have been, they went like six months or something without a CEO at all 'cause they just couldn't find one, which is not super encouraging. They took tons of VC money. There's a really interesting retweet, a self retweet, it's like a selfie tweet, I don't know, whatever. David Heinemeier Hansson retweeted himself when this news came out, and he tweeted something that he wrote when GitHub first took VC money back in 2012. Said, "I love the GitHub product to bits. We're proud paying customers, and I hope they figure out how to disarm this VC time bomb before it blows up." That's what he said in 2012. So of course 2018, GitHub's time bomb has exploded right on time with the sale to Microsoft. And I think when you take VC money, it's not OK to just be doing all right, right? You got to 10X it, and if you're not 10X-ing it, something's going to happen, like a sale. If it's going really great, it's an IPO. If it's not going super great, it's some kind of sale and acquisition. They sort of went down that path. Maybe GitHub wouldn't be what it is today if it weren't for that VC money, but it does sound like something had to happen. So they had this sort of VC pressure, they had financial pressure, they had the sort of organizational stuff, with like not being able to find a CEO. There's a guy who was the COO, Chris, I forgot his last name, sorry, who was the CEO interim. Then he stepped down, then he became the CEO again and then stepped back down. And so now Nat Friedman is going to be the CEO. He's the co-founder of Xamarin, which is pretty awesome, yeah. And I think, if you look in Microsoft's history of acquiring companies and either making them awesome or making them not awesome, it's a mixed bag a little bit, right? So for example, under the not awesome category, people have put Skype. I think, I don't know, if Skype was actually having some issues as well. Skype seems to always be changing and never amazing. It doesn't ever stabilize on a UI. It just always like, why is this hard? It's definitely hard now. Now it's hard in a different way. Anyway, so that's one example of not so great, but I think an example of really them shepherding something pretty well is Xamarin, right? Xamarin was a big open-source way to build mobile apps on C# and Xamarin did a lot with bringing .NET to Linux. So they bought them, and I think they're still doing pretty well as an independent organization. So a bit of a mixed bag. I feel like taking care of a developer space is better than other tools.

18:12 OKKEN: Regarding the Skype thing, although the interface might be all weird occasionally, I still rely on it, and it's still there. I would rather have it be there than disappear without an owner if that was the other option.

18:23 KENNEDY: Absolutely.

18:24 OKKEN: I know one of the fears is: What's going to change with GitHub? I think it's big enough and in everybody's face enough that I don't think they're going to make major changes right away because they're under a microscope, and they always will be.

18:38 KENNEDY: I think the other thing is, you got to look at where Microsoft is the last three or four years in terms of what their priorities are, right? We've got Satya Nadella who's doing pretty good stuff, but mostly what I mean is, it used to be, how can we make this jammed into some sort of lock-in for Windows? How can we make it some kind of things for Office you have to do? Things like that. Whereas lately, it's all about Azure, Azure, Azure. How can we get people to use Azure? And Azure is their cloud stuff, right? It doesn't matter if you use Python or .NET or Linux or node.js or whatever, right? So I feel like there's not going to be pressure to, say, push people to one of their languages or something like that, but there probably will be up sales to Azure, and, hey, if you get GitHub enterprise, you get a certain amount of Azure credits. So you get brought into that world. I think that that's the angle, and I don't think there's going to be a lot of negative pressure because of it, right? I can resist an Azure, just as much... As I resist all the other ones, I don't really care. But if they said, "GitHub only works well if you use Visual Studio." that would be super bad. I don't think that that is even in their interest as they see it these days. I feel like it's probably going to be OK unless they screw something up on accident. I don't see that they'll screw it up on purpose.

19:59 OKKEN: As the community noted, you can always switch to GitLab if you want.

20:02 KENNEDY: You can, yeah, yeah.

20:04 OKKEN: I was amused by that, and also pleased. At first there were people going, there's a mass exodus out of GitHub into GitLab! And although the imports from GitHub to GitLab are going up dramatically, it's really kind of a drop in the bucket for how many projects are on GitHub.

20:23 KENNEDY: Exactly.

20:25 OKKEN: But I do like that there's some discussion to say, hey, everybody, GitLab is not that bad. I've used GitLab, and I actually kind of like that this had highlighted the fact that it's not bad for something to be on GitLab, even if you're trying to get people to contribute. It's pretty much the same process, so it doesn't really matter too much.

20:43 KENNEDY: That's cool. So in summary, to sort of summarize my feelings, I'm kind of like genuinely cautiously optimistic. I think Microsoft brings tons of resources to GitHub, and maybe GitHub will be more awesome. They're going to keep running it as a independent organization. They've got somebody who's pretty awesome leading it. So these are all good things. We've got the Linux Foundation, actually, said something pretty surprising. So they wrote up an official thing on it after a few days and said, "Microsoft's GitHub buy is a win for open source." And one of the guys there has been, I forgot his name, has been super anti-Microsoft, sort of said, look, these are all the reasons why this is good, and I'm happy for it, which is surprising, I suppose.

21:25 OKKEN: That's cool, and then also, Nat Friedman did an ask me anything session on Reddit, where there was quite a few questions and answers on what's going to happen and things like that.

21:37 KENNEDY: That's cool.

21:38 OKKEN: There's Atom also. How does Atom and Code, they're kind of overlapping. So they'll still keep both of those, so things like that.

21:47 KENNEDY: That's encouraging, and it's also interesting that VS Code is based on Electron JS, which was extracted out of Atom. Right? Electron JS used to be called Atom Shell.

21:58 OKKEN: OK, interesting.

21:59 KENNEDY: It's related, yeah. So one thing I do want to throw out there for people who want to dig into this a little bit more is this podcast called Exponent. It's one of my absolute favorite podcasts, actually. And the guys there, they basically do tech business analysis. And they did a really nice job of looking at the sort of motivation and the pluses and negatives of Microsoft buying GitHub. So I will link to that in the show notes, Episode 154.

22:25 OKKEN: I listened to that, it was good. The one thing I thought was interesting is, nobody's really mentioned to me the obvious truth that Microsoft would just rather be the owner of GitHub than have any of its competitors be the owner of GitHub. I think that's real and legitimate, so.

22:42 KENNEDY: I agree. And one other, I had said my positive. The negative that I somehow forgot to tie together there was the thing that made me just go I'd rather not see this even at the beginning was, this is such a consolidation of a really major tech player, right? We already have so many things being sucked into Google, Facebook, Amazon, Microsoft. And there was like this nice independent place that wasn't any particular technology stack at all. It was just GitHub. You could go there, you could build your software, and they didn't try to encourage you to use Ruby or whatever it was, right? There was just, that was a place where the code goes, and now there less of that in the world, and I think that's a negative.

23:26 OKKEN: There's still GitLab.

23:27 KENNEDY: There's still GitLab, that's true. Yeah, there's definitely, I mean, there's also at Atlassian Bitbucket, right? So that's another possibility as well. But I think GitHub's still is a special place for social coding and open source collaboration, and I don't think it's going to change.

23:40 OKKEN: It'll change if they muck it up, and yeah. So we're a pretty fickle group, but I think they know that. But we've seen, yeah, we've already hashed, Microsoft is a different company towards open source than it used to be.

23:53 KENNEDY: All right. Well, that's our thoughts. If you have your own thoughts, feel free to put 'em in the show notes at pythonbytes.fm/82 and just go to the Disqus section down at the bottom. All right, that's it for our news. Brian, you got any extra stuff you want to chat about?

23:53 OKKEN: No, not really, other than I did figure out how to bring home my over-100-year-old Venetian glass chandelier on an airplane, that was fun.

23:53 KENNEDY: That's insane! Can I get a bulkhead seat? My chandelier needs to have a little room to breathe.

23:53 OKKEN: I had to take the thing apart and put it in bubble wrap and put it in two suitcases.

23:53 KENNEDY: Oh, how interesting, that's awesome.

23:53 OKKEN: We made it. How 'about you? Anything going on?

23:53 KENNEDY: Nothing too major. I'm working on a couple of projects like always and have news on them eventually. But I do want to give a shout out to PyLadies. So we were just in Cleveland, Ohio, right? Had a nice time at PyCon there not long ago. So, Cleveland now has an official PyLadies meet-up or group. So they just launched, and they're going to have their first meeting on June 22nd, and I linked to their meet-up and their Twitter and everything in the show notes. So if you're interested in PyLadies and you're somewhat near Cleveland, or you can even stream it live. I think they're streaming their stuff live on YouTube, so you could check that all out just in links in the show notes.

23:53 OKKEN: Awesome, that's great, cool!

23:53 KENNEDY: One more good step down that path, that's awesome. All right, so thanks, and it was great to share the GitHub conversation with you.

23:53 OKKEN: It was. I thought we'd be more argumentative, but we're pretty much in agreement.

23:53 KENNEDY: That's too bad. It would've been fun, but... We don't argue too much, I don't think.

23:53 OKKEN: All right, well, talk to you next week.

23:53 KENNEDY: Yep, catch you next week, bye. Thank you for listening to PythonBytes. Follow the show on Twitter via @PythonBytes. That's PythonBytes as in B-Y-T-E-S. And get the full show notes at pythonbytes.fm. If you have a news item you want featured, just visit pythonbytes.fm and send it our way. We're always on the look out 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