This is Python Bytes, Python headlines and news delivered directly to your earbuds.
It's episode seven, recorded Wednesday, January 4th, 2017.
Hey, Brian.
Hey, happy new year.
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.
It must, and plus I missed this.
This is fun.
Yeah, it's definitely, definitely fun.
And so, like many of our episodes, this one is sponsored by Rollbar.
They help you take the pain out of errors, so thank you, Rollbar.
We'll have more to say about them throughout the show.
So, Brian, you had a little warning.
You wanted to just get it out of the way?
Yeah, I've got, there's some, a couple, I want to try to list some of the names of the articles,
of the people that wrote the articles that we are reading and talking about in this episode,
and 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 mispronounces, so I understand.
You're used to it?
Yeah.
I get Oaken and, mostly Oaken is what I get, but.
But you're not a tree.
Yeah.
Hey, so before we get to the first episode, the first news item, I actually want to do
something.
I'm going to open up my terminal.
I'm going to type, type something, okay?
I'm going to type Python 3-V.
Do you know what it says?
Not Python 3.5.2.
Not anymore.
No.
It says Python 3.6.
That's right.
Python 3.6.
Yeah.
So Python 3.6 was announced on December 23rd, and it's now Python 3.6.0 is our official
latest release, and this is really exciting.
I've already started using some of the new features in my writing.
I'm definitely taking advantage of the f-strings.
I don't know how you would call those.
Yeah.
I think the other languages call it string interpolation, but it's the F character that indicates
it.
Yeah.
Swift and C# call it string interpolation.
I'm going to call them the F in strings.
I love it.
But in celebration of this, I know we've already talked about 3.6, but I've got links
to the, in our show notes for the announcement and the what's new article from docspython.org.
But there's also a couple other articles that are cool.
There's a Python 3.6 is packed with goodness article from Sirdar Yigalap.
No, I got that one wrong.
That's on InfoWorld, but it's a list of things that he thinks is cool in 3.6, including Async
await and use the use of that more.
The improvements of memory and speed.
And I, I'm really excited about that.
And some, something that I didn't know about is some of the improved API support so that
tracers and debuggers and stuff can hook into Python easier.
Yeah.
It's definitely packed with goodness.
I think that's, that's great.
Another article that you pointed out was adopt Python 3.
I really liked that one as well.
And I'll let you go to some of the stats and say the name as well, the author.
Yeah.
So this is the meet on medium and I'm going to try this one because it's a cool name.
Dibya Chakravarti.
I don't know.
Cool name.
But yeah.
So there, this other adopt Python 3 article talk, I thought it was interesting.
So there's a, I have heard of a couple of, sites called the wall of superpowers, and
Python 3 readiness that are two, two pages that list, most popular Python packages and
how much of them are Python 3 ready.
And I, the numbers are higher than I expected actually 187 out of 200 on one of them and 341
out of 360 on the other.
And 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 I, they, it probably is now.
So, check those out.
And then this, person also, wrote up an IPython notebook and had some statistics,
um, to pull out, not just the most popular, but everything.
He pulled everything on PyPy 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 like packages on PyPy that are not, or PyPI that are not, updated
very often.
But, yeah, I really like it when the statistics do some basic filtering, like nobody cares whether
that package that almost no one's using hasn't been updated for 10 years supports Python 2 or
Python 3.
Yeah.
But of the, of, of the, what he calls stable and active, I was interesting.
There's 14% of those don't even cover, Python 2.
They're Python 3 only packages and, 28%, which is higher than I would hope, but 28%
are Python 2 only.
Um, but the author estimates that a lot of those could easily be switched if they're really important
to you.
And, but the, he does list out, he has a list of all the ones that he calls sticky,
the one 25% of the, of 28.
So I don't know.
I'm not, that's not very many.
14, 7% total.
Yeah.
Math on the fly.
Uh, anyway, of, those sticky packages that may be a problem for you, but I, you know,
I, I had a, 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 and it is now.
So I don't have that excuse anymore.
Yeah.
That's really great.
I love the wall of superpowers.
This article is really, interesting and I think it makes a, it's a good argument and
it's data driven, which is cool.
In fact, like you said, you can get the IPython notebook for it.
My 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, cause there's a lot of memory and performance speed
up.
So that's really cool.
Yeah.
Um, and it's the, instead of walls of, and the wall of superpowers, maybe we could look
at maybe roads and bridges.
Yeah.
There's walls, there's roads and there's bridges.
And, you know, I, 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, right?
Like I had to swerve the other day cause there's a huge pothole on the road and so on.
And you know, it's a, it's a problem, but I think the real problem for us these days is
actual digital infrastructure.
So there's a really great article, not an article.
It's more like a report or even a book.
It's like 150 pages called roads and bridges, the unseen labor behind our digital infrastructure.
It's written by Nadia egg ball.
And she did a really good job.
It's, it's a new relatively new report.
It came out in July.
It's basically talks about open source and mostly open source infrastructure, not open
source projects.
So not, not necessarily things like Django, but more things like PI PI and pip, right?
The underlying foundation, things like, open SSL that everybody builds on top of.
And it turns out there's actually a really big problem across the board.
Like if you think physical infrastructure is neglected, you should see the digital infrastructure.
All right.
So I actually did a whole session with this, some of the folks from the Python community,
Eric Holther from read the docs, Donald stuff from PI PI on talk Python in episode 84.
And we talked about this a little bit.
Basically this, this report goes through and outlines all the challenges that they see for
supporting things like PI PI, supporting things like open SSL.
And they said that until heart bleed, you know, heart bleed was that really serious bug that
you could sort of send a bunch of requests to a server running open SSL that was vulnerable.
And you could actually get it to leak, information, unencrypted information back out.
So it's still, until then it was like, that thing was just barely coming along.
Like there's almost nobody that worked on it.
There's like one guy or a couple of guys that very, very short term were able to work on
it.
And two thirds of all the web servers use that for their communication.
And think about that.
Another example, they talked about Ruby gems, the website done by volunteers.
Somebody had found some kind of vulnerability in it.
And the, the people who had supported it, they're like, all right, we'll fix this on the weekend.
Cause we have jobs.
We can't work on this infrastructure.
And like, I mean, that's like pip to Ruby, right?
It's really important.
And it turned out it got hacked and taken down before the weekend.
And so people had to like schedule vacation days so they could get, get it back running.
One more example is PyPI itself.
And, you know, Donald stuffed works on that.
He was employed by HP.
HP went through a bunch of layoffs and not even really knowingly, I think took out his position.
Now there's Donald's doing that in 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 $40,000 worth of infrastructure.
And there's only a few baskets that are supporting that thing.
It's, it's, it's quite precarious.
So I wanted to bring up roads and bridges, the unseen labor behind our digital infrastructure.
This report, I think people who care about this will find this very well written, very interesting and lots of neat stories.
Well, even if they're depressing.
Yeah.
It is interesting.
Thanks for bringing that up.
Yeah, absolutely.
I threw a bunch of, a bunch of little excerpts that I got from, from the article.
People can flip through and see if they're interested in that.
Speaking of, things that we take for granted.
I know that a lot of, there's some libraries out there that people use all the time.
And 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
is, I don't know if he's the only person supporting it, but he's one of the main developers.
And, he was telling me that there's, it's been, one of the changes in this is, some of the changes in the default style.
So the default, if you just, 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.
So this, this library has been around for a while anyway.
So he would love to have feedback.
So we've got a list of, in our show notes, there's a list of, changes.
There's a list of releases, list of changes.
And, 2.0.0 is coming out, soon ish.
Uh, he's not sure when, but he'd like to have people try it out and see if any of the default styles or, what do they, what they think of them?
He wants feedback.
So, well, I have a little feedback for them that one of the posts you, linked to in the show notes is, is basically a set of pictures, old version, new version with default styling almost universally.
They look better to me.
They look more modern.
Um, they don't look like here's a cheap unstyled sort of thing.
I'm just going to drop in.
They actually look like something that you'd be really excited to share.
Right.
So thumbs up for me.
Yeah, I thought so too.
And I thought, I, I would, I didn't even think about how hard it would be to, to change something under.
You know, change the rug out of a lot of people.
And, you know, 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.
Yeah, I totally agree.
So it's, it's easy to look through it.
If you care about Matt Plotlib, get out there and give them some feedback while you can.
Hey, before we move on, let me tell you about Rollbar.
Oh, please tell me about Rollbar.
I recently sent out an email, like a newsletter email to a bunch of people taking some of my courses.
And it turned out that I had typed in a URL incorrectly.
Like, so it was like, click here to launch this, this video.
It was like player slash lecture slash one, two, three, four.
Well, some like non-numerical number or a letter got in there.
My web app was trying to parse that as an integer.
And so I hit send on this email to like thousands of people.
And then all of a sudden my phone starts going beep, beep, beep, beep, beep, crash, crash, crash, error in your website.
And I'm like, what the heck is this?
I pull it up and like, I immediately see what's going on.
I see the stack trace.
I open up my, my, open up PyCharm, quickly change it, do a push to deploy.
And within five minutes of sending the email, nobody ever sent me a message.
I found the error and fixed it.
And the rest of the people that opened the email didn't crash.
And that was from Rollbar.
And if, if you, if you guys want that same type of behavior, that same type of safety net, you can get it at rollbar.com slash Python bytes.
That's awesome.
I wonder how long you would have figured out on their own without that.
I would have never known until somebody complained.
Like, so it was, it was really good.
I felt bad about it, but it was good that at least I got it fixed right away.
Yeah.
Awesome.
One of the things I'm a huge fan of is MongoDB and document databases.
I really think document databases are like 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 RealPython, 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 and querying data.
And they also talk about this thing called Mongo Engine.
Mongo Engine is like the SQLAlchemy.
You create classes, you put in constraints and defaults, and then you map those classes to documents in your database.
Yeah.
I'm really excited about this.
I'm trying to use PyMongo on one of my projects.
So this is good.
Yeah, it's definitely good.
PyMongo is pretty sweet.
MongoDB is easy to set up and use.
It's open source.
So that's all good.
I actually did a one and a half 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.
So I put a link in the show notes as well to this thing I call Applied NoSQL with MongoDB and Python.
So if people want a video version of mostly the same topics, they can check that out as well.
And actually from you, I learned about TinyDB, I think, on one of your podcasts.
Oh, yeah.
TinyDB is awesome.
Yeah.
So that was neat too.
Yeah.
Also Document Database.
You know, I love things that are for humans.
Yeah.
Next up, we've got an article introducing Maya, Date Times for Humans.
And most of the for humans stuff comes from Kenneth Reitz.
Do you know how to pronounce his name?
I've been saying Reitz.
I think that's right.
If that was like a German reading.
But if it's Reitz, I'm sorry, Kenneth.
So, Kenneth, if you're listening, please let us know.
Or I could, I guess, look at any talk that he's given and try to get that.
But anyway.
But the date times 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.
And so I'm excited that Kenneth has taken this on and tried to come up with his own library for dealing with date times and date time math and parsing dates and human readable stuff.
It just sounds exciting.
And I'm going to give it a try.
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 like just write SQL for humans sort of thing.
And now dates.
Very, very cool stuff.
Nice work, Kenneth.
Yeah, definitely.
And another package that I'm interested in that's coming up is an alternative to Flask or something Flask-like.
There are more and more reasons to move away from legacy Python to Python.
Especially Python 3.5 above because of the cool concurrency stuff.
One of the things that people talk about when they talk about Node.js, which I'm not a huge fan of Node.js, but it does have its benefits.
It's sort of asynchronous from the start programming model.
Now, that's been traditionally hard in Python because the WSGI API doesn't really support it super well.
Frameworks like Flask and Pyramid.
You can't just write async methods that all of a sudden become async, right?
There's like too much.
There's too much in the built-in stack that doesn't understand async.
This guy, I don't know what his real name is.
I can just know him as Channel Cat.
Created this thing called Sanic, which is called a Python 3.5 or higher web server written to go fast.
It's based on the API of Flask.
It leverages the async and await functionality of Python 3.5, which I think is really, really cool.
It also uses the uv loop, which is a really fast asynchronous IO loop for Python 3.
It's really cool.
So 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 like a URL, so like slash.
But instead of saying def some method, you say async def some method.
And you can await throughout your method.
And 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.
So you can get really good performance numbers.
Wow.
Neat.
Yeah, 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 like start from scratch and learn a totally new thing.
They actually have some performance numbers compared to other things.
And 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.
And they have some tests they did.
They said, okay, Tornado did like 2,000 requests per second with a 44 second millisecond latency response time, basically.
I said, 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.
The Sanic thing using Python 3 and the uv loop is 33,000 requests per second with a three millisecond response time.
Wow.
That's incredible.
Yeah.
See, Python's better than legacy Python.
Yeah, Python, definitely.
That's really cool.
So Python 3.5, the async await is a cool programming model.
And to 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.
Yeah, definitely.
At some point, I need to talk with you about trying to figure out if I were going to start up a new application.
Would I care about asynchronous stuff right away?
Yeah, that's a good question, right?
Like how much do you really care?
Because I mean, let's say on the Talk Python website, I think I have 10 processes farmed out to handle the request.
So like, you know, 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 like a pretty insane amount that I'm going to have to hit before I care, right?
But still, there are people who care and having that built in.
That's pretty cool.
Yeah, definitely.
I can't believe we're wrapped it up.
We've got all these done already.
I know, I know.
I think we've got a bunch of cool topics.
I love SanEc.
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.
Yeah, do you have any extra news you want to share with us?
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.
How about you?
You're still working on your book, right?
Definitely, and I've ramped up the schedule.
So I spent the Christmas break at the keyboard.
And I've got, I think, about halfway done with the rough draft approximately.
But going through the first level editor, I'm still shooting for a beta, at least a beta release by PyCon.
My goal of getting a physical copy by PyCon seems actually insane right now.
So, but that's what I'm up to.
You can do it.
We're all rooting for you, Brian.
You can do it.
And a whole bunch of test and code episodes coming up.
I've got one interview recorded and about four interviews scheduled.
So these will keep going.
I have not quit.
All right.
Awesome.
Glad to hear those are coming.
Yeah.
All right.
Well, thanks a lot for talking to me today.
Yeah, it's been great.
Thanks for sharing the news with me.
And we'll see you later.
Thanks.
Thank you for listening to Python Bytes.
Follow the show on Twitter via at Python Bytes.
That's Python Bytes 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 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.