« Return to show page
Transcript for Episode #7:
Python 3.6 is out, Sanic is a blazing web framework, and are failing our open source infrastructure?
00:00 Bytes Transcript
00:00 #7: Python 3.6 is Out, Sanic is a Blazing Web Framework and Are We Failing our Open Source Infrastructure?
00:00 KENNEDY: This is Python Bytes. Python headlines and news delivered directly to your earbuds. It’s Episode #7, recorded Wednesday, January 4th, 2017.
00:00 OKKEN: Hey. Happy New Year.
00:00 Yeah, Happy New Year. It’s great to be back together. We’ve gone three weeks without discussing cool things that came out in the Python community and I think it’s time to get back together. The Python news must flow.
00:00 It must. Plus, I miss this; this is fun.
00:00 It’s definitely fun. So, like many of our episodes, this one is sponsored by Rollbar. They help you take the pain out of errors. Thank you to Rollbar. We’ll have more to say about them throughout the show.
00:00 Brian, you had a little warning. You wanted to just get it out of the way.
00:00 Yeah, I want to try to list some of the names of the articles and of the people who wrote the articles that we are reading and talking about in this episode. Some of them have names that I am most definitely going to mispronounce. I hope you don’t take offense at it. I have a last name that everybody miss pronounces so I understand.
00:00 You’re used to it?
00:00 Yeah. I get Oaken and… mostly Oaken is what I get.
00:00 But you’re not a tree. (Laughing)
00:00 we get to the first news item, I actually want to do something. I’m going to open up my terminal and type something. I’m going to type Python 3 – V. Do you know what it says? Not Python 3.5.2, not anymore.
00:00 It says Python 3.6?
00:00 That’s right. Python 3.6.0.
00:00 Python 3.6 was announced on December 23rd and now Python 3.6.0 is our latest release. This is really exciting. I’ve already started using some of the new features in my writing. I’ll definitely be taking advantage of the F strings, I don’t know how you would call those.
00:00 I think the other language is called String Interpolation, but it’s the F-character that indicates it. Swift and C Sharp call it String Interpolation.
00:00 I’m going to called them the F’en strings.
00:00 celebration of this, I know we’ve already talked about 3.6, but I’ve got links in our show notes for the announcement and the “What’s New” article from docspython.org. But there are also a couple of other articles that are cool. There’s “Python 3.6 is Packed with Goodness” article from Serdar Yegulaip, that’s on Infoworld. It’s a list of things that he thinks are cool in 3.6, including Async 08 and the use of that more, the improvements of memory and speed. I’m really excited about that.
00:00 I didn’t know about is some of the improved API support, so that tracers and debuggers and stuff can hook in to Python easier.
00:00 It’s definitely packed with goodness. I think that’s great. Another article you pointed out was “Adopt Python 3.” I really like that one as well. I’ll let you go to some of the stats and say the name of the author as well.
00:00 So, this is on Medium by Dibya Chakravorty. This other “Adopt Python 3” article I think is interesting. I have heard of a couple of sites called the Wall of Superpowers and Python 3 Readiness that are 2 pages that list the most popular Python packages and how much of them are Python 3 ready. The numbers are higher than I expected, actually. 187 out of 200 on one them and 341 out of 360 on the other. I think this is important because a lot of people tried to switch to Python 3 a long time ago and one of their favorite packages wasn’t supported but it probably is now. Check those out.
00:00 person also wrote up an iPython notebook and had some statistics to pull out. Not just the most popular but everything. He pulled everything on PyPI that was listed as stable and had at least one release in 2016. That was 6,000 packages of those, so there must be a lot of packages on PyPI that are not updated very often.
00:00 I really like it when the statistics do some basic filtering. Nobody cares that that package that almost no one’s using hasn’t been updated for 10 years supports Python 2 or Python 3.
00:00 Of the, what he calls ‘Stable Inactive’ it was interesting that 14% of those don’t even cover Python 2, they’re Python 3 only packages. And 28% which is higher than I would hope, are Python 2 only. But the author estimates that a lot of those could easily be switched if they’re really important to you.
00:00 has a list of all the ones that he calls “sticky.” 25% of 28, so that’s not very many. 7% total of those sticky packages that may be a problem for you. But you know what, I was in one of those camps. A year ago, I tried to switch our testing to Python 3 and there was a package that I needed that wasn’t switched. It is now, so I don’t have that excuse anymore.
00:00 Yeah, that’s really great. I love the Wall of Superpowers. The article was really interesting. It’s a good argument and it’s data-driven, which is cool. In fact, like you said, you can the iPython notebook for it.
00:00 final thought on Python, moving from Legacy Python to Python 3.6, the new Python, is you get a lot of benefit in this release just by installing and running on it if you don’t touch your code at all. There’s a lot of memory and performance speed-up, so that’s really cool.
00:00 Yeah. And instead of the Wall of Superpowers, maybe we could look at roads and bridges.
00:00 Yeah, there’s walls, there’s roads and there’s bridges. I don’t know how it is in the rest of the world, I know in Germany it’s not quite this way, but in the U.S., we tend to neglect our physical infrastructure. I had to swerve the other day because there was a huge pothole in the road and so on. It’s a problem.
00:00 think the real problem for us these days is actual digital infrastructure. There’s a really great article, not an article, more like report or even a book – it’s 150 pages – called “Roads and Bridges: The Unseen Labor Behind our Digital Infrastructure.” It’s written by Nadia Eghbal and she did a really good job. It’s a relatively new report; it came out in July. It basically talks about pen source and mostly open source infrastructure, not open source projects. Not necessarily things like Django, more things like PyPI and Pip. The underlying foundation. Things like Open SSL, that everybody builds on top of. It turns out there’s actually a really big problem across the board. If you think physical infrastructure is neglected, you should see the digital infrastructure. I did a whole session of this with folks from the Python community, Eric Holscher from Read the Docs and Donald Stufft from PyPI on Talk Python Episode #84. We talked about this a little bit.
00:00 this report goes through and outlines all the challenges that they see for supporting things like PyPI, supporting things like Open SSL. And they said that until Heartbleed… Heartbleed was that really serious bug that you could send a bunch of requests to a server running Open SSL that was vulnerable and you could actually get it to leak unencrypted information back out. Until then, that thing was barely coming along. There’s almost nobody that worked on it. There was like one guy or a couple of guys that were very short term able to work on it. Two-thirds of all the web servers use that for their communication. Think about that.
00:00 example that they talked about, Rubygems, the website done by volunteers. Somebody had found some kind of vulnerability in it and the people who had supported it were like, ‘Alright, we’ll fix this on the weekend because we have jobs. We can’t work on this infrastructure.’ And that’s like Pip to Ruby, right? It’s important. And it turned out it got hacked and taken down before the weekend. So, people had to schedule vacation days so they could get it back running.
00:00 more example is PyPI itself. Donald Stufft works on that. He was employed by HP, HP went through a bunch of layoffs and not even really knowingly, took out his position. Now there’s Donald in his spare time, who else supports PyPI? They do 400 terabytes of traffic a month and it costs almost $40,000 to keep Pip running. So, you can say Pip install a thing, that’s like almost $40,000 worth of infrastructure. And there’s only a few baskets that are supporting that thing; it’s quite precarious.
00:00 wanted to bring up “Roads and Bridges: The Unseen Labor Behind our Digital Infrastructure.” This report, I think people will care about this and find this very well-written, very interesting and lots of neat stories. Well, even if they’re depressing.
00:00 (Laughing) Yeah, it is interesting. Thanks for bringing that up.
00:00 Yeah, absolutely. I threw a bunch of little excerpts that I got from the article. People can flip through and see if they’re interested in that.
00:00 Speaking of things that we take for granted, I know that there are some libraries out there that people use all the time. If a library is used by a lot of people, making changes to it can be a little scary. Rc2 of matplotlib 2.0.0 came out in December and Thomas Caswell – I don’t know if he’s the only person supporting it but he’s one of the main developers – he was telling me that some of the changes is in the default style. If you’re not styling your plots specifically and you’re just going with whatever matplotlib comes up with, those are going to change and that took 10 years in the making, apparently, to change that. This library’s been around for a while. So, he would love to have feedback. In our show notes, there’s a list of changes. There’s a list of releases, list of changes; 2.0.0 is coming out soon-ish. He’s not sure when but he’d like to have people try it out and see what they think of any of the default styles. He wants feedback.
00:00 Well, I’ve a little feedback for him. One of the posts you linked to in the show notes is basically a set of pictures; old version and new version with default styling. Almost universally, they looked better to me. They look more modern. They don’t look like ‘here’s a cheap, un-styled sort of thing I’m just gonna drop in,’ they actually look like something that you’d be really excited to share. Thumbs up from me.
00:00 Yeah, I thought so too. I didn’t even think about how hard it would be to change the rug out of lot of people. And a lot of people don’t follow him or follow Python, so I’m glad we’re bringing this up to try to get people to go check it out.
00:00 Yeah, I totally agree. It’s easy to look through it. If you care about matplotlib, get out there and give him some feedback. If you can.
00:00 before we move on, let me tell you about Rollbar.
00:00 Oh, please tell me about Rollbar.
00:00 I recently sent out an email, like a newsletter email to a bunch of people taking some of my courses. It turned out that I had typed in a URL incorrectly. So, it was like, ‘Click here to launch this video/play/lecture/1234.’ Well, some non-numerical number or letter got in there. My web app was trying to parse that as an integer. So, I hit send on this email to thousands of people and then, all of a sudden, my phone starts going BEEP BEEP BEEEP CRASH CRASH CRASH ERROR IN YOUR WEBSITE. What the heck is this? I pull it up and I immediately see what’s going on I see the stack trace, I open up PyCharm, quickly change it, do a push to deploy. Within 5 minutes of sending the email, nobody ever sent me a message. I found the error and fixed it. When the people opened up the email, it didn’t crash. And that was from Rollbar.
00:00 you guys want that same type of behavior, that same type of safety net, you can get it at Rollbar.com/pythonbytes.
00:00 That’s awesome. I wondered how long you would have figured out on your own, without that.
00:00 I would have never known until somebody complained so, it was really good. I felt bad about it, but it was good that I at least got it fixed right away.
00:00 One of the things I’m a huge fan of is MongoDB and document databases. I really think document databases are this perfect sweet spot between performance, maintainability, ease of use and relational integrity. There’s a really great article I want to point out. If you’re interested in MongoDB or document databases in general and Python, and you want to get started, the guys over at Real Python, Michael Herman wrote an article called “Introduction to MongoDB and Python.” They talk about what’s the difference between SQL and NoSQL. They talk about the primary way to talk to the database through PyMongo, like inserting a querying data, and they also talk about this thing called Mongo Engine. Mongo Engine’s like the SQLAlchemy. You create classes, you put in constraints and defaults and then you map those classes to documents in your database.
00:00 I’m really excited about this. I’m trying to use PyMongo on one of my projects. This is good.
00:00 Yeah, it’s definitely good. PyMongo is pretty sweet. It’s MongoDB, it’s easy to set up and use, it’s open source, so that’s all good. I actually did a 1½ hour presentation at this conference in London called Software Architect and they recorded it and put it up and it was basically the same stuff. I put a link in the show notes as well, to this thing I called “Applied No-Sequel with MongoDB and Python.” So, if people want a video version of mostly the same topics, they can check that out as well.
00:00 Actually, from you I learned about TinyDB, I think on one of your podcasts.
00:00 Oh, yeah. TinyDB is awesome.
00:00 That was neat, too.
00:00 Yeah, also a document database.
00:00 know, I love things that are for humans.
00:00 Yeah, next up we’ve got an article “Introducing Maya: Datetimes for Humans.” Most of the “For Humans” stuff comes from Kenneth Reitz. ‘Rights?’ ‘Reets?’ Do you know how to pronounce his name?
00:00 I’ve been saying ‘Rights’ and I think that’s right. If it’s ‘Reets,’ I’m sorry, Kenneth.
00:00 Kenneth, if you’re listening, please let us know. Or I could look at any talk that he’s given and try to get that.
00:00 Datetimes seem like something that’s just easy until you actually try to do something that’s not. It quickly goes from easy-to-deal with to hard-to-deal-with very fast. So, I’m excited that Kenneth has taken this on and tried to come up with his own library for dealing with datetimes and datetime math and parsing dates and human-readable stuff. It just sounds exciting and I’m going to give it a try.
00:00 Yeah, he has Request, which is the most popular Python package ever, downloaded 7 million times a month, which is insane. He has Records, which is just like SQL for humans sort of thing, very cool stuff. Nice work, Kenneth.
00:00 Another package that I’m interested in that’s coming up is an alternative to Flask or something Flask-like.
00:00 There are more and more reasons to move away from Legacy Python to Python. Especially Python 3.5 and above because of the cool concurrency stuff. But what are the things that people talk about when they talk about new Node.js? I’m not a huge fan of Node.js but it does have its benefits. It’s asynchronous from the start programming model. That’s been traditionally hard in Python because the Whiskey-API doesn’t support it super well. Frameworks like Flask and Pyramid, you can’t just write ‘async methods’ and all the sudden become async. There’s too much in the built-in stack that doesn’t understand async.
00:00 guy, I don’t know his real name, I just know him as Channelcat, he did this thing called Sanic which is a Python 3.5 or higher web server, written to go fast. It’s based on the API Flask. It leverages the async in await to functionality in Python 3.5, which I think is really cool. It also uses the UV Loop, which is a really fast asynchronous IO loop for Python 3. It’s really cool.
00:00 If I want to create some kind of method, like a view action method sort of thing, just like Flask, I’ll say ‘app.route’ and give it a URL. So, ‘/’. But instead of saying ‘def some method,’ you say ‘async def some method.’ And you can await throughout your method. All the cool benefits of letting the threads go on to do other work while you’re waiting on databases, web services, files, things like that just happen magically. You can get really good performance numbers.
00:00 Wow, neat.
00:00 So, it’s pretty cool and the fact that it’s a Flask, more or less like the Flask API, means you don’t have to start from scratch and learn a totally new thing. They actually have some performance numbers compared to other things. They don’t have Pyramid in here, which is too bad because Pyramid flies on Python 3. But when you think of asynchronous programming in Python, Python web frameworks, typically you would probably come up first with Tornado. They have some tests that they did and said, ‘Tornado did like, 2,000 requests per second with a 44-millisecond latency response time, basically.’ Okay, well what about Flask? ‘Well, Flask did twice as good, so like 5,000 requests a second, 20-millisecond response time. Almost double good in both directions.’ This Sanic thing, using Python 3 and the UV Loop is 33,000 requests per second with a 3-millisecond response time.
00:00 Wow, that’s incredible.
00:00 Yeah. See, Python is better than Legacy Python.
00:00 (Laughing) Definitely.
00:00 It’s really cool. So, Python 3.5, the Async 08 is a cool programming model, and have this nice web framework to plug in there. This thing’s going to go places. We’re going to be talking about it for a while, I bet.
00:00 Yeah, definitely.
00:00 some point, I need to talk to you about if I were going to start up a new application, would I care about asynchronous stuff right away?
00:00 Yeah, that’s a good question. At some point, how much do you really care. Let’s say on the Talk Python website, I think I have 10 processes farmed out to handle the requests. So, let’s just go with Flask. If I were running Flask, 5,000 requests a second, that’s 50,000 requests a second. That’s a pretty insane amount I would have to hit before I care, right? But still, there are people who care and having that built in, that’s pretty cool.
00:00 Yeah, definitely.
00:00 can’t believe we’re wrapped up. We’ve got all these done already.
00:00 I know, I know. I think we’ve got a bunch of cool topics. I love Sanic. I love that Python 3.6 is out and I’m happy to be back and sharing it with everybody. It was a nice break, but it’s even nicer to be back.
00:00 Yeah. Do you have any extra news you want to share with us?
00:00 No, I just stepped away from the computer. I went to California, put my toes in the sand and just kind of forgot about things for a while. And came back refreshed and excited to keep doing what I’m doing.
00:00 about you? You’re still working on your book, right?
00:00 Definitely, I ramped up the schedule so I spent Christmas break at the keyboard. I got, I think, about halfway done with the rough draft approximately. But going through the first-level editor, I’m still shooting for at least a beta release by PyCon. My goal of getting a physical copy by PyCon seems actually insane right now. But that’s what I’m up to.
00:00 You can do it. We’re all rooting for you, Brian.
00:00 And I’ve got a whole bunch of Testing Code episodes coming up. I’ve got 1 interview recorded and about 4 interviews scheduled. These will keep going, I will not quit.
00:00 Awesome. Glad to hear those are coming.
00:00 Well, thanks a lot for talking to me today.
00:00 Yeah, it’s been great. Thanks for sharing the news with me and we’ll see you later. Thanks.
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.