#201: Choosing JupyterHub and Python over MATLAB Transcript
00:00 Michael Kennedy: The Nobel Prize in Economics recently went to Paul Romer, a convert from proprietary software like MATLAB over to Python and the SciPy stack. Paul said, "The more I learn about proprietary software, the more I worry that objective truth might perish from the earth." That's quite a statement, but what if your organization is deeply committed to proprietary software such as MATLAB? Well, don't despair, because Peter Kazarinoff, a professor at Portland Community College, is here to share his experience converting his courses over to Python and JupyterHub. This is Talk Python To Me, Episode 201, recorded January 23rd, 2019. Welcome to Talk Python To Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities. This is your host, Michael Kennedy. Follow me on Twitter where I'm @mkennedy. Keep up with the show and listen to past episodes at talkpython.fm, and follow the show on Twitter via @talkpython. This episode is brought to you by Linode and Stellares. Please check out what they're offering during their segments. It really helps support the show. Peter, welcome to Talk Python.
01:13 Peter Kazarinoff: Thanks, Michael, I'm so excited to be here!
01:15 Michael Kennedy: Yeah, it's really excellent to have you on the show. You and I have spoken throughout the years over Twitter and other mediums, and it's great to finally get to talk to you in more depth.
01:25 Peter Kazarinoff: Yeah, it's great to connect, I can't wait to tell my story about choosing Python over MATLAB and using JupyterHub in my classroom.
01:31 Michael Kennedy: Yeah, absolutely, I think that is such a good choice, and it's happening more and more. There's some really interesting quotes from the guy who won the Nobel Prize in Economics. I think that was Mathematica, Python over Mathematica, but basically, the knowledge of the free world was in danger because of these proprietary systems and Python and open source was the thing that would keep it free, and keep sharing the knowledge, which was pretty interesting. So, definitely a trend you're seeing around a lot of data science teams I worked with and stuff, as well. All right, so, we'll get to that, and we'll dig into that and it'll be fun, but let's start with your story. How'd you get into programming in Python?
02:15 Peter Kazarinoff: I got involved in programming kind of late. I'm an adult, and I didn't get started until about three years ago. Growing up, I wasn't a gamer, and at age eight, I wasn't pounding away at a Commodore 64 in order to write new programs. My dad, he was a biochemist, he wasn't a programmer, and my mom, she did art stuff for the school district, and she wasn't a programmer either, and there were some kids in high school who programmed their calculators to play games, but I wasn't that kid. I played soccer and I went camping and stuff like that.
02:48 Michael Kennedy: That's cool, that's probably a good way to grow up, honestly. I was always kind of blown away with those people that would program their HP calculators and stuff because they didn't have a proper keyboard. It was like texting, like remember when you'd have to hit a one, or maybe it was two, three times to get a C to come out? Like, who could program that way? But they did, right?
03:07 Peter Kazarinoff: Yeah, but they did it. But that wasn't me, so I did my graduate work at UW, and I worked on making plastic transistors and plastic solar cells, it was really cool research, and that was kind of the first time that I did some programming, and I used LabVIEW. Have you heard of LabVIEW before?
03:26 Michael Kennedy: I've heard of LabVIEW. It's like this graphical programming interface. Is it hardware-focused?
03:33 Peter Kazarinoff: Yeah, it's really just focused on hardware and you kind of drag these wires around the screen in order to connect components. I was just using that to interface with hardware and measure devices and collect data and stuff.
03:47 Michael Kennedy: Cool, tell me about this plastic hardware stuff that you were doing. Did you find a way to make plastic that was conductive, or was it like wrapping chips, or what was it?
03:57 Peter Kazarinoff: We were in graduate school making n-type semiconductor plastic, so regular chips that are in your computer, your phone, they have both the p-type and n-type silicon in there, and that's what helps the transistors shuttle electrons across. We were making these specialty plastics that would shuttle electrons when you applied what was called a gate voltage. So we were basically making these little transistors just out of plastic. It was really, really neat.
04:25 Michael Kennedy: Oh, that's crazy, could you 3-D print those these days?
04:27 Peter Kazarinoff: Probably, and we were thinking about, maybe you could roll to roll print them, like you'd print a newspaper. Maybe you could inkjet print them, like you're printing out a regular piece of paper, but the research was just very fundamental, like trying to measure core electrical properties of these plastics.
04:43 Michael Kennedy: That's pretty excellent. Okay, cool, so you had to learn this LabVIEW, draggy-droppy programming language, so that you could work on this hardware, right? I find that a lot of people actually get into programming along these lines where, like, well, I didn't really think I'd be a programmer, but this thing I thought was really cool, required this step to basically make it go, and maybe it's pretty small, but there it was, right?
05:04 Peter Kazarinoff: Right, then I started working at Portland Community College, where I work now, and I was digging through these things that are called course content outline guides. They're kind of like course descriptions that are up on the web, and I noticed that this course content outline guide, this course description, had the word his in it, and the phrase was, the student may work at his desk, and I was like, this is not good. Like, I've got two daughters, like, I want them to go into engineering, I really like it. We shouldn't have his in this description, so I started looking through all of the other course pages that were up, and I quickly realized that there are way, way too many to do by hand, right? We have over 1300 classes and I can't click on every single one and read through every single one! So I was telling one of my colleagues about this, and he was like, oh, you should learn Python, try this Python thing and you could write a little program that could do it. I was like, okay, I'll give it a try.
06:04 Michael Kennedy: It sounds really hard, but okay.
06:06 Peter Kazarinoff: It sounds hard, but I'll try! And so I found this package, Beautiful Soup, and I wrote this little script, and it was probably about a week, and I got this thing where I scraped every single one of these content guides, about 1300 classes, and found any time that there was a his, he, or him in them. It was just amazing that this thing, and I was clicking through individual links, and reading all the text. I could just take Python and then myscript.py and then, it all just came out into one CSV, it was amazing.
06:40 Michael Kennedy: Wow, that's pretty interesting. A couple of thoughts, one, I think that's definitely a noble effort, because we already have enough barriers to folks who are underrepresented getting into STEM fields, into programming and stuff. We don't need to make it less comfortable, right? So I think that's good, is this thing open source? Like if somebody worked at Johnson County Community College or whatever, right, could they borrow your thing and turn it loose on theirs?
07:08 Peter Kazarinoff: Yeah, I mean, the code is up on GitHub if somebody wants to try. This was my first Python project, so I hard-coded in a lot of the URLs and stuff like that, so it's not totally transferrable right now, but all of those GUI kicks that the Python ecosystem has been talking about, maybe I could turn it into one of those GUIs and somebody in another community college could just, like, click it and make it work for them. That would be pretty cool.
07:34 Michael Kennedy: Yeah, that'd be totally cool, like, put some GUI and a little CLI on it, or if somebody wants, they could create a web app and then you just give it the base URL of your college and it'll go through and it'll do it, right? Right, give it, do a little CSV download, that'd be sweet. So, my other non-technical question here was like, I definitely agree that this is a good thing to be aware of, and to try to eliminate, but how do you eliminate it? I mean replacing every him with a her, seems like a step that is in, like it's, the idea of it is right, but it also doesn't seem right, so to me, I don't know, this is an English question. This just bothers me in English. There's not a way to speak about a person in a non-gendered way, really, so I try to use they, them, their, but obviously, they're singular, but what would you propose here, as part of this?
08:25 Peter Kazarinoff: For those, you could say, at the student's desk or at their desk, or at a person's desk. You don't at all need to use any of those gendered pronouns.
08:35 Michael Kennedy: Right, long as there's more than one student, and there always will be, it'll be fine, right? It's just like, it's when it's singular, I'm like, man, I'm going to say they, and I know it's singular and it's probably wrong, but to me, it feels better than he when it's a her or her when it's a he, and it's just like, I don't know, it's just weird. We need a better bit of English here. All right, so, great, so that's how you got into programming is you saw, into Python is how you saw this problem. You're like, your friend's like, you know what, like a little bit of requests, a few for in loops, and some Beautiful Soup, and you've got this problem solved, actually. You said you teach at Portland Community College here in lovely Portland, Oregon. What do you do day to day, like what kind of classes do you teach, things like that?
09:14 Peter Kazarinoff: I teach engineering at Portland Community College. We're a community college, so we teach the first two years of a four year engineering program, and we also teach two years of a two year degree in engineering, so some of the students go on to jobs and some of the students go on to four year universities. I teach some of the intro classes. We call that E-N-G-R 101, and I also teach the engineering programming class, and then in the second year for engineering students, I teach some of the mechanical classes, like material science, manufacturing, and machine design.
09:49 Michael Kennedy: Cool, those sound interesting. First of all, maybe we should just define what a community college is, for folks who are not in the United States. I feel like this is kind of a US type of thing, like in the US, we have four year colleges and we have super expensive four year colleges, and then we have high school, and high school is especially bad in the US, in terms of preparing people for a job. In Europe, I feel like maybe what they learn is not necessarily better, but in the end, they either have a vocational track that they can sort of follow on, especially in Germany, or they go a little bit farther in high school so that they actually have a little more skills when they come out. In the US, like, having a high school degree almost is like not having any degree at all, right? So, maybe just talk about that, so people who are not familiar with this idea know what it is.
10:38 Peter Kazarinoff: Yeah, so in the US, after high school, you could go to a regular four year school, like the University of Michigan or Stanford or something, but there are also these community colleges and they're usually two year programs, and they kind of have two separate aims. So one of them is as a vocational school, so you could go after high school and we have, say, an automotive department, you learn how to be an auto mechanic, or we have a welding program, you learn how to be a welder, or we have a pre-nursing program, so you learn how to be a medical assistant. Then the other function that the community colleges serve here in the US is to prepare students and get them doing their first two years of college and then they'll finish their third and fourth year of college at a regular school. It's both that kind of vocational school as well as kind of like the first two years of what you consider regular college.
11:33 Michael Kennedy: Yeah, okay, great, and it's also typically much, much cheaper.
11:36 Peter Kazarinoff: Yes!
11:38 Michael Kennedy: Than, say, a four year school, even a state four year school, but especially the other ones. So, folks who go here, maybe they're not academically ready for a four year school, maybe they are not entirely sure that that's for them, so they're going to take a less intensive route to find their way. The reason I'm bringing this up is it's sort of relevant to the conversation later around expensive proprietary software, and so on.
12:01 Peter Kazarinoff: Yeah, yeah, exactly, so at PCC right now, I think our credit costs $111 a credit, so that's kind of $1500 a quarter or so, and if you look at private four year colleges, they're at least $45,000 for a year now, so community colleges are much, much cheaper.
12:21 Michael Kennedy: It's like a 30X difference or something. Yeah, just for people listening, I actually went to a community college for my first couple years out of high school and just thought it was a fabulous experience. I went off to do well in other college afterwards. Right, so, it's definitely a nice place to be. I think it's got the right sort of low-key start. The other thing I guess that's interesting to me is that you were teaching engineering courses. When I knew about community college, it was like, you could take calculus and differential equations and chemistry and physics, but there was not a full-on engineering that was like, to prepare you for other engineering courses.
12:57 Peter Kazarinoff: These directly transfer to Portland State or to Oregon State. Some of the students go to the University of Washington, so you take engineering classes, but our students also take things like calculus and chemistry and physics, and those courses too.
13:11 Michael Kennedy: Sure, sounds fun. Kind of makes me wish I was back in college sort of. Those were fun times.
13:16 Peter Kazarinoff: I love it, like, this is honestly like my dream job. Every day, I walk in, I'm like, oh, I love this place! I love this place.
13:22 Michael Kennedy: That's awesome. How cool, all right, so let's talk about the computing software that you have for your classes, so you're teaching these engineering and engineering programming classes and programming labs and stuff. So traditionally, this is the realm of things like MATLAB and Mathematica, which are super expensive things, they only exist on the computer labs, at the school, because, like, no student is going to go, yeah, $1500 bucks for a license, that seems like a good idea. Oh, and then you got to buy all the other add-ons, right? Like, so, it's really, the use of these tools, while they're pretty good at solving engineering problems, really means, like, you're sort of stuck there, right?
14:05 Peter Kazarinoff: Yeah, yeah, so our college has taught MATLAB in this programming course for about four years, and it would cost students either $50 or $100 for the license, and then it also cost the college.
14:17 Michael Kennedy: It's like an academic license or something they can get.
14:19 Peter Kazarinoff: Yeah, yeah, they can get a student license, and it says, I think, E-D-U like at your command prompt in MATLAB just to let you know that you're still a student, and another problem with that is, after two years, your license would expire and some students stay a little bit longer than two years, and so they come to me before they go to four year and they're like, oh, Peter, I got to reinstall this new license, can you get me another license to MATLAB? It just felt like we were choosing certain students to succeed because there's not MATLAB installed in the Multicultural Center or MATLAB installed in the Veterans Resource Center. Like, it's just installed in these two computer labs and then our engineering lab, and for $50, that might not seem like a big deal if you're a big programmer and you've got, you know, this big job at Google or Facebook, but for some community college students where food security is an issue, $50, that can be a really, really big deal.
15:19 Michael Kennedy: That can definitely be a big deal. I remember the shock of just the price of books.
15:23 Peter Kazarinoff: Oh, yeah, and books! And books, in the course, were over $100. The book was awesome, it was really really good, but it was super expensive, and then after the course, what are you going to do with that textbook again?
15:37 Michael Kennedy: Try and sell it, you just try to sell it.
15:38 Peter Kazarinoff: Try to sell it, right.
15:40 Michael Kennedy: Yeah, it's the whole college books thing, but I'm just blown away how expensive those are, right? But, that's one possible path. The other path is maybe something that's really good at computation, that's kind of like MATLAB, that's free, and more accessible, right?
15:56 Peter Kazarinoff: Right, that's free, more accessible, so that's why we started investigating Python, because we were like, okay, we can do these arrays in MATLAB, but Python has NumPy. We can do numerical computing. MATLAB, we can build these plots in MATLAB, but Python, we have Matplotlib, or in MATLAB there's this serial module where you can talk to hardware. Oh, well, in Python, we've got pyserial, so, I sort of started investigating like each time I was doing something in MATLAB, like, can I do this in Python, and the answer was always yes. Sometimes, especially when we were doing HTTP requests, or trying to get data from like a web API for like tide data or something you're going to plot, it is just so much easier in Python to do that than it was in MATLAB. It just felt like we were having to do these back flips whenever we were trying to read anything that was external to the MATLAB ecosystem. We decided to make the jump to teach Python in the course, instead of teaching MATLAB.
17:01 Michael Kennedy: That's really cool, now, all those reasons made tons of sense to me, but I can just see, you know, the 59-year-old, almost retired engineering professor, going, you know, MATLAB's worked pretty well and I've got six years left, and I'm not a programmer. Right, as a department, we're not doing this. How did that go?
17:24 Peter Kazarinoff: There's still some open disagreement, I'd say, about it, and there are some benefits to MATLAB like the installation story is really clear, and there's only one IDE, like you use MATLAB and that's it and there's only one way to run the code, which is use MATLAB. Those are good arguments, but I don't know. Community colleges are about innovation, and doing quick iteration on courses. We can change the way that we teach courses so much faster than four year universities can, so I just felt like it was an opportunity for the community college to lead in this area, instead of just follow what other courses were doing. Now maybe down the line, when the students go in, they'll be like, yeah, we can do all of this in Python. Like, can I do my third year numerical methods class in Python, maybe it'll bleed over the other way.
18:15 Michael Kennedy: Yeah, I bet that it will, actually. I bet that you'll have these experiences where people learn Python here, and then they're like, you really want me to use that other thing? I know we could do so much better with X, Y, and Z package, right? It's probably going to plant some interesting seeds. There's some other things to consider I guess, like what were some of the things you did to decide on Python? Obviously you're personally a fan of Python, you know this pretty well, but there are some other academic examples, right?
18:45 Peter Kazarinoff: I wanted to make sure that it would not only be useful for students, but that, like, real engineers use Python, so the Large Hadron Collider, they use Python. The Allen Brain Science Institute, they use Python, or Instagram or YouTube, Facebook, like, they use Python. Real engineers are using Python and I actually just went and toured a company last week that makes pacemakers here in Portland, and that company uses Python, too.
19:17 Michael Kennedy: Oh, how interesting.
19:18 Peter Kazarinoff: There are real engineers out there using Python every day, so I think it is quite applicable. Plus not every single engineer is going to end up, and every student in engineering, doesn't always end up being an engineer, you know? They might be a teacher or they might end up working in a medical office, I don't know. Having a general purpose language like Python is a lot more useful than having MATLAB. If you work in a medical office, what are you going to do with that, I dunno.
19:45 Michael Kennedy: Exactly. I do think it's interesting to consider what you do outside of this discipline. If you have the skills to write something in Python, that in and of itself is a very marketable thing, you know what I mean? If you're like, man, I can crush it in LabVIEW, people are like, great, do you know Excel? Right, like, you know what I'm saying? It's not going to really translate, right, unless you're working in hardware or something like that, right, like if you want to move out, I think it's really interesting. This portion of Talk Python To Me is brought to you by Linode. Are you looking for hosting that's fast, simple, and incredibly affordable? Well, look past that bookstore and check out Linode at talkpython.fm/linode. That's L-I-N-O-D-E. Plans start at just $5 a month for a dedicated server with a gig of RAM. They have 10 data centers across the globe, so no matter where you are or where your users are, there's a data center for you. Whether you want to run a Python web app, host a private Git server, or just a file server, you'll get native SSDs on all the machines, a newly upgraded 200 gigabit network, 24/7 friendly support, even on holidays, and a seven day money back guarantee. Need a little help with your infrastructure? They even offer professional services to help you with architecture, migrations, and more. Do you want a dedicated server for free for the next four months? Just visit talkpython.fm/linode. Yeah, and of course, Paul Romer and his collaborated won the Nobel Prize in Economics using Jupyter Notebooks and stuff, which is pretty trick. So that's awesome, and then also, this is part of why I opened the conversation this way. It's like, when you think of how much that costs, right, maybe it doesn't cost an insane amount of money to run MATLAB, but when you look at trying to keep tuition as low a possible to make community colleges for the community, right, things like that, so the price of not paying for MATLAB is, it can't hurt, right?
21:37 Peter Kazarinoff: Yeah, and it can't hurt the college's bottom line either. They've got to pay for MATLAB, and then also then the textbooks for MATLAB, those are closed source, too. So if you can move to Python, an open source free language, you can move to an open education resources textbook, like a free textbook, and then the college doesn't have to pay for the MATLAB license, like we calculated, that's about $30,000 in one year of savings, just by moving to Python if we do that in the first year course, and then this engineering programming course, so it's little bits, but those little bits really do add up.
22:14 Michael Kennedy: They do, that's cool. Maybe you could almost offer another course, pay an instructor to offer a course that otherwise wouldn't be available, rather than send that over to MATLAB, right?
22:24 Peter Kazarinoff: Right, or how many students could you give scholarships for that, at a community college? That's a lot of students, right?
22:29 Michael Kennedy: That'd be actually excellent, yeah, that's great. Maybe talk about some of the road bumps, like what were some of the challenges?
22:34 Peter Kazarinoff: There were a lot of road bumps. So initially installation, that was a big road bump, 'cause we work at a big institution, so Portland Community College is actually the biggest college in Oregon. There are around 70,000 students, depending on how you count, so that's bigger than the U of O, University of Oregon, bigger than Oregon State, and so doing things like changing infrastructure, that's something that happens fairly slowly, and we wanted to make sure that we had Python installed when the quarter starts so that the students could use it, so that was one of the big roadblocks.
23:09 Michael Kennedy: Yeah, that's a huge challenge.
23:10 Peter Kazarinoff: When you're talking about those instructors, like who've been doing it for so many years and they only have a little bit to retire, that is a huge barrier. Telling the administration or the IT people you need to install this piece of software on every computer on campus. That can be a real non-starter at some places.
23:28 Michael Kennedy: Yeah, I can imagine. What kind of hardware and OSs do you use? Is it mostly Windows, do you have Mac machines? What do you got?
23:34 Peter Kazarinoff: We got all Windows machines.
23:38 Michael Kennedy: Windows 10?
23:38 Peter Kazarinoff: Yeah, Windows 10 at the college, and the student machines, students, I've done surveys, and students overwhelmingly use Windows. There might be one student that uses a Mac or there might be zero students who use a Mac.
23:53 Michael Kennedy: How interesting.
23:53 Peter Kazarinoff: In the class, yeah.
23:54 Michael Kennedy: I mean, you look at the price of a Mac versus a decent Windows laptop, though, it's like three to four times the price, right? So it makes sense.
24:01 Peter Kazarinoff: Right, yeah, and also, some students use either Chromebooks, 'cause they're even cheaper, or they use tablets, and so the installation story of Python on a Chromebook or Python on a tablet, that's not great right now either.
24:15 Michael Kennedy: Hey, I saw the Apple ad, it told me my iPad can replace my computer, I got this keyboard, let's go! It's like, whoa whoa whoa, you're an engineering student. What are you thinking, man?
24:24 Peter Kazarinoff: Right, right, right.
24:24 Michael Kennedy: Come on!
24:25 Peter Kazarinoff: I'll probably write a little blog post about it. I got Python going on my Chromebook, but it's not super easy, and if you're a student starting out learning programming, that's not going to be something that you can do.
24:36 Michael Kennedy: No, that's definitely a challenge, yeah.
24:38 Peter Kazarinoff: Yeah, and then the other challenge just was textbook. So, in the course with MATLAB, we had a textbook from a regular big textbook manufacturer and it had end of review problems, and it had example questions, and stuff like that. Everything an instructor would want in a textbook. And there're awesome, great Python books out there, but very few of them have homework questions at the end. That was something big that we were missing, and also we wanted to make sure that if we were moving to this free programming language, that the textbook would also be free, that we wouldn't offset the cost of the software by having a $300 book.
25:16 Michael Kennedy: Yeah, now Wiley's rich instead of MATLAB, whatever.
25:19 Peter Kazarinoff: Right, right, exactly. I would say like installation and then figuring out, textbook and then course content, those were kind of like the big roadblocks to adopting Python here at the community college.
25:30 Michael Kennedy: That makes a lot of sense. So, we're going to talk about JupyterHub which is the solution that you settled on, but just a few of the things that come to mind as I think about this is, there's coder.com, which is Visual Studio Code plus Docker container in your browser, so that would work on a tablet or a Chromebook. There's PythonAnywhere, which is pretty awesome, so there are a few solutions, right, but they're either brand new and didn't exist a year or two ago when you were doing this, or they're maybe not quite as comprehensive. I don't know if PythonAnywhere does any data science-y stuff, that's easy for you. I just have no awareness of that. So, maybe let's talk about JupyterHub before we move off the student story. I want to ask one more question, right. This is, I guess programming for engineering, but it sounds like a lot of them have to take this course. I suspect there's a little bit more of a challenge to write Python and run Python than there is to write MATLAB. I'm not 100% sure, I've done enough MATLAB that I felt like you could just start typing in the library, there's no import this, or import things that you had to use. It's a little more formal to do Python, so how was that received by the students? Were they yes! We get to learn a real programming language! Or was it, oh, are you kidding me? Now this is even harder.
26:44 Peter Kazarinoff: I guess I'd say it was the wealth of options was maybe the difficult thing for students, 'cause like you were saying, you could run Python on PythonAnywhere, there's also Repl.it, there's also Python Tutor, there's also Google Colab, there're all these different ways. One thing the intro students, I think, crave, is just tell me how to do it. You pick the tool, just tell me how to do it. What we decided on was to use JupyterHub in my class, and so that sort of settled that. You don't have to install Python and you don't have to go to any of these other sites and use their interface. We're just going to be using JupyterHub. That's what we decided on.
27:28 Michael Kennedy: Okay, yeah, that makes a lot of sense. It's basically Jupyter Notebooks hosted, it's a server for hosting Jupyter Notebooks on a central server. Did you get a super nice Linux machine? Lots of cores, so they can go do math on it, or?
27:44 Peter Kazarinoff: Well, sort of.
27:44 Michael Kennedy: Did it actually not need it? It's like, actually, my laptop is plugged in here.
27:49 Peter Kazarinoff: Right, right, so let's back up just a little bit. To make sure that everybody knows what a Jupyter Notebook is, Jupyter Notebook is a way to write and run Python code and it also contains things that are called markdown cells so you can also write text in them. They're this great way for writing, running Python code, and then explaining what the code does, which is super useful when you're teaching an engineering class to have both of those things available. Explain what the code does, and then write the code. These Jupyter Notebooks, they just run in web browsers, so I was thinking, when we were doing the course, well, if it can just run in a web browser, then maybe a student can just open up a web browser and run it, they won't need to install Python in their computer. So I was Googling around, and I found JupyterHub. It exists, Project Jupyter created this! This is exactly what I want!
28:44 Michael Kennedy: Yeah, that's cool.
28:46 Peter Kazarinoff: So, I installed it on a virtual machine on Digital Ocean and what I found was, the very first quarter that I did this, it was in a hybrid class, and that means some of the class is in person, some of the class is online. When they did the computing labs that were online, the students would log in at different times. Not everybody tries to log in at exactly the same time, when it's just totally online, and just a real small virtual machine, a $10 a month virtual machine, worked just fine for that. The first day that we went into the class, that was all in person, and everybody tried to log in at exactly the same time. That kind of crawled the server a little bit, and it took a little while. And so sort of what I'm realizing now is I either have to up the size of the server that I've got, or the JupyterHub documentation talks about using Kubernetes and deploying Docker containers instead of running it all on one individual server. But totally thanks to Talk Python, I used one of the credits from Digital Ocean, that's how I ran that first course.
29:55 Michael Kennedy: Wow, that's awesome, yeah, how cool.
29:56 Peter Kazarinoff: Yeah, so I was actually able to get a bigger server than the one that I currently have now, 'cause of that credit.
30:03 Michael Kennedy: Yeah, you know, it's just amazing what you can do with the computational resources in virtual machines these days. When I was getting my math degree at a four year college, the last year, we got this computing, shared computing server. It was like a used computer they had bought secondhand, from some other place, right? It was a Silicon Graphics big mainframe type of thing, and they paid a quarter million dollars for this used computer, and, you know, seven or eight people could log into it and do stuff. It was kind of okay, and then here you are, running all that on 10 bucks, it's really impressive. It's so cool. So, I think there's a lot of advantages to having these notebooks. I mean, certainly you have JupyterHub and run them there. They also, if you put them into GitHub, GitHub will execute them and actually render them live, and there's NBViewer and there's Binder. There's all sorts of stuff, right?
31:01 Peter Kazarinoff: Yeah, and Google Colab will now run them, too. There are just a lot a lot of ways that even without starting a virtual machine, that you can either view or interact with Jupyter Notebooks. It's a pretty amazing technology. Then one of the other things about it is, Jupyter stands for Julia, Python, and R, so you don't even have to run just Python in Jupyter Notebooks, like you could also run the R programming language, or you could run Julia, or there are a bunch of different back ends that you can plug into it, too. And then there are these extensions, too. I found this really neat extension that you could plug in and it allows you to do draw.io flowcharts, like right in the JupyterLab interface, so students can draw the flowcharts that describe their loops or their if statements, right there in the JupyterHub interface, which is pretty cool, too.
31:58 Michael Kennedy: That's really awesome. It sounds like this solved, that virtual machine you went and created, it sounds like that solves it for your instance of the class, but I can see as a college, as a department, going, okay, well, we can't always just call Peter the week before and have him use some credits to get a VM running. What's the longterm plan there?
32:20 Peter Kazarinoff: Well, so, one of the reasons that I set up JupyterHub was I was worried that the college wouldn't install the software before the quarter started, and it also gave the students a way to log on and run Python before the class even started. I think for some students, that's really nice, to just get their feet wet and be like, oh, this is what we're doing, and oh, this isn't too hard, and they can't come in and use the lab computers during winter break or whatever. So it did turn out that the Anaconda distribution of Python did get installed on the college computers. So now, at the college, I have the students open Jupyter Notebooks using either the Anaconda prompt or just using the Windows Start menu and opening a Jupyter Notebook that way. And at least for us in engineering, the Anaconda distribution is super helpful. It has Matplotlib, it has NumPy, it has Pandas, it's got pyserial, like, all the packages that you would want to install, all of those are already included, and doing pip install installations in virtual environments, if you've been doing it for a while, that sort of seems like, oh yeah, that's just easy, you're just creating a new virtual environment, but for a student, it's really kind of complicated and opaque, like, what is this, you know?
33:37 Michael Kennedy: Yeah, I just want to open a file and make it run. Like, why am I doing this, right?
33:40 Peter Kazarinoff: Right, and so using Anaconda, then the students don't have to install anything. Like, you import NumPy and NP and it just works.
33:48 Michael Kennedy: So, are they generally using their local computers these days?
33:51 Peter Kazarinoff: Generally, they're using in the classroom their local computers, but actually, just like logged on to the JupyterHub server, about half an hour ago, and there were a couple students that had logged on, so students are still using it.
34:05 Michael Kennedy: Yeah, that's pretty awesome. So earlier, you spoke about this challenge of the textbooks, and like I said, I remember the textbooks just being a huge expense that I didn't see coming, like I saw tuition coming. I didn't see $500 a semester in books, also. Like, jeez, where am I going to get that money from, as a kid, you know?
34:25 Peter Kazarinoff: Right, right.
34:26 Michael Kennedy: And there are, like you said, a bunch of great Python books that people can just sort of colloquially learn Python, like you read, it's interesting, right? But not in the formal school sense, right, like chapter three is going to have this test, and here are some example exercises like it. So you're working on a book for this, right?
34:46 Peter Kazarinoff: Along with making JupyterHub go so the students could see how to run Python before the quarter started, I also wrote this open source book, so that the students could read the book before the quarter started, too. I was kind of inspired, like Jake VanderPlas, he wrote the Python Data Science Handbook, and that was written in Jupyter Notebooks, and there are a couple of other books that were written in Jupyter Notebooks, and I was like, I don't want to both write the code and then I have to test all the code and then 3.7's going to come out, and then I have to retest all the code. Why not just write the whole thing in a Jupyter Notebook and then, the code that produces the plot, that's the plot that's, right there in the book. So, I wrote the book in Jupyter Notebooks and then students could view it in NBViewer or go onto Binder and run them themselves, and then I also used a package called MkDocs to build a web version of the book so that the students can just go to a website and see what their homework is and read through the material.
35:50 Michael Kennedy: Yeah, this is really nice, so problemsolvingwithpython.com, right?
35:53 Peter Kazarinoff: Yeah, that's the textbook website, and it just got published on Amazon, so if you want a hard copy, that'll cost a little bit of money, but all of the students can use the web version or look at all the notebooks for free. Some other authors have sort of adopted that same kind of idea that if you get the hard copy, you have to pay a little bit of money, but if you're going to use the PDF, or use the web version, that's free, and that's what I did for my book, too.
36:19 Michael Kennedy: Oh, yeah, it looks really interesting. I like that the exercises seem cool, the review questions seem cool. You have a Kindle version, which is maybe some weird intermediate thing where, you know, I really love the Kindle, 'cause you can take notes and highlights, like webpages are great, but it's super hard to use it as a reference, you know?
36:36 Peter Kazarinoff: Yeah, and it's sometimes nice to be able to read the Kindle in bed, or you're on the bus. It's nice to be able to have that version, too, but part of writing the book, big challenge was, how do you output to all of these different formats? You have to create a website version, you have to create the print version, you have to create a PDF, you have to create the Kindle version, and I don't want to write four different books all at the same time. So, Project Jupyter, they've got this NBConvert package and that'll allow you to export Jupyter Notebooks to various other file formats. Lucky if you know Python, than that can help you with some of this stuff, to be able to get the web version up and get a separate PDF made and get the separate Kindle version made. I'm just really really thankful for all the people at Project Jupyter and all the hard work that they did.
37:28 Michael Kennedy: That's awesome, so the source of the book is a series of Jupyter Notebooks?
37:33 Peter Kazarinoff: Yep.
37:33 Michael Kennedy: One or more?
37:34 Peter Kazarinoff: Many, many. So they're sort of like, one big directory and in there is a couple subdirectories for each chapter, and in each chapter, there are between, I dunno, six or 10 books, so there's a notebook for each section of the book. Then those all get put together to build the website. Another real benefit that I didn't realize until students started using it was that you can make edits on the fly, really really quickly. I can just pull the GitHub repo down and start editing one of the notebooks and then save it and push it back up and then the student's version is changed. Having a class of students is a great way to see where all your little typos, grammatical mistakes, what's confusing. It's probably like the awesomest editing system. I don't really mean to use the students as editors, but they've just been great, sending me suggestions to improve the book.
38:25 Michael Kennedy: Well, the normal iterative cycle on textbooks is years, right? It's not near live, so that's a pretty cool aspect. This portion of Talk Python To Me is brought to you by Stellares, the AI-powered talent agent for top tech talent. Hate your job, or feeling just kind of meh about it? Stellares will help you find a new job you'll actually be excited to go to. Stellares knows that a job is much more than just how it sounds in a job description, so they built their AI-powered talent agent to help you find that ideal job. Stellares does all the work and screening for you, scouting out the best companies and roles, and introducing you to opportunities outside your network that you wouldn't have otherwise found. Combining deep AI matching with human support, Stellares pares things down to a maximum of five opportunities that tightly match your goals, like compensation, work-life balance, working on products you're passionate about, and team chemistry. They then facilitate warm intros, and there's never any pressure, just opportunities to explore what's out there. To get started and find a job that's just right for you, visit talkpython.fm/stellares. That's talkpython.fm/S-T-E-L-L-A-R-E-S or just click the link in your show notes in your podcast player. Do you encourage them to use GitHub issues and PRs and things like that, or are you just saying, hey, send me a note that there's something wrong here?
39:52 Peter Kazarinoff: Yeah, so far with the students, I've just said, hey, send me a note, and if anyone wants to send me a PR, and absolutely if anybody wants to use the book in their class, please do so. So far in the course, we haven't gotten into Git and version control and how to do those sorts of things. I thought it was a little bit much to ask, and students, it's easy for them to send me an email so so far, that's how it is. But if anybody else reads the book and wants to make changes to it or wants to use one chapter, but not use the other chapters, they can definitely just go to the GitHub repo and pull it down and use what they need.
40:28 Michael Kennedy: Interesting, maybe add an appendix for something or other.
40:31 Peter Kazarinoff: Yeah, and I took this idea from Allen Downey. He's wrote a couple Python books, like the Think Python book. At the end of his book, he had this list of contributors so every time, I think, somebody sent him something, then he put it in the list, so I'll start listing anybody at the back of the book in the contributors if anybody sends me any edits.
40:49 Michael Kennedy: Yeah, okay, well, that's a great idea. Yeah, so people should check that out. It seems like a really nice resource, even, do you think it's good for students who just want to learn Python that have, they're not in your ENG 101 course?
41:02 Peter Kazarinoff: So if you're not an engineering major and you're not going to go on to a four year engineering degree I think it's still a really good intro resource 'cause it's designed for students who don't have any experience in programming. If you're into data science and you want to get into data science, the tools that engineers use are a lot like the tools that data scientists use. So in the book, there's a whole chapter on NumPy, there's a chapter on Matplotlib and building plots, pandas, and dataframes are used. Then some other packages like pyserial for communicating with hardware, also SymPy for doing symbolic math, for doing math with Python. That's also in the book, so if you're into data science, it could also be a good resource for you, I think.
41:48 Michael Kennedy: Yeah, I think it would be. When you first told me about it, I was thinking it's mostly a engineering book that has some Python in it, but it's mostly a programming book where the examples and the intended audience are engineers, right?
42:00 Peter Kazarinoff: Yeah, exactly.
42:02 Michael Kennedy: Yeah, that seems to me like that would be really useful. When I was in engineering, I took, like, one year in chemical engineering before I decided I didn't want to be in chemical engineering. They told me during this period, I said that I would love to take a programming course. Can I take a C++ course? They said, look, that can be an elective, but you first have to take Fortran. That's going to be the most important computer course you ever take in your life, and you got to study that, and then you're allowed to do an elective C++ course. Right, this was like, mid-90s or something, and I just, I would love to have a book like this, that covered a modern language, that wasn't already old in 1995.
42:45 Peter Kazarinoff: Yeah. Hopefully, hopefully whatever the students learn in my course right now, and then in another 20 years, hopefully that will still be useful. We'll be at Python, what, version 10 by that point, or something, right?
42:50 Michael Kennedy: Yeah, exactly. I've heard talk of Python 4, I have no idea what that's going to mean, but that's, we're working on the versions as a community, I believe. Oh, I guess it's worth asking, right? This is Python 3?
43:04 Peter Kazarinoff: This is Python 3.6, and I called the book the 3.6 edition, and I'm working on, for the spring, the 3.7 edition. Then I'll change my virtual environment that I run all the notebooks in, make sure it all runs with 3.7. The new fstrings, I think that that is a killer feature in Python, and so the book does use fstrings. It just makes inserting numbers and other strings into strings so, so much easier, so it's definitely Python 3 only.
43:33 Michael Kennedy: Perfect. It's time, right?
43:34 Peter Kazarinoff: Yeah, it's time.
43:37 Michael Kennedy: It's been time for a while, but it's really time now. I see you have a chapter on MicroPython, and also external hardware, that's pretty cool. What do you guys do with that?
43:45 Peter Kazarinoff: With external hardware, we connect the computers to little Arduinos, little microcontrollers. Students can control LEDs or they can read temperature sensors, things like that, and we used to use MATLAB to do that, and it was pretty cumbersome, but the pyserial package allows you to communicate with external hardware. So Python talks to these little Arduinos, these little microcontroller boards through the serial interface, using pyserial, and the students each quarter do these projects with these little microcontrollers. So for example, one student group made a project that opened a set of doors, that allowed this car to run down a track. Or another student group had a set of photo gates, and they measured how fast the car ran. Or another student group put a light sensor on this aquaponics fish tank grow system, and measured the amount of light that the plants were getting. It sort of ended up being that the students would have to learn two different programming languages. They'd have to use MATLAB, and then they'd have to learn the Arduino programming language, which is sort of like C, to do their projects. But Python has MicroPython, so you don't have to learn Arduino. You can run Python on the little microcontrollers. It's awesome, it's so amazing. This quarter, the students will use those little microcontrollers and run MicroPython on them, and then they can use most of the regular Python commands that they learned throughout the rest of the course.
45:19 Michael Kennedy: Yeah, that's really interesting, because going from MATLAB to C, that's a big step.
45:22 Peter Kazarinoff: Definitely, but hopefully going from Python to MicroPython, that won't be as huge of a jump. I'm also looking forward just to see the things that the students are going to be able to do with them. Like, they always come up with these awesome, awesome projects. One student group had a coffee cup and the temperature thermometer, and their idea was they were going to have it send you a text message when your coffee got cold. I'm just super excited to see what they turned out to be this quarter.
45:49 Michael Kennedy: That's cool, you got five minutes to finish your coffee before you won't like it anymore, go! Oh, how cool. I can certainly see this IoT device programming aspect of being an engineer, really being useful, right? Engineers build things, they have sensors. Understanding the control mechanisms seems great.
46:08 Peter Kazarinoff: Engineers solve problems in teams. That's what I always tell my students. They use computers to solve problems, not just to design computer stuff. So we try in the course to make them solve a real problem and MicroPython and those little teeny microcontrollers, you can solve real problems with programming. It's really neat.
46:29 Michael Kennedy: Yeah, real, in the physical world with atoms, not bits, right?
46:31 Peter Kazarinoff: Yeah, exactly, exactly.
46:34 Michael Kennedy: Yeah, cool. I guess one other follow-up thing I'd like to ask you about this whole JupyterHub and Jupyter Notebooks is, what tools or advice do you have for people who may want to use JupyterHub as their homework, student work area, right? Use things like NBGrader, or do you use, like, is there, what advice do you have for people, I guess?
46:56 Peter Kazarinoff: Well, so, if an instructor wants to do this, I guess one of the big pieces of advice is, you have to think about authentication early. How are the students going to log on? Because you could have them all get GitHub user names and passwords and do it that way. Our college uses Google apps like Gmail and stuff, so you could use like your Google logins, or you could create individual user names and passwords that you mail out to individual people. So thinking about authentication, I think, is one of the things early on that you should think about. And then another one is just data persistence, or like state persistence. When the JupyterHub starts, it creates these new servers, and there're different ways to run it. If you run it in a Docker container, it's possible that all of your work, once you close down your server, you close your web browser, all that goes away. So that's the way that Binder works, is that you can run these notebooks, but if you save homework number one, and you close it, and you come back later, it's gone.
48:01 Michael Kennedy: That'd be a little frustrating.
48:02 Peter Kazarinoff: Yeah, that would be totally frustrating, so you can't quite do a whole course in that, so you have to think about how are you going to allow data to persist on the server if users are creating it? Another little concern of mine was, all of the labs in the assignments are on GitHub, so how can I pull all of the labs and the assignments into the student's environment, so they don't have to go to GitHub and look at them? They're right there, in their Jupyter Notebook when they log in to JupyterHub, and there's this neat little extension called NBGitPuller, I think. This NBGitPuller extension, you click a link, and then it automatically pulls down a repo from GitHub and sticks it into one of the JupyterLab or JupyterHub instances. So that was a really neat package to find.
48:53 Michael Kennedy: Oh yeah, that is pretty cool. A one way Git Repository access, it's nice. Also, how did you deal with, did you set it up so students each have their own private set of things, but you could see them? Because obviously, if one student can see another, it's like, that takes copying homework to another level, right?
49:12 Peter Kazarinoff: Yeah, totally! There are different ways to set up JupyterHub. The way that this one is set up is that when a student logs in, they basically get a new user on a virtual private server on the Linux server, and so their user on that Linux server doesn't have access to really anything outside their own home folder. Each one of the students has a different Linux user. They have a different home folder, and so they can't really see anything outside of just their local user profile.
49:46 Michael Kennedy: Yeah, okay.
49:46 Peter Kazarinoff: And if a student is super, super clever, actually JupyterLab has command line available and they're able to hack into the server, send me an email and we'll talk about it, 'cause you're like, way, way above where a lot of students are, if you're able to do that, and maybe it's okay if you're copying somebody's homework, if you can figure out how to hack the server.
50:08 Michael Kennedy: Interesting, all right, yeah, but it sounds like you could use Linux permissions and roles and whatnot to make it work.
50:13 Peter Kazarinoff: Yeah, yeah, that's one way to do it. Then doing the Docker containers and Kubernetes, that's like another way to do it.
50:19 Michael Kennedy: That's pretty cool. It sounds like a fun project.
50:22 Peter Kazarinoff: Yeah, it's super awesome. I built a set of documentation because as I was building the JupyterHub server, I wanted to make sure I can do this again the next quarter, so I have a little website built with MkDocs that shows every step that I went through in order to build my JupyterHub deployment. If anybody wants to build their own JupyterHub server, they can definitely take a look at that online and see if they can build their own. It's actually, it's not too hard. You need to do a little bit of Linux stuff, and you've got to start the virtual private server, but, like, you can do it. If you're teaching engineering programming at college, you can launch JupyterHub, you can do it.
51:01 Michael Kennedy: Yeah, that's certainly true. Cool, yeah, that probably about rounds it out for our main conversation. You were trying to turn the tables on me here. I see you threw out some stuff that said you want to ask me a couple of questions, so, I don't know if I have good answers, but I'm game, go ahead.
51:17 Peter Kazarinoff: All right, so one of my big questions is, I'm just so grateful to everybody at Project Jupyter and Min Ragan-Kelley and Carol Willing, and everybody who works even at NumFOCUS to help build NumPy and pandas and all of the tools that we use. What is a great way to thank people that build some of these open source tools? I'm not at the level where I can directly contribute to the NumPy source code. What is a good way to thank people and say thank you for what you do?
51:50 Michael Kennedy: Obvious way might be to add a new feature or something, right, but that's a different level, maybe. I think starting just by saying thank you, actually is really valuable. So much of the open source stuff, I think, is thankless. People, they'll get angry 'cause some feature doesn't work and they'll go rail against the maintainers. Just having a counterbalance, like all these people are appreciated. Maybe sharing your story, which obviously you're doing, you know, here, right, but in, as a more general comment, like, your work has really enabled me to teach, make Python and engineering more accessible to more folks. Hearing that, I think, is a lot. If you're in an organization that can somehow contribute back to it, I mean, I realize that a lot of people aren't, but if you worked, say, at a big company, maybe your company could somehow sponsor that project to help make it not purely volunteer, but help make that a job. One of my pet peeves is, there are many many billion, billion dollar companies, built upon things like pandas, Django, Flask, SQLAlchemy, and if those companies just sent back, you know, .01% of their profit even, not just revenue, profit, just to say, look, we probably should maybe support the thing that is the foundation of our business, a little bit. That would just, there's like a handful of people, I probably could count them on my hand, literally, that maintain Flask, right? How much do these giant companies need to contribute to actually just make those people's lives great, to just sit around and contribute to Flask, right? So I feel like, if that's something that people could do, that would be amazing, but I think just saying thank you, maybe contribute a tutorial, maybe contribute a case study, or it doesn't have to be a new feature, right? It could be even documentation, or hey, let me, I see your docs are on Python 2 for your tutorials, can I upgrade that to Python 3? 'Cause I know that's, just like little, because that's the last thing that folks that are trying to write the software want to do, is rewrite their tutorials.
53:59 Peter Kazarinoff: You up for a couple more tough ones?
54:02 Michael Kennedy: Yeah, hit me.
54:02 Peter Kazarinoff: All right, all right. So, this is like a secret question, but I hear it from students a lot. Are you still afraid that some of the software you build is going to break, and does that feeling ever go away? That you're not thinking in the back of the head, oh my god, what I just built, it's going to crash!
54:21 Michael Kennedy: Yeah, that's a great question. I certainly have little scripts and apps and utilities that are super sketchy, 'cause they're, like, I needed them once or twice to do a little thing. Those will probably break, because they're not very well put together, 'cause they were just quick one-offs, but at the same time, I'm not afraid, because, like, they're not really important. I could just, if I need them again, I can kind of fix it. But things that do make me nervous are, like, the training website that people paid tons of money for, so that they can take their classes. Maybe they've got a project next week, and it takes a long time to feel like it's not going to break anymore, but I feel like it's not going to break. Right, not in any super significant way, but it takes years. So, let me just put it to you this way. If I go on vacation, for example, I went skiing two weeks ago, up on Mount Hood. Went and stayed up there in Timberline for a couple of days and I was thinking, I really don't want to take my computer, 'cause I'm going to have to leave it in the car in sub-zero weather, and it might hurt the battery. But what if the website goes down? Maybe I'll bring my computer just in case, and I'm, you know, and still, and I would say that's one of, so I decided no, it's been fine for the last six months. I'm not going to touch it before I leave. It'll probably be fine. Worst case, I'll buy an SSH client on my iPad and try to get in there and fix it that way. There's always a little bit of an uneasiness, because you just, you never know, right? Like it could be things out of control, like maybe something happens in the data center, or you just don't know, but generally, it does go away, but it takes a long time on any given project, I think, before it feels okay.
56:05 Peter Kazarinoff: Yeah, I just think this being afraid that your thing will break, it's not something that programmers talk a whole lot about, but it's something that I do hear from students, and that I feel myself, so just want to make sure that actually a lot of other people sometimes felt that way, too and that it was normal.
56:21 Michael Kennedy: Yeah, I'll share one more story with you, the very first website that I wrote that did eCommerce, was for a pretty expensive product for quite a bit of students. It's for the training thing, it was not mine, like my own thing, this was for a company I worked for. And they would come and buy like $4000 things, and I remember writing that, and just being super nervous about shipping the software. People are going to go put their credit card in here, we're going to charge them $4000, what if I messed it up? Like, what if this is supposed to be dollars and it's cents or it's supposed to be cents and I put in dollars? Like, just the consequence of failure was really high. What if I end up charging somebody $40,000? Those things are super nerve-wracking, but the more you go through them, right, the second or third or fourth time, you go, ah, okay, I'll just be careful, but this is how it goes. So yeah, it doesn't ever go away all the way, but yeah, it gets a lot better.
57:18 Peter Kazarinoff: So my final question is, what's the hardest problem that you ever worked on, that just had a super simple solution? You're banging on your head for like two weeks, and then you were like, oh, it's just this.
57:29 Michael Kennedy: Yeah, there's been a couple of those. I would say there's certainly some around APIs and you're like, ah man, I just can't get this working. I go, why don't I just, the order is like this. But I do have an engineering-related one for you that that's probably like this. I was working on this project with one other developer, and we were, this is actually coming from MATLAB code into C++, C#, something like that. This was before Python, and it was doing realtime wavelet decomposition of, like, a time series, and the times, it was something that you have all this data, about 250 measurements per second, so you have four milliseconds to process a measurement, right, like, per measurement. You don't have much time. And we take all this MATLAB code and we convert, like, thousands of lines of wavelet decomposition code and stuff, and just looking at this, going, I sure hope this works, 'cause I can barely understand what I'm doing here, right? But it also has to be fast enough. It has to be realtime so it can't take more than four milliseconds per bit, or if you cue it up, like times the number of things. And so, we get to it and we run it, and it's not fast enough, like oh my god. We're going to have to optimize that wavelet code because I cannot change that. Like, I got it working, but really I don't understand more. And it turned out, I turned a profiler against it, and it was using a list, instead of a dictionary to hold a bunch of stuff it had to do, like look up based on some cases, sort of like what would be better by key rather than by position, right? And we just switched the data structure from a list to a dictionary, and it got, like, 10 times faster. So, it fell under four milliseconds, it was done. Problem solved, right? But like, it was, this program is too slow. What is it doing? Oh, it's just doing index of type operations, on the list. That's 80% of the CPU usage is list lookup. Switch it to dictionary and that 80% goes away, boom, fast. That's it, I guess.
59:30 Peter Kazarinoff: For me, it just seems to have come down to, go to PyPI. I was trying to surf these webpages, and then it was like, oh, just use Beautiful Soup, or like, oh, was trying to get a website, oh, just use requests, so now that's kind of the first thing that I do, is go to PyPI.
59:44 Michael Kennedy: Yeah, I remember that being a big problem if you either come from a language that doesn't have a rich standard library like C++ or something, or C, or you just don't know, you have no awareness, you're like, I got to do this thing, so how am I going to implement it? Like, that should not be your first thought. Your first thought should be, can I pip install an answer here, right? Can I pip install a solution, for sure, for sure. Nice, all right, thanks for the turnaround on the questions there, that was fun. Before we call it a day, though, I got to ask you the two questions, as always. If you're going to write some Python code, what editor do you use?
01:00:15 Peter Kazarinoff: Well, I like this question, 'cause students often want to know which editor to use, too, so I've got kind of a multi-pronged answer. If I'm writing a one file thing, I'll use a Jupyter Notebook or JupyterLab, and if I'm writing a multi-file thing, often I use Visual Studio Code, and if I've got something really big, like a Django site or like Flask, then I use PyCharm.
01:00:40 Michael Kennedy: All right, those all sound like good answers to me. I agree, right on. And then, notable PyPI package?
01:00:45 Peter Kazarinoff: So I've got kind of a niche one, but a package I've been using is called SchemDraw and the schem stands for schematic. It's a package that draws circuit diagrams, like puts resistors and capacitors and stuff and circuit diagrams. I've used that package to make test questions, and there's some figures in the book that I used it with, so if you've got to draw some circuit diagrams, check out SchemDraw.
01:01:09 Michael Kennedy: That's pretty awesome. All right, well, definitely enjoyed talking to you about this, Peter, it was really fun, and I'm glad you found your way from MATLAB to Python and JupyterHub.
01:01:20 Peter Kazarinoff: It was awesome talking to you, Michael, thank you so much for having me!
01:01:22 Michael Kennedy: Yeah, you bet, so, final call to action, people are excited about this. Maybe they want to use your book or contribute, or they want to try to set up a similar thing in their environment, and what do they do?
01:01:33 Peter Kazarinoff: So my final call to action would be if you want to take a class, think about community colleges. They have programming classes, too. If you're an instructor, please use my book or send me a PR if you want any changes, and if you're teaching MATLAB, Python can do everything, so if you're afraid, set up a JupyterHub server, and you can start next quarter.
01:01:52 Michael Kennedy: That's awesome. All right, thank you so much for sharing your story. It was a lot of fun. This has been another episode of Talk Python To Me. Our guest on this episode was Peter Kazarinoff, and it's been brought to you by Linode and Stellares. Linode is your go-to hosting for whatever you're building with Python. Get four months free at talkpython.fm/linode. That's L-I-N-O-D-E. Find the right job for you with Stellares, the AI-powered talent agent for the top tech talent. Visit talkpython.fm/stellares to get started. That's talkpython.fm/S-T-E-L-L-A-R-E-S, Stellares. Want to level up your Python? If you're just getting started, try my Python Jumpstart by Building 10 Apps course, or, if you're looking for something more advanced, check out our new async course that digs into all the different types of async programming you can do in Python. And of course, if you're interested in more than one of these, be sure to check out our everything bundle. It's like a subscription that never expires. Be sure to subscribe to the show. Open your favorite pod catcher and search for Python. We should be right at the top. You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm. This is your host, Michael Kennedy. Thanks so much for listening, I really appreciate it. Now get out there and write some Python code.