Hello, and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 98, recorded October 4th, 2018. I'm Michael Kennedy.
And I'm Brian Okken.
Hey, Brian. How are you doing?
I'm doing great.
Excellent, excellent. Happy to be back with you for another week's worth of news.
Yeah, it's good to talk to you every week.
Absolutely. So I also want to say thank you to DigitalOcean for making this possible.
They're one of the biggest supporters of the show. So thank you to DigitalOcean.
Check them out at pythonbytes.fm/DigitalOcean. Get $100 credit for new users.
More about that later. They have some really cool stuff.
I was just listening to It's All About the Pendiums.
Do you remember that song from Weird Al Yankovic?
No.
Oh, my gosh.
Must be missed that.
We might have to put it on the show.
Oh, it's like this funny, you know, Weird Al Yankovic type song.
It just popped up for some reason.
And from the 90s.
And it's all about like tough rappers.
And these rappers who are like, but they're like programmers.
So they're like insulting each other, right?
Like how slow their computer is.
And one of the insults is my flat screen monitor is 40 inches wide.
And yours says Etch-A-Sketch on the side.
That's funny.
That's awesome, right?
So here we are, 20 years past then or whatever.
And we're still talking about Etch-A-Sketch.
Yeah, definitely.
So, okay.
So this article is about Etch-A-Sketch.
And it's called Make Etch-A-Sketch Art with Python.
And it's fabulous.
So background.
It showed up in Toy Story with like the...
And it's shown up other places of like really, really fast Etch-A-Sketch drawings happening.
And I'm sure a lot of people, other people have figured this out too or tried to think,
man, if I could have, I could hook up some motors to those, the knobs and somehow get my computer to do all of this for me.
That would be cool.
So that's what this is.
It's this great article about how this person put together some motors, a Raspberry Pi and some software.
And a little bit of woodworking to get to keep everything all in one place and got it to draw pictures.
It's so cool because it's one of those, it seems like a fun project you could do with your kids or something.
And also it discusses some things like how do you get a picture into line format?
And he uses something called canny edge detection.
And then if you've got a line drawing and pixels, how do you translate that into like motor control?
And you have to have a path.
So he uses a library called networks.
It's a Python library to do path, coming up with nice paths.
And then he has some results there.
He shows some pictures where the starting picture and then the end result of drawing.
And it's just fun.
You know, what I like about this is it's got this cool IoT aspect with the Raspberry Pis and the motors.
And it's not just a software project.
It seems like it'd be something really fun for people to explore if they're getting into programming.
And then it also has like a really advanced thing.
Like you could do a really cool like booth or something where you put up an Etch-a-Sketch.
And when anybody walks up, it could do like face detection and like draw them.
Like you could do all sorts of fun stuff with like the, you know, PyTorch, machine learning and all kinds of fun stuff.
So yeah, this is a great one for people looking for cool projects.
Yeah.
If you could get that booth thing set up so that we have it ready for PyCon, that would be great.
Yeah.
I'm working on it.
We're almost there.
So one of the things I really like from PyCon 2017 was the keynote by Instagram.
How they almost magically migrated their entire code to upgrade Django, completely switch from Python 2 to Python 3.
And they did all of that without branching continuously in production, which was awesome, right?
Yeah.
That was an incredible talk.
Yeah.
And so certainly that was one of the major users of Python.
But if you look at desktop applications, it may be that Dropbox is actually one of the most popular and quite large desktop apps in Python that there is.
I would venture to say that's true.
Yeah.
So the Python, they have over a million lines of code in Python, a million lines of Python.
And it's installed, I don't know, hundreds of thousands of desktops at least, right?
So the big news is Python has had a really big gravitational pull around Dropbox.
We've had some of the core developers working there.
Obviously, Guido Van Rossum works there.
That's a big deal.
So the fact that they were on Python 2, it's kind of a weird juxtaposition of like these two worlds, right?
Yeah.
So what's really cool is they have now migrated to Python 3.
And it's not just like they've rolled out a web app on Python 3 where they control the servers, but they have done some really incredible engineering to allow them to ship Python 3 into these more modern operating systems, enabling interesting things like kernel level, smart sync, and all sorts of crazy stuff that's happening.
So that's what we got this week.
That's awesome, huh?
Yeah.
That's really exciting, actually.
It is exciting.
And what's great about their write-up is it talks a whole lot about the challenges that they faced, why they wanted to switch, all of those kinds of things.
So they said they've relied on Python 2 for many years, most recently 2.7.
And they actually began this transformation from 2 to 3 in 2015.
But if you go through and read that article, you'll see like a lot of creation of technology had to be done in order to make this switch.
So in their previous version, their Python 2 world, they were using freezers.
So like Py2App, Py2Exe, I think it was BB Freeze for Linux.
And they were also exploring PyInstaller, but they ended up not using PyInstaller for some reason.
But they were using those types of things to package up Python.
Yeah.
And now what they're doing is they actually had to build native apps.
So, you know, using Visual Studio for Windows, Xcode for macOS to build like .app files.
And what they're actually doing is they're hosting the Python runtime in their native apps to bootstrap up their apps in order to get the deployment story working better.
That makes sense, but that doesn't sound easy.
No, it doesn't.
They actually built a way so that they could host either Python 2 or Python 3 and flip a flag so that they could actually do that concurrently, right?
So they built the Python 2 version and they started shipping that out and got that working.
And then they slowly, for different sets of users, started turning on the Python 3 version on the same type of code there.
Wow, that's cool.
But they talk about why they had to do it.
So, for example, SmartSync, which I actually just bought from Dropbox recently, is pretty awesome.
So I've got like almost a terabyte of stuff in Dropbox with all the core stuff and whatnot, the videos and so on.
And SmartSync will like let you go to your Finder or your Explorer and show you all of your files.
And some of them are in your hard drive and some of them are in the cloud.
And you can just like double click them and they just open, you know, or open them some other way.
And they like Dropbox hooks into that and says, oh, hold on, we got to download that.
Now you can have it, right?
So it's really great for like saving drive space and whatnot.
But you can't do that.
You can't install that kernel type of stuff with Python.
So they needed their native apps anyway.
Okay.
They also talked about why they might switch to Python 3.
They said there's two major features that we really care about.
And there's some pains that we're trying to get away from.
The exciting features were they're really interested in type annotations.
Remember, mypy is coming out of Dropbox.
Gito Van Rassam is working on that.
And mypyC that takes type annotated Python code and compiles it to C extensions also is coming from Dropbox.
So they're really doing a lot with these type annotations, which is interesting.
And they're also really interested in async and await.
Apparently that helps a lot for what they're doing.
Yeah.
Asynchronous copying of files.
You'd think.
You would think a lot of IO happens on the network and on the drive.
Definitely.
So that was the positive.
The other problem is they said that a lot of the tool chains they're using is really old and crusty.
Like, for example, they had to have a separate fork of CPython so they could compile it with a modern C compiler, like Visual Studio 2013.
So there's something super old and not supported on Windows.
And they're like, this is just not cool.
Like, why are we maintaining our own fork of the CPython just so we can compile it?
Yeah.
Anyway, there's a lot of weird stuff they had to get away from with Python too, right?
And that's not getting better.
Yeah.
So they talked about all this stuff, a lot of details.
And they also said, we're planning a bunch of future posts.
So we're going to talk about how they report crashes on Windows and macOS and how they use that to debug both native and Python code.
That's one of their posts coming.
That's cool.
Yeah.
How they maintain a hybrid Python 2 and 3 syntax and what tools help them do that.
Another post.
And then it's sort of a war stories, the very best bugs and stories from their Python 3 migration.
So I think we have three topics picked for the next couple of Python bytes.
Yeah.
If they come out in time.
Yeah.
Sure.
Yeah.
For sure.
Well, maybe they'll even do a presentation about this at PyCon.
Yeah.
Let's hope.
Are you speaking of PyCon?
Are you going to submit something?
I probably am.
Yeah.
I haven't yet, but there's time.
Sorry.
I'm going to submit something and I'll just put your name on it.
That'll help.
Yeah.
If anybody else wants to do that too, just submit something and put my name on it and I'll just, you
know, I'll wing it once I get there.
Well, ours might be a joint one.
Oh, that makes more sense.
Yeah.
Right.
But where would we get the resources?
You lined it up for me.
Thanks.
So I wanted to talk about some resources for PyCon and it's not just, these are targeted at PyCon,
but it really is really any conference, technical conference, I think.
And a lot of the regional Python conferences have similar things.
So we're putting a bunch of links in the show notes.
We've got, they have a nice speaker page.
That's a kind of a top levels, what it's like to speak there and stuff.
Actually last year being my first time talking at PyCon, I think that I would encourage really
anybody to try it because it's a fun experience.
So take a look at the speaking page.
And then there's a proposal tips.
So the first thing you got to do is you submit a proposal and that can be nerve wracking,
but it really shouldn't be.
So there's a few resources I'd like to poke people to.
There's a talk proposal resource page on the PyCon 2019 site.
And in there, there's also some links to some external articles and stuff.
And then including some people who have shared past proposals, whether, and even failed ones
and why they think they failed.
And then Marietta, I don't know her last name, but she's the core developer.
And she recently published her set of proposals, the ones that have been accepted.
And I really like them.
Actually, I took, look, look through those.
And some of these are really nice, clean examples and make me think that maybe it doesn't have
to be as complicated as I thought it was.
So there's those.
It's nice.
Yeah, that's really helpful.
And, you know, like you said, this is helpful to however you want to get started.
And you don't have to get started at the top level PyCon.
You could always do something local.
Yeah.
And then one of the things I wanted to bring up also is before attending PyCon, I didn't
know what poster session was.
I'd seen it a lot, but I didn't really know what it was.
Or I'd seen it mentioned.
And a poster session is, don't dismiss this.
This is a pretty cool thing.
The PyBytes guys did a poster.
And what happens is the, in the expo area where all the, like where we were and a lot of the
companies are, that's really cool, but it isn't on Sunday.
Those people get out of there.
And on Sunday, that area is, there's, you know, there's a job fair thing going on, but
there's also these poster sessions where people have these little tight, these areas and they
get a few feet of backspace and they get their poster put up and a little table for them.
And so the people that are there to talk about it, if you have like a project or something
you want to talk about, that's a good, a good way to get your feet wet and not, you don't
actually have to present a talk, but you can talk with people about whatever you're passionate
about.
Yeah.
And you can meet some pretty interesting people that way as well.
And you also give a link, a shout out to Jason Wadier's blog post.
You don't need to be a pro at Python to crack the code of PyCon, which is great.
And that's a really good article about how somebody new to Python went to PyCon and still
got a lot out of it, even though they weren't an expert.
One of the things he mentions is that the expo hall, everybody there is trying to sell you
something.
I just wanted to say that we're not, we hang out there and we just want to talk with people
and be there so that people can come up and say, Hey.
Yeah, that's right.
It's a great place for us to meet people.
Yeah.
We typically lose our voice by the end of the second day.
Yeah.
It was a ton of fun.
Yeah.
It's great.
Yeah.
So one of the reasons that we get to go there is because of people support our show and sponsor
our show, right?
Like DigitalOcean.
And I just want to call out a cool feature that I saw them recently talking about.
And I think people might find actually super useful.
So when you create, normally you create a virtual machine or some form of infrastructure as a service
in the cloud, you get like a little dropdown, like, well, what do you want?
Ubuntu?
You want, you maybe have it pre-configured for this type of service.
Sure.
But with DigitalOcean, they have this thing called bring your custom image to DigitalOcean.
So you can spin up a virtual machine and get it exactly the way you like it to run perfectly
set up on your system with your company.
And then you can just upload that and say, now when I create a new thing on DigitalOcean,
use that.
Oh, wow.
Isn't that cool?
Yeah.
So all you got to do is make the image, upload it, and then you can just log in and say, you
know, I'd like to choose from my custom image and hit start and off it goes.
So that's, that's pretty cool.
There are a few simple restrictions on what has to be installed.
So like they can manage the virtual machine from the outside, but you know, it doesn't
seem very restrictive to me.
Anyway, it looks like a great thing.
You can check it out on their blog, but if you want to get started and get the credit,
Python by set of M slash DigitalOcean.
Nice.
Yep.
This may be a little bit repetitive, but Brian, have we talked about GUIs?
Yeah.
Yeah, we have.
Actually, this one I want to share with you because I think it's actually super awesome.
I think we started this whole path long ago when I said, I really just would like, what
did I call it?
Like proton.
I called it proton.
I said, I want electron JS for Python.
I said, we should call it proton as well because of the P.
Someone has come up with a great way to use electron, which is electron JS.
It's like a Chrome and node type thing that stuff like GitHub's Atom editor, Visual Studio
Code, Slack, all those things are built upon.
Those are nice looking systems, right?
You write HTML, you can use cool JavaScript stuff on the front end.
And then, but on the back end, you got to do node and JavaScript.
Yeah.
I don't want to do that.
Well, there's things you miss out on.
Like what if you want to do something with machine learning?
Like JavaScript doesn't have good machine learning tools to run locally, but if you had Python,
you could use like GPU accelerated local stuff.
That would be awesome.
So it's not called proton, but I will point you at something called electron Python.
Okay.
It's basically the same thing without the name.
So what it is, is it's someone has taken electron.
Well, it's not even a new project in that sense.
It's more of a way of using two different projects.
So take electron JS and take Python.
And on Python, there's a thing called zero RPC, which is like a raw sockets communication layer instead of HTTP.
Okay.
So this really simple local communication layer, use that as a server.
And then use electron to just show your app with your JavaScript and HTML.
And instead of talking through electron to node, you talk through electron, just more directly over to your Python code.
So it's awesome.
You get like exactly the same thing that you're building, say, Visual Studio Code with.
You could do that, but have Python as the implementation on the backend.
And if you need to pip install anything, you do it.
It gives you like native access.
So native menus, notifications, automatically update your app, all that kind of stuff.
It's pretty awesome.
That is cool.
Yeah.
That's really cool.
Right.
The question becomes though, still like, how do I get that to somebody?
Right.
Great.
So I have this, this, Reeb Goldbergian contraption that I've created of like, Chrome, a JavaScript node and this Python code, which then also depends upon Python, everything you pip installed, right?
Like deployment can be a challenge.
So one of our listeners, Andy Boca sent us a really nice message and wrote a super informative blog post of building a deployable Python electron app.
Takes you through all the steps of how he packaged up Python, his dependencies, how he created it for macOS and windows, all sorts of stuff.
Yeah.
That's fun.
Actually, that's pretty cool.
But with the code available, so you can try this out and follow along.
Yeah.
It's got the code and all sorts of stuff.
So it's a pretty good working example.
If you would like to try to create this and use this.
And if people do create an app with this, please, you know, put a comment on the show notes.
We'd love to see it or shoot us a message somehow.
Yeah.
There's a lot of projects I want to try to do with something like this.
So yeah.
Neat.
Yeah.
So I'll leave you with one final thing.
Like right.
He goes through this long process of here's how you run this script and then that script and then bundle this together.
You know, use PyInstaller and then use npm package or something to like suck in the PyInstaller.
And there's like a lot of stuff going on.
So he ends the deployment post saying, and somebody please wrap Electron Python into an IDE so that in the future, all we have to do is click a build button like we could 20 years ago.
Yeah.
Nice.
Yeah.
So I guess it's doable now, but it's still a question of, is this really easier than using like QT or something like that?
No.
Well, he talks a lot about that and he says, look, if your choice is to use QT or say WX Python or TK Enter and all of those, maybe with slight exception of QT, there's really like one or two people who are working on it part time.
And when you use Electron using Chrome and all the JavaScript front end frameworks, you might want to select, right?
Vue JS.
And you have Google and all the web developers in the world basically pushing that UI platform forward.
Okay.
So, you know, there's that.
So that's, I mean, that was the argument of the, of, of what the two guys who are building this.
You can either take that as a good argument or not, but that's what they were saying.
Yeah.
And now that it's doable, it'll get easier as time goes on and people add to it.
So.
All right.
Come on, PyCharm folks.
Give us that build button.
Give us the build button.
We don't want to know the internals.
Come on.
All right.
So probably enough on that, but that's a, that's actually one of the more promising ones.
And I'm still, I might give it the nickname Proton.
I don't know.
Yeah.
We should just tell them you can use that if you want.
Yep.
They can have it.
Awesome.
All right.
So what's our next one?
I just wanted to give a shout out to Pluggy.
If anybody doesn't know that I kind of am a fan of pytest.
Really?
Yeah.
And part of pytest.
So one of the things that pytest, pytest actually grew out of the Py project.
Another offshoot is Pluggy.
So there's a ton of pytest plugins that you can add on.
And I use, I use quite a few of them.
And the way these plugins work is, is through this plugin system.
And it's a, it's a plugin management and hook system.
There's often a problem.
If you've got an application that has a lot of possible customizations for other people to do,
but how, you know, you want to be able to provide plugin or hook capabilities, but you don't want to,
you know, expose too much internals.
And you also want to like isolate this API, this interface so that you know that you can do refactoring and rewriting stuff and you're not going to break plugins.
And plugins, an option.
And it's, I think it's a really good, solid option.
I have noticed that a few other projects have used this.
The, I don't have a list of those, but it's a, I don't think we've covered it before.
And if we have my apologies, but it's kind of neat.
I don't think so.
And my little side project of cards, a lot of people said, well, if we're doing like task management,
there's going to be extra little things.
People want maybe a different list of things.
You maybe not an owner, but you maybe need priority and maybe time estimates should be in points versus hours or things like that.
A plugin system might be good.
So I'm actually thinking about trying to put pluggy into this little, little side project of mine.
So.
Oh yeah, that's really cool.
Yeah.
This is used by pytest, by Tox, by DevPy.
So certainly it's getting some real world testing.
That's great.
It's, you know, I like these plugins as an idea of saying, I would like to let people change how this works without just letting them actually change the project.
Yeah.
That's cool.
All right.
Are you ready for something scary?
Like actually truly scary?
No, but let's talk about it anyway.
All right.
This was said over by Eduardo or Jenna.
This is on Bloomberg.
So on, Bloomberg.com.
So it gives it's Bloomberg business week.
It's a pretty serious article and it's, it's pretty deep reporting for something that has happened.
And it's called the big hack, how China used a tiny chip to infiltrate U S companies and other companies.
But they're thinking they were aiming them actually at U S companies and defense contractors and stuff like that.
Oh, creepy.
So tell me more.
All right.
So first of all, when they say a tiny chip, I don't know, I don't know what you guys are visualizing, but if you hold up, say a U S.
Penny or like a penny or like a euro cent and you look at the lettering on there, the chip was the size of one of the letters.
Like, so where it says the year that penny was printed, it's like the size of like the two.
And they, they decorated as like, a different type of component that goes onto the chip.
So this is, it's really a long article.
Like I said, quite deep reporting and says, this was an attack by Chinese spies that reached almost 30 U S companies.
How they know that it was 30 and not 37 or something is actually really interesting.
including Amazon and Apple by compromising America's technology supply chain.
So what happened was they found out that there was some spies in the Chinese government that threatened the subcontractor of the subcontractor of a company that made motherboards for many data center servers.
Yeah.
And they said, well, you have a couple of choices.
One, we can bribe you to install these little tiny chips, or we can threaten you with inspections of your factory.
If you don't install these chips and keep it quiet.
And pretty much they found out that some of these subcontractors were like, well, we want to keep our business.
So chips go in.
Jeez.
Yeah.
And so this all started when Amazon went to acquire actually a Portland based company called elemental technologies, which basically helped with like streaming and video compression.
Yeah.
And as part of the purchase process, I said, well, let's do some due diligence on you.
And they actually sent off the server hardware that they were using off to some other company.
I think it was in Canada or somewhere.
And they said there was a nested on the servers, motherboards.
The testers found a microchip, not much bigger than a grain of rice.
That wasn't part of the original motherboards design.
Like, I don't even know how they found that.
Right.
Like that's insane.
And so then they found out that these motherboards were used by the Department of Defense and CIA drones and Navy warships and Apple and Amazon and all sorts of places.
And they're like, whoa, what's going on here?
So they did a bunch of like a spy on spy stuff.
And they found out kind of like what I told you.
And they realized that these chips were basically opening back doors in the network of all of these servers, which would then go download bigger bits of code would actually take them over and you could just log into them.
But they were interacting with these other servers somewhere on the internet.
So they hacked those servers and they figured out that 30 companies' machines were interacting with that server.
And that's how the number is 30.
Wow.
Okay.
Anyway, the whole supply side chain thing is pretty scary.
But this is not technically a software topic.
But, you know, I think it's something that we in the technology industry need to just be aware of because this is pretty crazy.
Right.
And there's no software that will tell you whether or not this is a problem.
Right.
Because this is at the chip level.
Yeah.
Geez.
Anyway, there, let's leave it with that positive note.
Have a nice day, everyone.
Have a good day.
Apparently, the 30 companies who had their servers interacting back with the hacker controller, command and control servers have been notified silently.
Yeah.
But anyway, there's a bunch of inside reporting and stuff.
It's quite interesting.
So check that out.
Well, that's it for our official items.
Anything else you want to share, Brian?
No, I just want to rave about your new course.
Oh, thank you.
So the new course is going really well.
So I, you know, the async course that talks about asyncio, async and await, multiprocessing, all that stuff.
It needed to exist.
And I'm so happy I built it.
Yeah.
So what I wanted to bring up is I know async is hot because of a lot of people thinking about the new async stuff that came into the more recent Python 3s.
But it's not just that.
So one of the things I like about the course is you do talk about the new asyncio and aiohttp.
Yeah, those.
But you also, it isn't just that.
It's also things like if you are concerned about that, you're probably concerned about things like I just want to make stuff run faster.
And so there's other options to like multi-threading and multi-processing and when and how to use different ones and kind of how to decide that.
And then even if you want to make it faster, there's things like I think, do you cover Cython then?
I do cover Cython.
Yeah.
So just it's not just the more recent things.
It's a big full picture and it's not even that long.
It's just like five hours or something.
Yeah, it is.
Yeah, thank you so much for that.
That's really nice of you to say so.
Good job.
Yeah.
Thank you very much.
Happy to do it.
All right.
And happy to meet up with you and talk about the news as always.
Yeah, thanks.
Talk to you later.
You bet.
Bye.
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.