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

Transcript #151: Certified! It works on my machine

Return to episode page view on github
Recorded on Friday, Oct 4, 2019.

00:00 Hello and welcome to Python Bytes where we deliver Python news and headlines directly to your earbuds.

00:04 This is episode 151 recorded October 2nd, 2019.

00:09 I'm Michael Kennedy.

00:10 And I'm Brian Okken.

00:11 And this episode is brought to you by DigitalOcean.

00:13 Check them out at

00:15 Get $50 credit for new users.

00:17 More on that later.

00:18 Brian, how are you doing?

00:19 I'm really good.

00:20 Super. We are on PDX Python Meetup West.

00:26 PDX West Python Meetup, whatever you're calling it.

00:28 Eve, aren't we?

00:29 - Yeah, it's like just right around the corner.

00:31 - Yeah.

00:32 - Although it'll probably already have happened by the time this comes out.

00:35 - Yeah, it may. It's going to be tight. So, well, I'm sure it went wonderfully.

00:40 So, you got all the speakers lined up and everything.

00:43 I'm really excited to have that as part of our community around here.

00:47 Who knows? Maybe we can put it online somehow, but no plans for that, it sounds like.

00:51 You know, I hear a lot about containers.

00:54 And when I first heard of Docker and things like that, I thought Docker was, I thought they had created containers, right?

01:03 Like they had come up with this idea of this other kind of isolation relative to say a virtual machine.

01:07 And looking into it, it turns out that's not the only option.

01:10 And they actually didn't even come up with it, right?

01:12 They just bundled it up and packaged it nicely.

01:14 - I think what Docker has done is very cool, but I have yet to find a use case where I needed it so far.

01:20 And there are other options.

01:23 and one of our friends of the show, Matt Lehman, has written an article called "Python Alternative to Docker." The article uses a tool called Shiv from LinkedIn, which is a hilarious name.

01:36 We actually did mention it briefly on episode 114, but I didn't know much about it.

01:41 And so this is kind of a neat article.

01:44 It talks about that Shiv uses a zip app.

01:47 And I think we've talked about that before, that you can, and I think there's a few tools that utilize that.

01:52 - Right, things like pex and stuff, yeah.

01:54 - Yeah, you can zip up a Python application with all its dependencies.

01:58 And I don't think that at that point it includes Python, does it?

02:03 - I don't think so.

02:04 And that was actually super disappointing to me that it didn't just deliver a thing that ran.

02:08 You still have to have Python, but it's like you don't have to install the app.

02:13 As long as you have Python, you can run it was my understanding.

02:15 - This article is talking about, and this totally makes sense.

02:18 You've got a continuous integration build pipeline where you're making changes and maybe you're updating dependencies, but on the deployment machine, you're not deploying, you don't have to update Python all the time.

02:32 You're just updating the thing that you package.

02:34 And that's kind of a neat thing about Shiv is all your dependencies, maybe you're updating dependencies or maybe you're updating your own application or fixing bugs or whatever, that can all be put together and tested as one deliverable unit.

02:48 and then just that can be updated to a server machine.

02:52 But then all the steps of like, okay, that sounds in concept, that sounds great, but what are all the steps I have to go through to actually get that done?

03:00 And Matt has done that.

03:01 He just basically walked through all the steps to try to get that done.

03:04 And I thought it was really great.

03:06 He does talk about packaging a little bit because you kind of have to talk about packaging when you're talking about deployment.

03:13 So this is kind of fun.

03:14 He does do a shout out to, If you didn't use Shiv or Docker, what would you do?

03:19 What are all the little steps you'd have to do?

03:22 Which just makes it sound like something that you'd either hire somebody else to do.

03:26 (laughing)

03:28 - I'm not doing that.

03:29 - Yeah, but he also does shout out to Platform as a Service, things like Heroku and Python Anywhere.

03:35 And I think that's cool that there's other options.

03:37 Like if you wanted to throw money at it, you just use one of these.

03:40 And these actually aren't that expensive.

03:43 If you're trying to just save time, that's a fine trade-off.

03:46 But if you want to do this, this is a neat idea.

03:49 Also, Docker's a big hammer.

03:51 I mean, a lot of people love it and that's great, but bring up with a lot of people that you want to try to put Docker, deploy with Docker.

04:00 And if it's a thing like this, like you're just deploying an application, that might be overkill.

04:04 - It seems like it's a middle ground, right?

04:06 Like I'm packing up not just my Python code, but my Python dependencies and a lot of the setup around that.

04:12 You still have to have Python there, but beyond that, right, it's like not really much to it.

04:17 If you need to depend on other things, like I need Redis running on this port and I need Postgres like that, and I also want this other thing in Linux doing something, like all of a sudden, then you've outgrown bundling Python more cleverly, but if you don't need that, it sounds like a pretty cool way to do it.

04:34 - Yeah, like in this example, the example that Matt gives is a Django application that uses a Gunicorn or G-Unicorn.

04:42 So that all those dependencies are bundled together.

04:45 It's not like a special kind of Django app with a huge backend that's necessary.

04:50 But although, I mean, Django uses a database, so I'm not sure.

04:53 - Yeah, yeah, interesting.

04:55 While you're talking about Docker, I'm a fan of Docker in general, but kind of like you, I don't do a ton with it day to day.

05:02 I just, the stuff I do is just not that complicated.

05:05 But I recently read an article in ZDNet, that site actually still exists, apparently.

05:12 And it actually says, this is surprising to me, sort of like I was surprised when GitHub got acquired.

05:18 I realized afterwards, like, "Oh, they're actually financially in deep trouble, and maybe this is good rather than just going away." The article says, "Docker is in deep trouble.

05:28 A leaked internal memo, the Docker CEO reveals that the troubled company is looking for more money." And they talk about pushing through with perseverance despite lack of clarity on the future and stuff like that.

05:38 So anyway, just something to think about.

05:40 - Definitely, and I read that and I forgot that Docker was a company.

05:43 - Yeah, exactly.

05:45 And I don't even know if it matters if Docker as a company goes away.

05:48 I mean, there are parts of Docker that are important, like the registry and stuff like that, but you could totally use Docker if you just had the tools, but still, it's, I don't know, it's just always interesting to see how this is playing out and something you want to consider if you're gonna bet your project on it, right?

06:04 - Yeah, definitely.

06:04 - So I have a bit of a theme for this week as well, and it has to do with helping scientists do Python stuff a little bit better.

06:13 So this first thing I wanna talk about is an article that's kind of a how-to from this woman named Anna Nowogrodzki.

06:21 I'm gonna go with that.

06:22 Sorry if I messed up your name, Anna.

06:24 And it comes to us by a recommendation from a listener named Jason Thomas.

06:28 Thanks, Jason.

06:29 And the title is, "How to Support Open Source Software and Stay Sane." - Nice.

06:35 - And this is referring to scientists who develop libraries like NumPy or some form of Scikit-Learn or something like that, and then they release it to the world, and then all of a sudden, they've got all this software development work and 100 GitHub issues, they got a review, and they're like, "I was just trying to give back "a little bit, what just happened?" So the article has some interesting quotes.

06:58 So I'm going to do a little bit of quoting from it, because I think it's pretty revealing.

07:02 Anyway, it says, "The premise of the idol is that releasing lab-built, open-source software involves mountains of unforeseen work for the developers." Right?

07:10 You think you're done when you release it, and it kind of starts.

07:13 But it opens up saying, "On the 10th of April, astrophysicists announced that they had captured the first ever image of a black hole.

07:21 This was exhilarating news, but none of the Giddy headlines, other than us, mentioned that the image would not have been possible without open source software.

07:29 And the image was created by Matt Plotlib, a Python library for graphing data, as well as other components of the open source Python ecosystem.

07:37 Here's where it gets interesting.

07:38 Just five days later, the US National Science Foundation, the NSF, rejected a grant proposal to support that ecosystem, saying that the software lacked sufficient impact.

07:48 (laughing)

07:50 - What even?

07:52 - What even, right?

07:53 So like I said, it's kind of a how-to.

07:55 It talks about where you're as a scientist, if you're creating software like Matplotlib or something, where do you go to get funding?

08:02 Where have people been turned down?

08:03 What has worked?

08:04 And so on.

08:05 It also talks a lot about using some software development, software engineering techniques for having successful open source projects that grow without killing you.

08:16 It's pretty good.

08:17 It talks about the challenges of not knowing, as a scientist, how you might not have fluency with Git.

08:24 you might not have a continuous integration.

08:26 Unit testing might not be a thing that you are super skilled in.

08:30 And it mentions places like the eScience Institute at the University of Washington, the software carpentry workshops, places like that where folks can go get that training.

08:40 And then also talks a little bit about when do you keep your software going and when do you decide like, it's obsolete, we're not gonna work on it anymore, what else are we gonna go build?

08:50 So if you're a scientist out there or you work with scientists, you wanna help them get rolling with Python and releasing their projects in a way that they'll stay sane, check that out, I think it's pretty good.

09:00 - It's a continuous problem.

09:01 - Yeah, it is, and some of the recommendations are things like make sure you have continuous integration, make sure you have version control, make sure you have testing, and one that I really liked was that you should focus on code readability over peak performance.

09:14 - Oh, definitely, always.

09:15 - Right, yeah, 'cause you're gonna have to fix bugs.

09:17 And I had a friend who, so I have a friend, who had this saying that was really interesting, that debugging software is harder than writing software, generally speaking.

09:28 So if you write software at the edge of the complexity that you can handle, you probably can't debug it.

09:34 So you need to step it back a notch, take it a little bit simpler, and then when it goes wrong, you could still deal with it.

09:40 I like that saying.

09:40 So before we get to the next one, though, let me tell you about DigitalOcean.

09:44 So DigitalOcean, all of our infrastructure runs there when you get your MP3s, that you hear our voices on, those came through a whole bunch of stuff that's happening over at DigitalOcean.

09:55 And they have two new services that I've been telling you all about for a little while, but I'm gonna keep telling you about it because they're good.

10:01 If you wanna use MySQL or Redis, they now have those as a service right there.

10:06 Just go flip a switch and turn them on.

10:08 That's in addition to Postgres as a service as well.

10:11 So definitely coming along, speaking of the software as a service over at the DigitalOcean side, I'm still a fan of fire me up a VM and install some stuff and let it roar, but that's all good.

10:21 Check them out at, get $50 credit for a new user, and they're doing good work, so we can recommend them.

10:28 - Nice.

10:29 - So you found another license in addition to MIT or GNU?

10:33 - Yes.

10:33 - GPL?

10:34 - I don't know what to make of this, so I wanted to bring it up just to hear your thoughts as well.

10:38 So there's a license, and I can't remember where I ran across it, but I think probably Twitter or something.

10:45 I spend way too much time on Twitter.

10:47 It's a license called the Hippocratic license, like the doctors have the Hippocratic oath of--

10:52 - First promise to do no harm, things like that.

10:54 - Yeah, I mean, I know it's way more than that, but that's all average people remember, like me.

11:00 So this is interesting.

11:01 It derives from the MIT license, and it adds a restriction.

11:06 And the restriction reads, the software may not be used by individuals, corporations, governments, or other groups for systems or activities that actively knowingly endanger harm or otherwise threaten the physical mental economic or general well-being of individuals or groups in violation to the United Nations Universal Declaration of Human Rights." Interesting. Yeah. That's an interesting thing and I like I kind of like it. My first reaction is, "Wow that's great. You can say I'm gonna let everybody use my use this software but I don't want it to be used to harm people." Completely fair. But I don't know if anybody the people that are like intentionally arming people they don't care yeah do you really think people that are in this are really gonna go oh yeah we really can't use this software to guide our like you know does this cover military I don't know also a lot of this has to do with the human well-being that's up for debate and like a perspective right like what we had to start the war to help people or you know but obviously if you're on the other on the other side of that, you're not helping us.

12:13 This is not helping, thank you for blowing us up.

12:16 It's really hard to interpret, and I think you're right that it is very challenging because the folks who are most likely to abuse it, it's like the hackers are like, yeah, well, I was gonna steal that $10 million from the bank, but it's got the wrong license.

12:27 It does still send a message that the person who works on the project cares, and it's not necessarily a negative, even if it's not super enforceable.

12:37 I mean, I'm sure that things about the MIT license, people break. I don't even know what you've got to do to break it, but you probably could.

12:44 I actually think it's an interesting thing to have around. I could definitely see people coming up with like different sorts of alternatives to the MIT license also, like not necessarily maybe this plus other stuff. I know people that intentionally would never work for the military, or work for a government or a military contractor because they don't want to. And I think it'd be completely legitimate for somebody to say, to have a license that said, "My open source software doesn't want to, I don't want that to work for these people either." So, but I haven't seen that. -Yeah, not putting any judgment on those things like working for Boeing or whatever. If you wanted a license like that, I think you could, you'd have to be more explicit. -It's a slippery slope, but the things that I kind of agree with, I'm like, "Oh yeah, well that's completely reasonable." - Yes, I know.

13:35 - What if people like released software that said, this is okay as long as you don't live in Oregon because I don't like Oregonians.

13:42 That would be lame, but people can do that.

13:44 - It would definitely be lame.

13:45 - Yeah.

13:46 - That's why you set up a server in California and you just remote it.

13:49 (laughing)

13:52 - I'm vacationing permanently in Oregon.

13:55 - Exactly, exactly.

13:57 It's an interesting find.

13:58 Yeah, so the next one, like I said, I'm on a bit of a theme here, And this next one is also about helping scientists do more, but more computational people.

14:07 So this one is a real Python how-to on why and how to make the switch from MATLAB to Python.

14:15 - Oh, this is great.

14:16 - Yeah, it's really, really detailed, like standard real Python stuff.

14:22 I'm not entirely sure how many pages it is, but it's quite a few.

14:26 So it's a good thorough, it's almost like a mini book on this, as Dan and his crew are used to doing.

14:33 So it basically compares the philosophy of MATLAB to Python, closed source to open source, things like that.

14:41 Then it walks people through how to set up Python and then just, you use these computational libraries in MATLAB, here's your Python ones.

14:50 You did these operations like graphing, here's how you do it in Python.

14:54 And so if you're out there working on a team that uses MATLAB, and I know there are a ton of them I've worked with some even around here, a great team who was moving from MATLAB to Python, who I worked with for a few days, helping to speed that transition and things like that.

15:10 There's a ton of these science-like groups, data science, not quite maybe data science, but on their way to that world, who I think would really benefit from that.

15:20 I long ago even used MATLAB for a little bit of work at this research lab that spun off off into a company and did like wavelet decomposition of real time eye measurements.

15:31 250 hertz per, you know, 250 samples a second, like wavelet decomposition is like a way harder Fourier transform, but it's funky stuff.

15:42 Anyway, to do that, it was fine, but the little toolbox, I think it's called, the wavelet toolbox that you got, was $2,000 per user.

15:52 That's a lot of money when you can pip install.

15:56 Something that also does that.

15:57 - So there's, MATLAB used a lot in our company as well, or there used to be.

16:01 I don't know what it is now.

16:03 But similar sorts of things.

16:05 There's engineering.

16:06 I'm more familiar with communication algorithms using FFTs and other communication transforms being mocked up in MATLAB before they go to like ASICs or something.

16:19 Yeah, this is very common.

16:20 And I'm really glad to see more and more people moving to Python from MATLAB.

16:25 - Yeah, absolutely.

16:26 I think it's just another one of those slices of the technology ecosystem where tons of people are leaving that space and coming over to Python because the great computational support that's developing.

16:36 Things like JupyterLab and all the NumPy, SciPy type of things.

16:40 Also in this article I learned that there apparently is this thing called GNU Octave, which is a free and open source clone of MATLAB that looks pretty good actually.

16:48 - Oh, interesting.

16:49 - Yeah, not that we want to encourage people go do that. They should come do Python. But this is still pretty interesting. I didn't know that exists. - Yeah, definitely.

16:56 - Have we spoken about GUIs? I feel like we should actually cover that sometime.

16:59 - Yeah. So, I was almost felt guilty about covering this, but it came up in episode 143 already.

17:07 But Nicholas Tollervee has got a project called PiperCard. I mean, I remember HyperCard.

17:14 I never really used it. Back in the day, the Dark Ages, but PiperCard is kind of this neat little thing. And did you use PiperCard ever?

17:22 No, I have some friends who did, but I've never used it.

17:24 It was a Mac only thing, and it was this thing where you kind of have a whole...

17:27 It's designed as if there's a whole bunch of different cards, and a GUI window was just a card idea. And then you could print whatever you wanted on the card, and then there would possibly be buttons or something on the card and if you push one of the buttons you go to a different card. And so you can think of an application as a deck of cards or a choose your own adventure type game. And that's where a lot of really complicated choose your own adventure games were made on HyperCard. And so HyperCard is a similar thing just in Python and it started out with Adafruit but it's now gone. Nicholas has made it. You can just run it on your anywhere and you can just pip install it.

18:11 And I was playing with it the other day and at first I dismissed it but when I had him on testing code on episode 89 and we talked about a little bit and I didn't realize this.

18:21 So one of the ideas is you have basically a simple list of what's in the card and then what card to go to next with different buttons and inputs and stuff like that.

18:32 But if you instead of saying which card to go to you give it a function to go to You can run any Python code as long as that function returns a string to tell you which card to go to next So that makes it actually pretty powerful to build up some fairly complex Logic very simply anyway, it's fun to work with I can even think I was even thinking of some work business uses that I could Use this for and get it mocked up really quick. That's cool. It looks interesting. It feels a little bit like a visual workflow executor, right?

19:05 Like I go down this step, then I do this step, then there's a decision, and then I do this step or that step, and it's all represented by these cards.

19:11 It's pretty cool.

19:12 - He has an example of a Celsius to Fahrenheit converter, but also, I mean, there's a lot of simple conversion, math stuff, applications in businesses that would be a good use for it.

19:25 And it also uses that user interface thing that I always forget, but it was like, nevermind, I can't remember what it is.

19:32 It's one that you don't see very many examples of.

19:34 Cool, yeah.

19:35 And it looks like a nice project.

19:36 Cool.

19:36 You know, something we don't talk a whole lot about on this show is Node.js.

19:40 I don't know if we ever have.

19:41 Have we?

19:41 You know, I think the extent to which we talked about Node.js was maybe some security issue in like NPM and how it is an analogous thing over at a PyPI.

19:51 Maybe.

19:51 Like, that's the extent of it.

19:52 OK.

19:53 So Node.js, obviously, is a pretty big server-side framework for running JavaScript code on the server, right?

19:59 And the story is like, hey, if I've I gotta write JavaScript on the front end, I might as well write it on the back end.

20:04 That's not my philosophy.

20:05 Mine is more like, how do I minimize the amount of JavaScript I write?

20:09 Let's not also do that on the back end.

20:11 I mean, not that I hate JavaScript, but I don't want to overdo it.

20:14 Anyway, there's a cool project that brings some integration between Python and Node.

20:23 So imagine you're working on some project, or you're on some team, and they're like, we've chosen Node, you're like, sigh, sad face.

20:30 But you still want to use some Python, or maybe you want to use some kind of Python library, like NumPy, TensorFlow, or whatever, something that doesn't have a JavaScript equivalent.

20:41 So you can use this thing called PyNode, and what it does is it's a bridge between Node.js and Python that allows you to call Python code directly from JavaScript.

20:52 So this is on the server, right?

20:54 If it was on the client side, then who knows, we'd have to use something like Sculpt or Brython, to Python and then it would convert the Python to JavaScript.

21:02 That's a different thing.

21:03 This is the C Python interpreter with everything that Python can do on the server, but you can interact with it, call it, and get return values from those functions in Node.js.

21:16 You call into Python and you get your answer back.

21:18 That's pretty cool.

21:19 The API for working with it is not too bad.

21:21 You have to basically, in Node.js, you require stuff to load it up.

21:26 require pynode and then you go to get your pynode you can say start the interpreter which will I'm guessing embed CPython into the node process and then you just call functions the way you directly call them is kind of crummy you say like and you would say quote add comma 1 comma 2 to call the function add by passing 1 and 2 to it and then you get a callback from that I think you could do some interesting stuff by wrapping this up into a a JavaScript class.

21:56 So you just say, create it, and then you just start working.

22:01 It has a .add that takes a one and a two.

22:03 You could put a facade that makes this much simpler, do a little async and a wait to get rid of the callback potentially, things like that.

22:09 But yeah, it's definitely got some potential there.

22:13 If you're working in Node.js space, you're like, "I really wish I had Python." Well, PyNode.

22:18 It's great.

22:19 I mean, there's more and more projects where there really aren't one language.

22:22 of trying to do lots of different things or you're trying to migrate from one thing to another, use the language that works the best for wherever you're at.

22:29 - Yeah, and similar to the last one that I covered, not trying to send people away to that thing, not to Node or to Octave or whatever, but just to acknowledge, right, just what you said, that there are these environments where you don't always get to pick Python.

22:43 Here's another environment where you can now blend these together.

22:45 - Yeah, there's lots of languages that are good.

22:47 None of them are as good as Python, but just saying.

22:51 - That's right, well those are the major topics that we're covering for the week.

22:55 Do you have anything extra to cover?

22:56 - No, although like putting together a meetup is more work than I expected.

23:01 - I appreciate you doing that, I'm sure that it is.

23:03 - I did submit, there's like call for proposals out and I did submit to a couple of conferences, so we'll see.

23:08 - Awesome, good luck on that.

23:10 The call for proposals for PyCascades, right?

23:12 And also I think main PyCon, right?

23:14 - Yeah, PyCon's open, Tennessee's open, a couple others are open.

23:17 - Super, I actually have nothing extra to share, except for I have a joke.

23:21 - Oh good, I didn't bring a joke.

23:22 - It's not exactly a joke, but it's definitely something that's very funny.

23:26 So have you ever heard the excuse that, man, this works on my machine.

23:31 - Yeah, it's closing a defect with cannot reproduce.

23:34 - Exactly, like, dude, this is working.

23:36 Like, why does this not work for you?

23:37 I just, who knows what it is.

23:38 It could be the version of some library that's installed.

23:41 It could be like permissions, who knows.

23:43 But there is a, it works on my machine certification program that I want to tell you about, okay?

23:49 - Okay.

23:50 It has like an honors badge.

23:52 It says, "Works on my machine." It's kind of golden.

23:54 You can put that on your wall when you get certified.

23:58 And there are real steps.

23:59 This is not new.

24:00 This is a pretty old certification, but I thought it'd be fun.

24:03 We haven't talked about it before.

24:05 So there's some specific steps that you gotta follow.

24:08 And the steps here are talking about a compiled language.

24:11 So maybe it slightly varies with Python, but still, I think it's funny.

24:16 So step one is you have to compile your application.

24:19 Getting the latest version or any recent changes from other developers is purely optional and not required for certification, okay?

24:27 (laughing)

24:28 Step two is you launch the application or website that's just been compiled.

24:33 Step three is you cause, you're gonna like this part as a person who's into PyTest and stuff.

24:38 You cause one code path in the code that you're checking to be executed.

24:42 The preferred way to do this is with ad hoc manual testing of the simplest possible case or the feature in question.

24:49 You may omit this step if the code change was less than five lines, or if in the developer's professional opinion, the code change could not possibly result in an error.

24:57 - Yeah.

24:58 - And finally, you now check your code into version control.

25:01 Congratulations, you're certified.

25:04 It's nice, right?

25:05 - Yeah.

25:05 - There's probably a lot of certified people.

25:07 They just need to like claim credit.

25:08 They've done this, I'm sure.

25:09 - Yeah, they just don't know.

25:11 - Well, they can now get the star and put it on their wall.

25:14 - Yeah.

25:16 All right, well, thanks for being here as always, Brian, and sharing all this news with everyone.

25:20 - Well, thank you.

25:21 Bye. - You bet.

25:22 Bye.

25:23 - Thank you for listening to Python Bytes.

25:24 Follow the show on Twitter via @PythonBytes.

25:27 That's Python Bytes as in B-Y-T-E-S.

25:30 And get the full show notes at

25:33 If you have a news item you want featured, just visit and send it our way.

25:37 We're always on the lookout for sharing something cool.

25:40 On behalf of myself and Brian Aukin, this is Michael Kennedy.

25:43 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page