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