Learn Python with Talk Python's 270 hours of courses

Interactive Python and Teaching Python: Beyond Text Books

Episode #20, published Tue, Aug 11, 2015, recorded Tue, Jul 7, 2015

Guests and sponsors
What if your computer science textbooks could run their python code samples and that code ran directly in your browser, kinda like JavaScript but better, because: Python. It is possible and Brad Miller is making it happen!

This episode is all about Brad Miller's work at Runestone Interactive where they are building the next generation of interactive textbooks for computer science students and the rest of us. As a cool side-effect, Brad is now maintaining Skulpt, one of the leading implementations of Python that runs in your browser!

Links from the show:

Interactive Python: interactivepython.org
Brad Miller: luther.edu/millbr02
Skulpt: skulpt.org
Interactive books: interactivepython.org/runestone/static/thinkcspy/index.html
Runestone at Github: github.com/RunestoneInteractive
Runestone: runestoneinteractive.org
PythonTutor (Topic of show #22): pythontutor.com
Trinket.io: trinket.io
Birth and death of JavaScript (video): destroyallsoftware.com/talks/the-birth-and-death-of-javascript

Episode Transcript

Collapse transcript

00:00 What if your computer science textbooks could run their Python code samples,

00:03 and that code ran directly in your browser?

00:06 Kind of like JavaScript, but better because Python.

00:09 It is possible, and Brad Miller is making it happen.

00:13 This is Talk Python to Me, episode number 20, recorded Tuesday, July 7th, 2015.

00:20 Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.

00:52 This is your host, Michael Kennedy.

00:54 Follow me on Twitter, where I'm @mkennedy, and keep up with the show and listen to past episodes at talkpythontome.com,

01:01 and follow the show on Twitter via at Talk Python.

01:04 This episode will be talking to Dr. Brad Miller about interactive Python,

01:10 Python in higher education, and Sculpt, the Python that you run in your browser.

01:16 I'm happy to tell you that this episode is brought to you by Hired and Codeship.

01:20 Thank them for supporting the show on Twitter via at Hired underscore HQ and at Codeship.

01:26 Now let's get right to the show.

01:28 Brad Miller is an associate professor of computer science at Luther College.

01:32 He's the founder of RuneStone Interactive.

01:35 He loves to travel, hack, bike, and cook, but not necessarily in that order.

01:39 Brad, welcome to the show.

01:42 Thanks. It's a great pleasure to be here.

01:44 Yeah. You guys are doing some really awesome stuff over at RuneStone, and online platforms for people learning and teaching Python,

01:52 and that's what we're going to talk about today.

01:54 But before we get to online Python and Python in the browser and a bunch of other cool stuff,

01:59 what's your story? How did you get here?

02:00 So, well, we can go all the way back to 1979, when I first got into programming, I suppose.

02:07 That was when our high school got the first Apple IIs installed, and I discovered AppleSoft Basic,

02:15 and I discovered that I could win a lot more often if I hacked the lemonade stand game

02:21 and made it rain on Player 2 a higher percentage of the time than Player 1.

02:25 So that was kind of my introduction to programming, was digging into Basic code.

02:33 That's really awesome.

02:34 I mean, that's what a lot of programming is, is you're like, I don't want to just use this tool.

02:38 I want to make a better tool or change it or whatever, right?

02:41 And that's really cool.

02:42 It doesn't say much about my ethics in those days, but...

02:46 That was lemonade.

02:47 It was, yeah.

02:48 Better than Oregon Trail, which was the other popular game back in those days.

02:55 Yeah, indeed.

02:56 So, yeah.

02:57 So that's how you got started and sort of interested in computers.

03:01 How did you get into programming?

03:02 So I started out as a computer science major at Luther when I went to undergrad

03:10 and learned, you know, that was back in the days when people learned Pascal.

03:16 And then I started my career at a, you know, big iron mainframe manufacturer called Control Data

03:23 and worked on energy management systems for Control Data.

03:28 Yeah.

03:28 Wow.

03:29 What kind of language?

03:29 Yeah.

03:31 Fortran.

03:31 So...

03:32 Oh, yeah.

03:33 I was told when I was in college and starting out that Fortran was the most important language

03:38 I was ever going to learn in my career.

03:40 Yeah.

03:40 And I pleaded to take C++.

03:41 I said, after Fortran.

03:42 All right, fine.

03:43 I just missed the punch card days.

03:45 So I guess Fortran is as bad as I get.

03:49 Yeah.

03:50 Cool.

03:50 Yeah.

03:51 And I had a great internship with Amoco Research where I got to work in their AI lab.

03:57 So that got me interested in Lisp and interpreted languages.

04:00 And, yeah.

04:03 Then in grad school, I started hacking in Perl a lot.

04:06 And then C++ and Java.

04:10 And then I made a career change in 2003 where I became a college professor.

04:15 Oh, wow.

04:16 I left a successful startup company and came back to teach at my alma mater.

04:21 And I taught Java in the introductory CS class for a year.

04:27 And I realized that it was just the worst possible language for teaching people that had never

04:32 programmed before how to program.

04:34 And so we looked around and there was this language called Python, which was still, you

04:39 know, I know it's not new, but it was really very, very new in the educational field back

04:44 in 2003.

04:45 In fact, there was only one textbook available.

04:48 But we decided that we were going to go ahead and adopt Python as our introductory language for

04:53 teaching in computer science, which immediately led to myself and my colleague, David Random,

05:00 writing a data structures textbook because we wanted to be able to teach Python in both CS1 and CS2.

05:06 Yeah.

05:06 Of course, if the book isn't there, maybe you have to go back to Java and you don't want to do that.

05:11 No.

05:11 Yeah.

05:12 So that was definitely, you know, okay, we can use this one textbook that's there, but we're

05:15 going to write the other one.

05:17 And so that worked out really well.

05:19 Yeah, that is really cool.

05:20 You know, one of the things I think is really a success story for Python is it's become the

05:26 most popular sort of introductory computer science language, at least at U.S. universities.

05:31 But I think that's pretty global.

05:32 Yeah.

05:33 Yeah.

05:34 Can you compare what it's like to teach Java, what it's like to teach Python, the way the

05:39 students received it, whether like better grades, more excitement, less dropout, those kinds

05:44 of things?

05:45 I mean, certainly less dropout with Python.

05:48 And I think it's much, much quicker for them to kind of get up and running and be able to

05:56 do interesting stuff.

05:57 You know, when you teach Java, I like to say there's like 12 things that you have to lie

06:02 to them about on day one.

06:04 Starting with, you know, public static void main, string, args, you know, there's like

06:11 none of that.

06:12 Do you want to try to talk about to introductory students on the first day of Java class?

06:18 So whereas with Python, you can, I guess, say print hello world, and at least you get something.

06:23 But it's also just as easy to say import turtle, make a turtle and make the turtle go forward

06:29 by a hundred.

06:30 And that gives them that kind of, there's that immediate gratification of being able to see

06:35 something visual on the screen and, you know, be able to control this stuff just by typing.

06:42 So, so that, that was a huge, huge change, just sort of in student mentality to be able

06:47 to kind of get into something where they could get that immediate gratification.

06:51 Yeah, that's really cool.

06:52 The show I just released this week with Lynn Root, she talks about how she was studying

06:57 C++ to make a switch, basically to get some foundation to move on to like a PhD program

07:04 in finance.

07:04 And they had to do programming.

07:06 So she took a C++ class and it just about crushed her will to do anything with programming.

07:11 And she came in and learned Python and it just like, she lit up and that's, that's still

07:15 what she's doing today.

07:15 It's great.

07:16 Oh yeah.

07:17 I mean, and there's so many great, you know, packages out there for Python that you can really

07:22 get students, you know, working with interesting stuff right away.

07:25 Yeah, that's for sure.

07:26 I just found today a project, a GitHub project repository, I guess you would call it, called

07:33 Awesome Python.

07:34 So I think it's, if you just search for Awesome-Python GitHub, and it's a, like a curated list of all

07:41 the amazing packages that people like really love.

07:43 So.

07:43 Oh, that's really cool.

07:44 I'll have to go look at, look at that.

07:46 Absolutely.

07:47 So, so that's really cool.

07:49 So you're doing, are you still teaching at the university?

07:51 I am.

07:52 Yes.

07:52 Uh huh.

07:53 And you're doing this thing with RuneStone Interactive.

07:55 Why don't you tell everyone what that is?

07:56 Yeah.

07:57 So RuneStone Interactive is, is kind of three, three components, I'll say.

08:03 First of all, it's a set of tools for authors that want to create interactive course materials.

08:09 So anything from lecture notes to a lab to a full-blown book, like what we've doing.

08:14 so that, that includes, I like to, I like to say that kind of the big, hairy, audacious

08:23 goal is that we would like to be the LaTeX of interactive writing.

08:28 so we've got all these tools that we're trying to build to make it easy for, for instructors

08:33 and other people to write interactive, interactive materials.

08:37 So things like interactive code, visualizing code, including video, including little

08:43 assessments like fill in the blanks or multiple choice or short answer.

08:46 you know, things so you can hide things and show things.

08:50 And, so those kind of, all those kinds of things that you'd want to have in an interactive

08:54 textbook, whether it's, whether it's for computer science.

08:57 Or, or some other topic.

08:59 In fact.

08:59 Yeah, absolutely.

09:00 So it's kind of like taking the traditional textbook, but making it something that is more

09:07 native to the real world.

09:09 Right.

09:09 If I'm learning about computer science, I should be able to run the code.

09:12 I should be able to see visualizations.

09:13 I should be able to listen and all that kind of stuff is part of what you guys have there.

09:17 Right.

09:18 Yeah, exactly.

09:18 I mean, so this sort of started out on my sabbatical in 2011, where I was supposed to

09:24 be working on, new additions for the two textbooks that I've, that I've written that

09:29 are paper-based textbooks.

09:30 But as I was trying to write these updates to the paper textbooks, I kept thinking, God,

09:36 this would be so much cooler if, if it was actually doing something interactive on the screen.

09:41 And so I stopped working on the, on the, on the stuff for the paper books.

09:47 And I started, and I started experimenting with how we could make all this stuff interactive.

09:51 and then I realized nobody in their right mind would ever write a textbook where you had

09:57 to go in and, and use JavaScript to hard code every code example you wanted.

10:01 So then I, then I started to think, okay, how could I, how could I write some macros that

10:06 would make this, make this easy?

10:07 And so that kind of led to that first part of the, of the authoring tools.

10:11 So that's sort of part one.

10:15 Part two is that then there's this sort of set of backend services that you have to run.

10:21 Things like when students run code, or write code, you want to be able to save what

10:26 they've written so that the next time they come to the website, they don't have to start

10:29 over and, and reenter all their code again.

10:32 and if you're going to use it for a class, you'd like to have it, let's say, save the answers

10:37 to the multiple choice questions or give the instructor a grading interface so that they

10:41 can go in and grade and keep track of how the students did.

10:44 so that's sort of the set of interactive, interactive services that support the book on

10:50 the front end.

10:51 That's really cool.

10:52 Do you guys, sorry, do you actually use the interactivity bit for like assessments and tests

10:57 and things in your classes?

10:59 Yeah.

11:00 Yep.

11:00 Yep.

11:01 Yep.

11:01 Not like for, it's great for daily assignments, for example, what I can do is say, all right,

11:06 I want you to read this section.

11:07 And at the end of the section, there might be a little coding thing, or there might be three

11:11 or four multiple choice or fill in the blank kind of questions.

11:14 And then every day before class, I can go in and go to the instructor's dashboard.

11:18 I can look at the responses to all those questions and get a sense for, all right, what were the

11:24 things that they understood about this section?

11:25 What were the things that they'd struggled with?

11:28 what were some of the common mistakes that they made?

11:30 And then, you know, that pretty much informs what I'm going to talk about at least, you know,

11:35 at the start of every class is to, to think about.

11:39 That's really powerful.

11:40 You don't really typically get that experience with a textbook.

11:43 No.

11:44 Because you never know, right?

11:46 I mean, all of us suspect that our students don't really read the assignments that we give

11:51 them.

11:51 But now we, now we actually know.

11:53 Yeah.

11:54 Because we can, because we can track them online.

11:56 So.

11:57 That's really excellent.

11:58 All right.

11:59 So what's part three?

12:00 Part three then became this hosting service.

12:02 So in the beginning, what, what I thought was all great.

12:05 We'll make all this open source.

12:07 And if somebody else wants to use this, for their class, they can just go to GitHub.

12:11 They can clone this.

12:12 They can set up a server.

12:14 They can build the books.

12:15 They can run it on their own server.

12:16 And then what I learned is that most people really don't want to do that.

12:20 Um.

12:20 So most people just have enough problems, you know, teaching their own class.

12:26 so, so we created this hosting service where you can go in and you can say, all right,

12:32 yeah, I want to use textbook a textbook, B textbook, C.

12:35 And what it does is it just makes a kind of a custom copy of that textbook and sets up an

12:40 instructor dashboard for that custom copy so that an instructor can have their students

12:45 registered for their course.

12:46 And all of their stuff is separate from all the other people in the world.

12:50 And the instructor can then just look at the dashboard for their own course.

12:54 and they don't have to do anything except go in and click a few buttons to build, to build

12:58 their book.

12:59 That's really cool.

13:00 Do you mind talking about the business model just a little bit?

13:02 Like, is this totally free?

13:03 Is there like a fee?

13:04 Do you sell the books to the students or what's the story around that?

13:07 Yeah.

13:08 I, so we, we really right now are just based on donations, which doesn't work all that

13:15 well.

13:15 Is there a chance of like NSF, National Science Foundation support or like STEM research support

13:21 or any of those?

13:22 I think so.

13:23 I mean, right now I do have, I do have an NSF grant for the next three summers.

13:27 So I've got two, I've got two undergrad students that I'm, that I'm working with this summer

13:32 on making a bunch of enhancements to, to, to the way that we're, the way that we're

13:37 doing these extensions or these kind of macros that I talked about before.

13:41 Right.

13:42 That's really cool.

13:42 So, yeah.

13:43 So, but yeah, I don't get any support from them for, you know, paying for hosting fees

13:48 or anything like that.

13:49 Sure.

13:49 So people who want to use it out there, keep that in mind, maybe a donation.

13:52 You know, one of the universities that uses it is Duke University and they, they're really

13:59 good.

13:59 Every, you know, they've got 400 students in their introductory course.

14:02 And so I know the instructors there, you know, we've, we've known each other for a while

14:06 through conferences and whatnot.

14:08 And I know they always go the first couple of days and say, look, we're using this textbook.

14:12 It's free instead of the $145 you'd probably pay at the bookstore.

14:16 The least you can do is go make a $5 donation.

14:19 And, you know, we get about 20 out of 400 that feel moved to make a, there's a, there's

14:25 a five, 5% appreciation ratio.

14:29 Very cool.

14:32 So, but anyway, yeah, yeah, no, that's good.

14:34 So, yeah, keep going with that.

14:37 So you want to talk a little bit about some of the underlying tools that you're using, the

14:41 underlying packages and technology.

14:43 It's mostly Fortran on the backend.

14:45 Is that correct?

14:46 no, it's mostly Python.

14:47 Oh, just teasing.

14:48 Yeah.

14:49 Cool.

14:50 So tell us what you're doing there.

14:51 Maybe before we do this, actually.

14:52 So I went and I watched your video on interactive Python dot, is it org or com?

14:57 Dot org.

14:58 Dot org.

14:59 Interactive Python dot org.

15:00 Thank you.

15:01 And you've got a nice video that shows you a lot of, a lot of the really cool stuff you

15:06 can do.

15:06 Maybe you could just hit some of the high points so people know what we're talking about.

15:09 Yeah.

15:10 So I think the, the, the real aha moment for me was, was when I found this project called

15:18 sculpt.

15:20 This episode is brought to you by hired hired is a two sided curated marketplace that connects

15:35 the world's knowledge workers to the best opportunities.

15:38 Each offer you receive has salary and equity presented right up front and you can view the

15:44 offers to accept or reject them before you even talk to the company.

15:47 Typically candidates receive five or more offers in just the first week.

15:52 And there are no obligations ever.

15:54 Sounds pretty awesome.

15:55 Doesn't it?

15:56 Well, did I mention there's a signing bonus?

15:58 Everyone who accepts a job from hired gets a $2,000 signing bonus.

16:02 And as talk Python listeners, it gets way sweeter.

16:07 Use the link hired.com slash talk Python to me and hired will double the signing bonus

16:13 to $4,000 opportunities, knocking visit hired.com slash talk Python to me and answer the call.

16:19 And so sculpt was started by Scott Graham, who now works for Google.

16:35 And it was an implementation of CPython in JavaScript.

16:39 So this was back in 2010, 2011 that he had worked on that.

16:44 And I thought, oh my gosh, this is so cool.

16:46 You know, we can run Python right in the browser.

16:49 There's none of this.

16:50 Let's submit it, run it back somewhere on a server and then have the result come back to

16:55 the browser.

16:55 With all the security issues.

16:57 Yeah, exactly.

16:58 That come with that.

16:59 Yeah.

16:59 Right.

16:59 So this is running right in the browser.

17:02 And not only that, but because it was written to run right in the browser.

17:06 When I saw that, I got really excited about it.

17:08 The first thing that I did was I figured out how to add the turtle graphics module to it.

17:13 So now you can, you know, you can write your Python program and you can, you can do turtle

17:17 graphics right in the browser.

17:19 So you get that kind of instantaneous gratification of seeing something.

17:22 Yeah, that's awesome.

17:24 And it pops up right in a, like a little section or div or something of, of the HTML page.

17:29 And it's just, you know, animated, just like the regular real turtle.

17:32 Yep.

17:33 Exactly.

17:33 Is that using that HTML5 canvas?

17:35 It is.

17:36 Yep.

17:37 So this is all totally HTML5 based.

17:40 Yeah.

17:40 Excellent.

17:41 Okay.

17:41 Yep.

17:42 And then, so that's, so that's one thing.

17:45 And then the second thing is, is this, what we call code lens in the textbook, but

17:49 is really based on, on the work by Philip Guo on, online Python tutor.

17:54 And, you know, if you've, if you've ever taught Python or if you've ever really thought about

17:59 Python very deeply in terms of things like, well, variables, for example, is a big thing,

18:05 right?

18:05 Variables are just names for things in Python, right?

18:09 So we're always drawing these pictures on the board of, of here's a name.

18:13 And what does that name reference, you know, is it referencing a list or a dictionary or

18:17 some object that you've created?

18:18 Right.

18:19 And, and there's, there's all these reference diagrams that just clutter up the whiteboard.

18:23 Yeah.

18:24 I envision something on the stack with an arrow drawn to something on the heap with a pointer

18:27 over to somewhere and something like that.

18:29 Right.

18:29 Yeah, exactly.

18:30 Yep.

18:30 Cause you're trying to help students get a mental model for how the state of the program changes

18:36 as you step from line to line and just to really understand kind of what goes on inside,

18:41 inside the Python interpreter.

18:43 And so what Philip had done is he, he'd automated that with this online Python tutor.

18:48 And so we worked with Philip and took that and made it so that we could have these canned

18:52 examples and, and, and embed them right in the textbook.

18:56 So another way of thinking about it, if you've never seen it is it's kind of like having

19:01 a debugger, that where you can, you know, go into step mode in the debugger, only this

19:06 is even better because not only can you go forward, but you can go backward.

19:09 Yes.

19:10 And that was really impressive to me from a learning perspective.

19:13 You know, if you, obviously it's helpful when you're new to step through the debugger

19:19 and actually see how the program is working.

19:22 Right.

19:22 We, we get used to the fact that it's just innate to us how text becomes execution.

19:27 But when you're new, you know, my kids have looked at what I'm doing and they're like,

19:31 those words, is that really what that website is?

19:33 Yeah.

19:34 I mean, like how is, how does this become a game or whatever?

19:37 Right.

19:37 Yes.

19:38 And so just seeing that happen, I think it's really cool.

19:40 And the fact that you can go forwards and backwards is great.

19:43 Yeah.

19:44 And then, and then we enhance that even beyond what Philip has on the site in that, for

19:50 some of the examples, what we can do is we can step through and you get to an if statement

19:53 and we'll break into the execution and pop up a dialogue box and say, all right, after we

19:59 evaluate the condition on this if statement, what's the next line that's going to execute.

20:03 And so it'll, it'll make the student really think about, okay, how does this if statement work and what's, you know, if it's true, what's going to happen?

20:12 If it's false, what's going to happen?

20:13 Right.

20:13 So that's a, like a better interactive visual version of what does this code print out?

20:21 You know, that, that kind of assessment or test you might have in a computer science program,

20:26 of course.

20:27 Yep.

20:27 Exactly.

20:28 Yeah.

20:29 And so kind of along those same lines, one of the, one of the things that one of my students

20:33 is working on this summer, we're calling it the clickable area question.

20:38 And so this is one of my favorite kinds of questions to put on, on introductory exams is

20:43 to give them some code.

20:44 And then I say, all right, circle, circle, all the variables that are integers in this

20:49 example, or circle all the assignment statements in this example.

20:54 And so now we can automate that.

20:56 We can give them an example and say, click on all of the, click on all of the, assignment

21:00 statements or click on all the floating, you know, click on all the things that are of type

21:04 float in this code snippet.

21:06 Yeah.

21:06 That's cool.

21:06 Does the program discover the right answer or do you have to teach it?

21:10 No, as the, as the instructor, you tell it what the right answer, or, you know, as the

21:14 author, I should say, you tell them.

21:15 It's not like you understand the abstract, abstract syntax tree and like, oh yeah, here's the three

21:20 branches that I could have to create.

21:21 Cool.

21:23 That would be even cooler.

21:24 Because then I would save you the work, but still, that's very awesome.

21:27 Yeah.

21:27 Very awesome.

21:28 Yeah.

21:29 So I've, I've mentioned Philip Guau on the show before, cause he has a really cool C

21:33 Python, deep dive course from the university.

21:38 Are you guys at the same universities or are you just are kind of on the same projects?

21:41 Yeah, we've just, I forget exactly how we met, but yeah, we've just been working.

21:45 He's at, University of Rochester in New York and I'm here in Iowa.

21:49 And yeah, we just, we see each other at conferences and we Skype and email and write papers together.

21:55 Yeah, that's cool.

21:55 I'm a fan of what he's doing.

21:57 So that's really nice.

21:57 I had no idea of this connection until we started talking.

22:00 That's great.

22:02 So one of the things that you said you guys are up to and you're actively doing it right

22:05 now, maybe one of your, your summer, students is doing this is upgrading and moving

22:11 from web to PI over to flask for your web platform.

22:14 Yeah.

22:15 Yeah.

22:15 So we've been running with web to PI, since 2011 when we first kind of went online with

22:21 this.

22:22 And, I mean, one of the cool things about the research that I do is I always, I always

22:27 have to try to tie it somehow into my teaching or into a class that I'm working on.

22:31 And so I teach this, I teach this, internet programming course and I really like,

22:38 I really like web to PI as a kind of as a teaching platform.

22:42 You know, it really does a great job of, of enforcing that kind of model view controller,

22:47 paradigm into, into building web apps with just kind of by the naming structures that

22:54 it uses and, and so on.

22:55 but as we've grown and as we've, as we've started to, you know, as started to have to

23:02 scale this system to support all of the schools that are starting to use it and all the people

23:07 around the world.

23:07 and just, you know, like any system, right.

23:11 especially a research system like this, it's, it's become an organically grown mess.

23:16 And so, so in order to kind of take the next step, you know, I really took a step back

23:23 over the last six months and really kind of thought about all the parts of the system and

23:27 how we should re-architect it.

23:29 And, and it became very clear to me that, that it was time to kind of move from web

23:33 to PI, to a different framework.

23:36 And so I looked around and, and it seems to me that Flask is the right now, at least for

23:41 what I want to do, the kind of the best choice.

23:42 so, so that's what we're doing.

23:45 We're moving to much more of a microservices model, for the backend services and Flask works

23:50 really well for that.

23:51 Yeah.

23:52 It does seem like Flask is, is really what people are choosing for those types of apps.

23:56 And because you're running Python on the client, it seems like you have a lot of fairly static

24:02 HTML and you just need some backend services.

24:05 And it seems like Flask is a real good fit for that.

24:07 Yeah.

24:08 I mean, I sort of in, in modern speak, I sort of, you know, think of each page of the textbook

24:13 or each section of the textbook as a, as a single page application with these microservices

24:19 running in the background.

24:20 Yeah.

24:20 That's great.

24:21 Yeah.

24:22 Another thing you're using is Sphinx and restructured text.

24:25 Yep.

24:25 So that's what I use to generate all the static, you know, static, web pages.

24:30 So instead of coding like a formatted HTML or exporting from word or something terrible

24:35 like that, you just do restructured.

24:37 Yeah.

24:37 Yeah.

24:38 Everything is written in restructured text.

24:40 Yeah.

24:41 So, and then, and then what I really love about restructured text, you know, over something

24:46 like Markdown is that it is very extensible.

24:49 So you can go in and you can add your, in, in, in restructured text speak, you can add your

24:54 own directives.

24:55 Right.

24:56 So the coding, so the runnable code examples, what we call active code, there's an active

25:01 code directive that you write in Sphinx.

25:04 and instead of having to do a whole bunch of JavaScript, you just say dot, dot space,

25:08 active code, and then indent underneath that, put your raw Python code.

25:13 And then when you run it through the Sphinx in, the Sphinx generator, it goes out

25:19 and generates all the gobbledygook JavaScript that you need in order to make it look on the

25:24 page, like this beautiful example with the run button underneath and the, and the canvas

25:28 and all that other cool stuff.

25:29 Yeah.

25:30 So that's, that's really cool.

25:32 It makes it really easy to write.

25:34 Yeah, indeed.

25:35 Where are you guys going with runestone?

25:38 So, yeah, so I think we've started on a couple of really cool things, over the last,

25:44 last summer and, and not as much this summer as I was hoping, but, we've gathered so

25:50 much data over the last three years, that there's just this, I have this huge, huge interest

25:56 in, in understanding how I can, I can apply some machine learning techniques to maybe doing

26:02 some automated tutoring as a part of the, as a part of the platform.

26:07 Okay.

26:07 So right now it's, it's kind of very much in the, the university structured class, you

26:14 know, CS 101 or something like that.

26:17 But if, if you could get it to be more self-supporting, maybe it could be just online training or something

26:23 like that, right?

26:24 Yeah.

26:25 Yeah.

26:25 I mean, right now our audience is really divided in two, into two pieces.

26:29 We have, we have a huge number of colleges and high schools that are using the book for,

26:33 for their sort of traditional classroom style classes.

26:37 But we also have the book just open and we get about half of our traffic just from people who

26:43 have heard about this site from various sources and just want to come and teach themselves how to

26:47 program in Python.

26:48 Yeah, that's cool.

26:49 So how do they get started doing that?

26:51 Do they go, do they go to the book links and they pick a book?

26:54 Yep.

26:54 And we just have kind of one giant open book that, that anybody can go and read just the,

26:59 how to think like a computer scientist book.

27:01 and anybody can come up to that and they can create an account if they want.

27:06 there's nobody there that's going to grade their homework for them.

27:09 but you know, they can read, they can, they can experiment as they're reading.

27:13 They can do the multiple choice questions.

27:15 And, yeah, we get a surprising number of people who come in and do that and, and go a long

27:21 ways in the textbook.

27:22 That's really cool.

27:23 It says that you can join more than 850,000 other readers learning to think like a computer

27:28 scientist in Python.

27:29 Yeah.

27:30 That's cool.

27:30 You guys have to have some champagne or some good beer or something when that crosses over

27:34 a million.

27:34 Yeah.

27:35 I think we're actually probably already there that I had to actually hard code that 850,000

27:41 number, a while ago because it turned out that calculating that was slowing down the whole

27:47 website every time somebody brought up one of the pages.

27:49 It's just not worth it.

27:50 So it just was, yeah, one of those things that I threw in there thinking it would be fun.

27:54 And then one day I realized that the whole site crashed because all of my, all of my threads

27:59 were busy counting.

28:00 Yeah.

28:02 That's awesome.

28:04 So you, you've, you've taught a lot of students Python over the last three years.

28:09 What are some of the takeaways or key things you learned from that experience?

28:14 Yeah.

28:15 So, I mean, one of the funny things that we've learned is, is something that we've always

28:19 suspected and that is that nobody studies on Saturday.

28:22 So we, we, we, of course we track all the clicks that the students make from all over the

28:29 world.

28:29 And it's, it's so consistent every week.

28:32 There's this giant dip on Saturday.

28:33 So don't even try it.

28:38 Let's just work with the way the world is.

28:39 So let's just, we'll forget about that.

28:41 Back Sunday.

28:42 Yep.

28:42 I think there were the, the two more real results that I think are interesting.

28:47 One of them, one of the first things that we learned in, and we worked with Mark Guzdial

28:54 and, and his wife, Barb Erickson down at, at Georgia tech for a year with this.

29:00 And they put together a bunch of different metrics and a bunch of different tests.

29:04 And so we could try to understand what things were having an impact on students.

29:09 And in that, in that preliminary year that we did all this study, what we found was that

29:15 there, there actually was a correlation between the students that used code lens a lot.

29:21 And the students that ended up doing very well in the class.

29:24 So we think that there's a, there's something going on there with, you know, code lens and

29:29 how it helps you develop that internal model of what's going on in the interpreter and ultimately

29:35 how well you do in the, in the class.

29:38 So I think that's if nothing else, that's solid proof that yeah, using code lens is, is a good

29:44 thing.

29:44 Yeah.

29:44 That's really cool.

29:45 Are you writing any papers or anything on that?

29:47 Yeah.

29:47 We've Phillip and I have collaborated on, on I think two papers now and he just got one of

29:53 them accepted.

29:54 So, so that'll be coming out soon.

29:56 Excellent.

29:57 And then, and then Mark and his group got another one accepted at the ICER conference.

30:01 This episode is brought to you by CodeShip.

30:18 CodeShip has launched organizations, create teams, set permissions for specific team members

30:24 and improve collaboration in your continuous delivery workflow.

30:27 Maintain centralized control of your organization's projects and teams with CodeShip's

30:31 new organization's plan.

30:33 And as Talk Python listeners, you can save 20% off any premium plan for the next three

30:38 months.

30:38 Just use the code Talk Python, all caps, no spaces.

30:42 Check them out at CodeShip.com and tell them thanks for supporting the show on Twitter where

30:46 they're at CodeShip.

30:47 Cool.

30:53 So it's yielding some results.

30:54 That's great.

30:55 Yeah.

30:55 Yeah.

30:56 And then the second thing that we did, which is kind of a really cool part of the, of, you

31:00 know, having control of the Python interpreter itself and how you display everything in the

31:05 book was between the first year that we used the book and the second year that we used the

31:12 book, we spent some time in the summer changing and enhancing how we displayed error messages

31:17 to students.

31:18 So the first year that we ran that we used the book, we just had a, we actually just had a,

31:23 a JavaScript pop-up dialogue box that would come up with the standard Python error message.

31:30 If you ran into a syntax error, you know, or whatever.

31:32 Right.

31:34 And, you know, they really aren't that informative.

31:36 So the second year, instead of the pop-up dialogue box, we changed the whole thing and we gave a,

31:43 we gave a, an error, we gave the error message.

31:46 And then we had a, an error description, a much more like almost a paragraph describing,

31:51 this is the error.

31:52 These are the kind of conditions that might make this error appear.

31:55 Here's a couple examples, maybe even of the kind of things that, that are going to give you an

31:59 error like this.

32:00 And then we also added a paragraph of here's some ways to try to track this down and how you

32:05 should fix this error.

32:06 And what we saw was a huge, huge improvement in terms of how efficient students were in completing

32:14 homework assignments and doing programming exercises.

32:17 Cause we, every time a student runs a programming exercise in the book, we save their code.

32:23 And, and we kind of, you know, so we can keep track of how many runs did it take from ground

32:28 zero to the point where the student either gave up or, or, you know, completed the, completed

32:33 the assignment.

32:33 And so we saw this huge decrease in the number of runs after we, after we made that change to

32:39 how we presented all this error message information to the students.

32:43 That's really, that's really cool.

32:44 Those error messages are so frustrating when you're new.

32:48 Oh, I know.

32:49 You get used to them, but they're, they're not as helpful as, as we looking from an experience

32:54 perspective think they are.

32:55 Yeah, exactly.

32:56 Cool.

32:57 So that's, that's a really neat result.

32:58 Yeah.

32:59 We're taking that same, that same set of, of data that every run data.

33:04 And now we've added this thing called code coach.

33:07 And we really haven't had the ability to go back and do much assessment of it yet.

33:11 But code coach, what it does is actually in the background, it runs pilot over, over each,

33:18 each submission.

33:19 And then if the student clicks on it, you can actually click through and you can look

33:23 at the differences from run to run to run to run.

33:26 So you can see kind of after the fact, what did I, what did I change about this code?

33:31 And then it'll also then give you any, any hints from, from running pilot on, on, you know,

33:38 things that obviously don't generate error messages, but there's some really valuable stuff

33:43 in pilot, especially, you know, for beginners.

33:45 Yeah.

33:45 That'll definitely give them a jumpstart in writing what looks more like professional

33:49 code.

33:50 Yeah.

33:50 You know, like just a quick example of a, of a thing that really catches beginners is forgetting

33:55 their parentheses on a function call.

33:58 Sure.

33:58 Especially a function call that has no parameters, right?

34:01 They're always forgetting to put their parentheses in.

34:03 Well, that doesn't generate any kind of error message in Python because that's a valid statement.

34:08 It's just, it's just useless, right?

34:11 It just comes back and tells you that it's a function.

34:13 Well, fine.

34:14 From a beginner's point of view, there's no value to that when they don't, especially

34:18 when they don't see that when they are just running a program.

34:20 But if you run it through pilot, it'll tell you, Hey, line 12, that's a useless statement.

34:24 And they'll look at it and they'll think, well, wait a minute.

34:26 I was trying to make a turtle there.

34:28 So, but it's telling me there's something wrong with that line.

34:31 So.

34:31 Yeah, that's really helpful.

34:33 The conversation about parentheses made me think, are you guys doing a Python two or

34:38 Python three?

34:39 Huh?

34:40 So we're doing, we're doing sort of a hybrid and without starting any religious wars.

34:48 I just, I think that from a beginner's point of view, the differences in Python two and Python

34:54 three are so slight, that it's not really worth worrying about.

34:58 Yeah, I agree.

34:59 I agree.

35:00 So we, we support either parentheses or no parentheses after your print statements.

35:05 And, and we, and we support, we have a flag that you can set if you want to make sure

35:10 that you're getting the Python three division semantics.

35:13 Right.

35:13 Okay.

35:14 Yeah.

35:14 Very cool.

35:15 At the heart of all that, of course, is sculpt.

35:17 And somewhere along the way you became the maintainer of sculpt.

35:21 And by the way, for those listening, it's S K U L P T, right?

35:24 Correct.

35:25 Yep.

35:26 Yep.

35:26 Yeah.

35:29 So that was one of those, you know, I found this, I thought it was, I thought it was really

35:33 the most awesome code that I'd run into that enabled this Python in the browser.

35:38 And unfortunately the time that I was getting super excited about, it was about the same time

35:42 that Scott was making a career change and it was sort of more or less losing interest

35:47 in the project.

35:48 so he was very gracious and we've sort of transitioned that over to where I'm the

35:53 maintainer of, of it.

35:55 And I moved it over to GitHub and, yeah, now we have this, we have this great, I think

35:59 very thriving community of people who are contributing, to sculpt right now.

36:04 Yeah.

36:04 And just continuing to improve it.

36:06 Yeah.

36:07 The short story or the tagline for your GitHub project is sculpt.

36:10 It's a JavaScript implementation of the Python programming language.

36:14 So basically download some JavaScript, which is the Python interpreter, if you will.

36:18 And then you write some more Python and just run it in the browser, right?

36:22 Yeah, exactly.

36:23 Yep.

36:24 Yeah.

36:24 Very cool.

36:25 Yeah.

36:25 You guys have almost a thousand stars.

36:26 That's pretty excellent.

36:27 Yeah.

36:28 It's been, it's been a fun project.

36:30 It's, it's, it's one of those great things, you know, I get up in the morning and, and there's

36:34 people in Germany and there's people in France and there's people all over the world that

36:38 are, you know, working on this and submitting pull requests and whatever.

36:41 And so it's a, it's a very international effort.

36:44 Yeah.

36:45 Yeah.

36:45 That's great.

36:46 One, one thing, that came to mind when I was thinking about this is just this morning,

36:52 I was emailing with Ryan Kelly who did pypy.js.

36:56 Yeah.

36:57 Can you compare those two projects or sort of say like, what's, what's the story?

37:03 I mean, these are both kinds of JavaScript implementations in the browser.

37:06 Yeah.

37:07 So I think there's, there's actually three separate projects right now going on for Python in the

37:12 browser.

37:12 There's sculpt.

37:14 There's a project called Brython.

37:15 And then there's this, and then there's a pypy.js.

37:19 So pypy.js is really awesome because it's using the, oh shoot.

37:25 I'm just going to space out the name.

37:27 It's using this extension to LLVM compiler, right?

37:31 Where you can compile to a different target.

37:33 Instead of compiling it to machine language, you can have it compiled to JavaScript.

37:37 Exactly.

37:38 So they're actually taking the C source code for pypy, running it through the compiler and

37:43 having the compiler generate all the JavaScript form.

37:45 So the advantage for pypy.js is that you kind of get, you know, absolutely the CPython implementation.

37:52 no question about it.

37:55 What, what's lacking there at the moment.

37:59 And I know they're working on this is to be able to bridge things like, like the turtle

38:05 graphics module or like the processing graphics module so that you can, you know, you can do

38:09 the kind of cool interactive graphics kind of things in the browser that you might want to

38:13 do.

38:13 Yeah.

38:14 That's cool.

38:14 The other thing, the other difference is that, sculpt is just a tiny fraction of the

38:18 size of pypy.js at the moment.

38:20 So what's the size of the JavaScript files for sculpt?

38:25 they're like 143 K.

38:28 Okay.

38:29 That's, that's pretty, that's pretty decent.

38:31 Does that include the standard library?

38:33 Well, it includes the parts of the standard library that we've implemented.

38:37 Right.

38:37 Of course.

38:38 Yeah.

38:39 Which is a fraction of the standard library.

38:42 I guess, you know, if you're missing a piece and it's pure Python, maybe you could try to

38:46 just run it and try to straight up import it.

38:50 That's cool.

38:50 Yep.

38:51 So I don't know.

38:53 There may be a day when we, when, when all this stuff kind of comes together in the great

38:57 singularity of Python in the browser.

38:59 Yeah.

38:59 And we'll get all the best of all the worlds.

39:01 It's really exciting to see that happening.

39:05 so yeah, I think both those projects are, are super cool.

39:09 Did you ever watch, or maybe I should just recommend to the listeners, Gary Bernhardt's

39:14 The Birth and Death of JavaScript?

39:15 No, I haven't.

39:17 Oh my gosh.

39:18 It's this fictional, you know, he's hilarious, of course.

39:21 And I believe this is presented at PyCon 2014.

39:25 I'm not sure when it was, but it's on the video.

39:27 And basically he takes us through this fictional history of going from 2005 into 2035 and how

39:34 JavaScript has changed.

39:35 But there's this sort of real technical underpinning of asm.js and compiling C down into JavaScript

39:42 for the, the running in the browser.

39:45 And it's definitely worth a look.

39:46 I'll put it in the show notes.

39:47 Yeah.

39:48 It's, it's both hilarious and instructive.

39:51 Okay.

39:53 So we're kind of coming up on the end of the show.

39:55 I have a few questions I always ask on the way out, but before we get there, do you want

40:00 to just talk briefly about the books that you have available and, you know, what ones you've

40:04 maybe wanted to call people's attention to?

40:06 There's, there's a lot of educators listening and also students I know.

40:10 So maybe both ends, they would appreciate hearing about what you guys have in this format at RuneScape.

40:16 Yeah.

40:17 Thanks.

40:18 So we have how to think like a computer scientist interactive edition.

40:23 And that's based on, I think the very, you know, very well known how to think like a computer

40:28 scientist book by Allen Downey and Jeff Elkinger and a couple of other people.

40:34 But I think Alan and Jeff were kind of the main authors on that.

40:38 And so that, that, that's been an open source textbook for, for quite a few years now.

40:43 And I'll just be forever indebted to them for, for doing that because it saved me from yet

40:50 again, having to write an introductory chapter about lists when I didn't want to do that ever

40:55 again.

40:55 So, so we took that, we took their open source textbook and made it interactive and added the

41:04 questions.

41:05 And, you know, over the years we've, we've added some of our own things to it and added

41:08 a couple of new chapters.

41:09 But so that, so that book has just has a great pedigree and has, and has proven itself over

41:18 the years as a, as a really solid textbook, not only for the college level, but also for

41:22 the high school level.

41:23 So we have that out there.

41:26 And then we have a data structures textbook, problem solving with algorithms and data structures

41:32 by Brad Miller and David Ranum.

41:34 that that's published by Franklin Beadle, a publisher right out in, in, Oregon in

41:40 your neighborhood.

41:41 Oh yeah.

41:41 and so, our publisher there was, was gracious enough when we approached him about

41:49 saying, Hey, we have this great idea to change the world.

41:52 We want to make textbooks interactive.

41:54 And we showed him kind of a proof of concept using the how to think book.

41:58 And he, he, immediately, Jim Lisey, our publisher immediately said, wow, that's

42:04 great.

42:04 Let's yeah.

42:05 You have my permission to, to take your book and put it online like that.

42:08 Oh, that's excellent.

42:09 Yeah.

42:11 So that's, and, and, you know, funnily enough, it's one of those great stories where we put

42:16 it online and the year after we put it online, we had our best year in, in royalties ever

42:20 from, from the paper book sales.

42:22 So that's the real, the real irony of open source sometimes, isn't it?

42:26 I mean, I work really close with MongoDB and the guys there and you know, that's a billion,

42:32 multi-billion dollar company and you can go to GitHub and get their product and just download

42:36 it for free.

42:36 I mean, it's amazing.

42:37 And you know, Red Hat and OpenStack and all sorts of stuff is, is, is really sort of paradoxical

42:44 or in, in the sense you would think giving it away would be a problem, but in fact, it's

42:48 actually the thing that makes it catch fire.

42:52 And then I have a little book called Java for Python programmers, which is just a short

42:56 little book on making the transition from, from Python to Java.

42:59 And then we've got, we've got a couple of other, several other books actually.

43:04 One of them written by, by my friend, Paul Resnick at the university of Michigan called

43:09 programming programs, information, and people.

43:12 We call it the pip book.

43:13 And that's part of their information science program at the university of Michigan.

43:18 That's written using the runestone tools and is now freely, freely available.

43:22 Mark Guzdial at Georgia tech has written a book for, for high school computer science

43:29 instructors as part of the APs, as part of the new AP programming class called, what

43:37 is it?

43:37 Computer.

43:38 look it up.

43:42 So it's, it's, it's not Java based.

43:46 It's Lang.

43:46 What it, what the cool thing about it is it's kind of language agnostic.

43:50 So it's a CS principles, sorry.

43:52 CS principles is the name of the course.

43:54 Excellent.

43:55 It's the new course by the, by the AP.

43:57 And so Mark has written a textbook just for instructors about how to teach that course.

44:01 And then this fall, he'll also be coming out with the student book for that.

44:05 The, the, and both of those are based on the runestone tools.

44:08 Yeah.

44:08 So it sounds like you guys are really building quite a platform for the teaching going forward.

44:14 Yeah.

44:15 That's what, that's what we hope.

44:16 And you know, the more people that do this, it's always one of those crazy, exciting things

44:22 when you find somebody on the other side of the world or in someplace else that's suddenly

44:26 translated your textbook into Russian or Czech or some other language and is, and is using

44:31 your tools to write a book that you never thought of.

44:34 Yeah.

44:34 That's amazing.

44:35 It's, it's really gratifying.

44:36 I'm sure.

44:36 Yeah.

44:37 Brad, I think that's, that might be a good place to wrap it up.

44:41 Final thoughts, favorite editor.

44:44 favorite editor, right?

44:46 PyCharm.

44:47 Pie charm.

44:48 Oh, right on.

44:49 Do you use that in your class?

44:50 I do.

44:51 Yep.

44:51 Yeah.

44:52 We, we, we stay in the browser for about half the class and then we transition to PyCharm.

44:57 So that's cool.

44:58 Have you tried their PyCharm education edition?

45:01 I have messed around with it a little bit.

45:04 Yeah.

45:04 Yeah.

45:04 I looked at it.

45:05 It's interesting because it kind of guides you through like it's sort of handholding a little

45:08 bit in a sense, but I haven't done anything with it either.

45:10 Yeah.

45:11 All right.

45:12 Awesome.

45:12 Yeah.

45:12 That's the one I use as well.

45:13 I love pie.

45:14 Charm.

45:14 favorite PI package.

45:17 Oh, I Python.

45:19 Yeah.

45:20 I Python is so good.

45:21 Yeah.

45:22 I use it in all my upper level classes now.

45:25 It's so, it's such a great teaching tool that way.

45:27 Oh, I bet it is.

45:28 I hadn't even really considered sort of the, here's the thing I can give the student component

45:33 of it.

45:33 Yeah.

45:34 I mean, for making class notes, it's, it's really, it's really awesome.

45:37 And now with this, you know, with this new, Jupyter integration, you know, I'm, that's

45:44 one of my little projects is to get a Jupyter server running on, on one of our servers on

45:47 campus here.

45:48 Yeah.

45:49 So that people can just access it.

45:50 So the whole I Python thing will break out of being just Python.

45:53 Not that that's terrible, but it'll let it grow significantly.

45:56 Right?

45:56 Yeah.

45:57 Yeah.

45:58 Yep.

45:58 Awesome.

45:58 All right.

45:59 Anything you want to, we didn't talk about, you want to let people know some links you want

46:03 to give people, things like that.

46:05 Yeah.

46:05 I would just say if anybody wants to give, if anybody wants to give Sculpt a try or experience

46:10 Python in the browser, there's another group of guys that I worked together with very

46:14 closely at trinket.io.

46:16 and they have this, they're actually a little startup out on the East coast and, yeah,

46:22 trinket.io, you could write Python programs right in your browser, save them, share them,

46:28 email them to your friends.

46:30 so it's, it's also a great way for doing Python in the browser.

46:33 So I just wanted to give a, give a shout out to the, to the guys at trinket because they've

46:38 been very super helpful in, in keeping the Sculpt project.

46:41 Oh, cool.

46:42 Yeah.

46:42 It's a little bit like, JS Fiddle, but for Python.

46:45 Yeah.

46:46 I think.

46:46 Yeah.

46:46 That's cool.

46:47 Very nice.

46:47 Anything else?

46:49 I think we've hit it.

46:51 Yeah.

46:51 All right, Brad, this has been super interesting.

46:53 I really love to sort of see how Python is making its way into education and.

46:58 Yeah.

46:59 It's really gratifying.

47:00 What you're doing over.

47:01 Yeah.

47:01 Runestone is very cool.

47:02 So people should check it out at interactivepython.org.

47:05 Yep.

47:06 Definitely.

47:07 All right.

47:07 Thanks for being on the show.

47:08 Thanks for having me.

47:09 This was a lot of fun.

47:10 Yeah, it sure was.

47:12 See you later.

47:13 This has been another episode of Talk Python to Me.

47:16 Today's guest was Brad Miller.

47:18 And this episode has been sponsored by Hired and CodeShip.

47:21 Thank you guys for supporting the show.

47:23 Thank you.

47:24 Thank you.

47:24 Thank you.

47:24 Hired wants to be here.

47:27 Visit Hired.com slash talkpython to me to get five or more offers with salary and equity presented right up front and a special listener signing bonus of $4,000.

47:36 CodeShip wants you to always keep shipping.

47:40 Check them out at codeship.com and thank them on Twitter via at CodeShip.

47:44 Don't forget the discount code for listeners.

47:46 It's easy.

47:47 Talk Python, all caps, no spaces.

47:49 You can find the links from the show at talkpythontome.com slash episodes slash show slash 20.

47:57 And while you're there, be sure to subscribe to the show.

48:00 Open your favorite podcatcher and search for Python.

48:02 We should be the number one hit right at the top.

48:05 You can also find the iTunes and direct RSS feeds in the footer of the website.

48:10 Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.

48:15 You can hear his entire song on our website.

48:18 This is your host, Michael Kennedy.

48:20 Thanks for listening.

48:21 Smix takes us out of here.

48:23 Staying with my voice.

48:25 There's no norm that I can feel within.

48:27 Haven't been sleeping.

48:28 I've been using lots of rest.

48:30 I'll pass the mic back to who rocked it best.

48:32 Developers, Developers, Developers, Developers, Developers, Developers.

48:40 Developers, Developers, Developers, Developers, Developers, Developers, Developers.

48:45 .

48:45 Thank you.

Talk Python's Mastodon Michael Kennedy's Mastodon