What if your computer science textbooks could run their Python code samples,
and that code ran directly in your browser?
Kind of like JavaScript, but better because Python.
It is possible, and Brad Miller is making it happen.
This is Talk Python to Me, episode number 20, recorded Tuesday, July 7th, 2015.
Welcome to Talk Python to Me, a weekly podcast on Python,
the language, the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy.
Follow me on Twitter, where I'm @mkennedy,
and keep up with the show and listen to past episodes at talkpythontome.com,
and follow the show on Twitter via at Talk Python.
This episode will be talking to Dr. Brad Miller about interactive Python,
Python in higher education, and Sculpt, the Python that you run in your browser.
I'm happy to tell you that this episode is brought to you by Hired and Codeship.
Thank them for supporting the show on Twitter via at Hired underscore HQ and at Codeship.
Now let's get right to the show.
Brad Miller is an associate professor of computer science at Luther College.
He's the founder of RuneStone Interactive.
He loves to travel, hack, bike, and cook, but not necessarily in that order.
Brad, welcome to the show.
Thanks. It's a great pleasure to be here.
Yeah. You guys are doing some really awesome stuff over at RuneStone,
and online platforms for people learning and teaching Python,
and that's what we're going to talk about today.
But before we get to online Python and Python in the browser and a bunch of other cool stuff,
what's your story? How did you get here?
So, well, we can go all the way back to 1979,
when I first got into programming, I suppose.
That was when our high school got the first Apple IIs installed,
and I discovered AppleSoft Basic,
and I discovered that I could win a lot more often if I hacked the lemonade stand game
and made it rain on Player 2 a higher percentage of the time than Player 1.
So that was kind of my introduction to programming,
was digging into Basic code.
That's really awesome.
I mean, that's what a lot of programming is, is you're like,
I don't want to just use this tool.
I want to make a better tool or change it or whatever, right?
And that's really cool.
It doesn't say much about my ethics in those days, but...
That was lemonade.
It was, yeah.
Better than Oregon Trail,
which was the other popular game back in those days.
Yeah, indeed.
So, yeah.
So that's how you got started and sort of interested in computers.
How did you get into programming?
So I started out as a computer science major at Luther when I went to undergrad
and learned, you know, that was back in the days when people learned Pascal.
And then I started my career at a, you know, big iron mainframe manufacturer called Control Data
and worked on energy management systems for Control Data.
Yeah.
Wow.
What kind of language?
Yeah.
Fortran.
So...
Oh, yeah.
I was told when I was in college and starting out that Fortran was the most important language
I was ever going to learn in my career.
Yeah.
And I pleaded to take C++.
I said, after Fortran.
All right, fine.
I just missed the punch card days.
So I guess Fortran is as bad as I get.
Yeah.
Cool.
Yeah.
And I had a great internship with Amoco Research where I got to work in their AI lab.
So that got me interested in Lisp and interpreted languages.
And, yeah.
Then in grad school, I started hacking in Perl a lot.
And then C++ and Java.
And then I made a career change in 2003 where I became a college professor.
Oh, wow.
I left a successful startup company and came back to teach at my alma mater.
And I taught Java in the introductory CS class for a year.
And I realized that it was just the worst possible language for teaching people that had never
programmed before how to program.
And so we looked around and there was this language called Python, which was still, you
know, I know it's not new, but it was really very, very new in the educational field back
in 2003.
In fact, there was only one textbook available.
But we decided that we were going to go ahead and adopt Python as our introductory language for
teaching in computer science, which immediately led to myself and my colleague, David Random,
writing a data structures textbook because we wanted to be able to teach Python in both CS1 and CS2.
Yeah.
Of course, if the book isn't there, maybe you have to go back to Java and you don't want to do that.
No.
Yeah.
So that was definitely, you know, okay, we can use this one textbook that's there, but we're
going to write the other one.
And so that worked out really well.
Yeah, that is really cool.
You know, one of the things I think is really a success story for Python is it's become the
most popular sort of introductory computer science language, at least at U.S. universities.
But I think that's pretty global.
Yeah.
Can you compare what it's like to teach Java, what it's like to teach Python, the way the
students received it, whether like better grades, more excitement, less dropout, those kinds
of things?
I mean, certainly less dropout with Python.
And I think it's much, much quicker for them to kind of get up and running and be able to
do interesting stuff.
You know, when you teach Java, I like to say there's like 12 things that you have to lie
to them about on day one.
Starting with, you know, public static void main, string, args, you know, there's like
none of that.
Do you want to try to talk about to introductory students on the first day of Java class?
So whereas with Python, you can, I guess, say print hello world, and at least you get something.
But it's also just as easy to say import turtle, make a turtle and make the turtle go forward
by a hundred.
And that gives them that kind of, there's that immediate gratification of being able to see
something visual on the screen and, you know, be able to control this stuff just by typing.
So, so that, that was a huge, huge change, just sort of in student mentality to be able
to kind of get into something where they could get that immediate gratification.
Yeah, that's really cool.
The show I just released this week with Lynn Root, she talks about how she was studying
C++ to make a switch, basically to get some foundation to move on to like a PhD program
in finance.
And they had to do programming.
So she took a C++ class and it just about crushed her will to do anything with programming.
And she came in and learned Python and it just like, she lit up and that's, that's still
what she's doing today.
It's great.
Oh yeah.
I mean, and there's so many great, you know, packages out there for Python that you can really
get students, you know, working with interesting stuff right away.
Yeah, that's for sure.
I just found today a project, a GitHub project repository, I guess you would call it, called
Awesome Python.
So I think it's, if you just search for Awesome-Python GitHub, and it's a, like a curated list of all
the amazing packages that people like really love.
So.
Oh, that's really cool.
I'll have to go look at, look at that.
Absolutely.
So, so that's really cool.
So you're doing, are you still teaching at the university?
I am.
Yes.
Uh huh.
And you're doing this thing with RuneStone Interactive.
Why don't you tell everyone what that is?
Yeah.
So RuneStone Interactive is, is kind of three, three components, I'll say.
First of all, it's a set of tools for authors that want to create interactive course materials.
So anything from lecture notes to a lab to a full-blown book, like what we've doing.
Um, so that, that includes, I like to, I like to say that kind of the big, hairy, audacious
goal is that we would like to be the LaTeX of interactive writing.
Um, so we've got all these tools that we're trying to build to make it easy for, for instructors
and other people to write interactive, interactive materials.
So things like interactive code, visualizing code, including video, including little
assessments like fill in the blanks or multiple choice or short answer.
Um, you know, things so you can hide things and show things.
And, so those kind of, all those kinds of things that you'd want to have in an interactive
textbook, whether it's, whether it's for computer science.
Or, or some other topic.
In fact.
Yeah, absolutely.
So it's kind of like taking the traditional textbook, but making it something that is more
native to the real world.
Right.
If I'm learning about computer science, I should be able to run the code.
I should be able to see visualizations.
I should be able to listen and all that kind of stuff is part of what you guys have there.
Right.
Yeah, exactly.
I mean, so this sort of started out on my sabbatical in 2011, where I was supposed to
be working on, new additions for the two textbooks that I've, that I've written that
are paper-based textbooks.
But as I was trying to write these updates to the paper textbooks, I kept thinking, God,
this would be so much cooler if, if it was actually doing something interactive on the screen.
And so I stopped working on the, on the, on the stuff for the paper books.
And I started, and I started experimenting with how we could make all this stuff interactive.
Um, and then I realized nobody in their right mind would ever write a textbook where you had
to go in and, and use JavaScript to hard code every code example you wanted.
So then I, then I started to think, okay, how could I, how could I write some macros that
would make this, make this easy?
And so that kind of led to that first part of the, of the authoring tools.
So that's sort of part one.
Part two is that then there's this sort of set of backend services that you have to run.
Things like when students run code, or write code, you want to be able to save what
they've written so that the next time they come to the website, they don't have to start
over and, and reenter all their code again.
Um, and if you're going to use it for a class, you'd like to have it, let's say, save the answers
to the multiple choice questions or give the instructor a grading interface so that they
can go in and grade and keep track of how the students did.
Um, so that's sort of the set of interactive, interactive services that support the book on
the front end.
That's really cool.
Do you guys, sorry, do you actually use the interactivity bit for like assessments and tests
and things in your classes?
Yeah.
Yep.
Not like for, it's great for daily assignments, for example, what I can do is say, all right,
I want you to read this section.
And at the end of the section, there might be a little coding thing, or there might be three
or four multiple choice or fill in the blank kind of questions.
And then every day before class, I can go in and go to the instructor's dashboard.
I can look at the responses to all those questions and get a sense for, all right, what were the
things that they understood about this section?
What were the things that they'd struggled with?
Uh, what were some of the common mistakes that they made?
And then, you know, that pretty much informs what I'm going to talk about at least, you know,
at the start of every class is to, to think about.
That's really powerful.
You don't really typically get that experience with a textbook.
No.
Because you never know, right?
I mean, all of us suspect that our students don't really read the assignments that we give
them.
But now we, now we actually know.
Yeah.
Because we can, because we can track them online.
So.
That's really excellent.
All right.
So what's part three?
Part three then became this hosting service.
So in the beginning, what, what I thought was all great.
We'll make all this open source.
And if somebody else wants to use this, for their class, they can just go to GitHub.
They can clone this.
They can set up a server.
They can build the books.
They can run it on their own server.
And then what I learned is that most people really don't want to do that.
Um.
So most people just have enough problems, you know, teaching their own class.
Uh, so, so we created this hosting service where you can go in and you can say, all right,
yeah, I want to use textbook a textbook, B textbook, C.
And what it does is it just makes a kind of a custom copy of that textbook and sets up an
instructor dashboard for that custom copy so that an instructor can have their students
registered for their course.
And all of their stuff is separate from all the other people in the world.
And the instructor can then just look at the dashboard for their own course.
Um, and they don't have to do anything except go in and click a few buttons to build, to build
their book.
That's really cool.
Do you mind talking about the business model just a little bit?
Like, is this totally free?
Is there like a fee?
Do you sell the books to the students or what's the story around that?
Yeah.
I, so we, we really right now are just based on donations, which doesn't work all that
well.
Is there a chance of like NSF, National Science Foundation support or like STEM research support
or any of those?
I think so.
I mean, right now I do have, I do have an NSF grant for the next three summers.
So I've got two, I've got two undergrad students that I'm, that I'm working with this summer
on making a bunch of enhancements to, to, to the way that we're, the way that we're
doing these extensions or these kind of macros that I talked about before.
Right.
That's really cool.
So, yeah.
So, but yeah, I don't get any support from them for, you know, paying for hosting fees
or anything like that.
Sure.
So people who want to use it out there, keep that in mind, maybe a donation.
You know, one of the universities that uses it is Duke University and they, they're really
good.
Every, you know, they've got 400 students in their introductory course.
And so I know the instructors there, you know, we've, we've known each other for a while
through conferences and whatnot.
And I know they always go the first couple of days and say, look, we're using this textbook.
It's free instead of the $145 you'd probably pay at the bookstore.
The least you can do is go make a $5 donation.
And, you know, we get about 20 out of 400 that feel moved to make a, there's a, there's
a five, 5% appreciation ratio.
Very cool.
So, but anyway, yeah, yeah, no, that's good.
So, yeah, keep going with that.
So you want to talk a little bit about some of the underlying tools that you're using, the
underlying packages and technology.
It's mostly Fortran on the backend.
Is that correct?
Uh, no, it's mostly Python.
Oh, just teasing.
Yeah.
Cool.
So tell us what you're doing there.
Maybe before we do this, actually.
So I went and I watched your video on interactive Python dot, is it org or com?
Dot org.
Interactive Python dot org.
Thank you.
And you've got a nice video that shows you a lot of, a lot of the really cool stuff you
can do.
Maybe you could just hit some of the high points so people know what we're talking about.
Yeah.
So I think the, the, the real aha moment for me was, was when I found this project called
sculpt.
This episode is brought to you by hired hired is a two sided curated marketplace that connects
the world's knowledge workers to the best opportunities.
Each offer you receive has salary and equity presented right up front and you can view the
offers to accept or reject them before you even talk to the company.
Typically candidates receive five or more offers in just the first week.
And there are no obligations ever.
Sounds pretty awesome.
Doesn't it?
Well, did I mention there's a signing bonus?
Everyone who accepts a job from hired gets a $2,000 signing bonus.
And as talk Python listeners, it gets way sweeter.
Use the link hired.com slash talk Python to me and hired will double the signing bonus
to $4,000 opportunities, knocking visit hired.com slash talk Python to me and answer the call.
And so sculpt was started by Scott Graham, who now works for Google.
And it was an implementation of CPython in JavaScript.
So this was back in 2010, 2011 that he had worked on that.
And I thought, oh my gosh, this is so cool.
You know, we can run Python right in the browser.
There's none of this.
Let's submit it, run it back somewhere on a server and then have the result come back to
the browser.
With all the security issues.
Yeah, exactly.
That come with that.
Yeah.
Right.
So this is running right in the browser.
And not only that, but because it was written to run right in the browser.
When I saw that, I got really excited about it.
The first thing that I did was I figured out how to add the turtle graphics module to it.
So now you can, you know, you can write your Python program and you can, you can do turtle
graphics right in the browser.
So you get that kind of instantaneous gratification of seeing something.
Yeah, that's awesome.
And it pops up right in a, like a little section or div or something of, of the HTML page.
And it's just, you know, animated, just like the regular real turtle.
Yep.
Exactly.
Is that using that HTML5 canvas?
It is.
Yep.
So this is all totally HTML5 based.
Yeah.
Excellent.
Okay.
Yep.
And then, so that's, so that's one thing.
And then the second thing is, is this, what we call code lens in the textbook, but
is really based on, on the work by Philip Guo on, online Python tutor.
And, you know, if you've, if you've ever taught Python or if you've ever really thought about
Python very deeply in terms of things like, well, variables, for example, is a big thing,
right?
Variables are just names for things in Python, right?
So we're always drawing these pictures on the board of, of here's a name.
And what does that name reference, you know, is it referencing a list or a dictionary or
some object that you've created?
Right.
And, and there's, there's all these reference diagrams that just clutter up the whiteboard.
Yeah.
I envision something on the stack with an arrow drawn to something on the heap with a pointer
over to somewhere and something like that.
Right.
Yeah, exactly.
Yep.
Cause you're trying to help students get a mental model for how the state of the program changes
as you step from line to line and just to really understand kind of what goes on inside,
inside the Python interpreter.
And so what Philip had done is he, he'd automated that with this online Python tutor.
And so we worked with Philip and took that and made it so that we could have these canned
examples and, and, and embed them right in the textbook.
So another way of thinking about it, if you've never seen it is it's kind of like having
a debugger, that where you can, you know, go into step mode in the debugger, only this
is even better because not only can you go forward, but you can go backward.
Yes.
And that was really impressive to me from a learning perspective.
You know, if you, obviously it's helpful when you're new to step through the debugger
and actually see how the program is working.
Right.
We, we get used to the fact that it's just innate to us how text becomes execution.
But when you're new, you know, my kids have looked at what I'm doing and they're like,
those words, is that really what that website is?
Yeah.
I mean, like how is, how does this become a game or whatever?
Right.
Yes.
And so just seeing that happen, I think it's really cool.
And the fact that you can go forwards and backwards is great.
Yeah.
And then, and then we enhance that even beyond what Philip has on the site in that, for
some of the examples, what we can do is we can step through and you get to an if statement
and we'll break into the execution and pop up a dialogue box and say, all right, after we
evaluate the condition on this if statement, what's the next line that's going to execute.
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?
If it's false, what's going to happen?
Right.
So that's a, like a better interactive visual version of what does this code print out?
You know, that, that kind of assessment or test you might have in a computer science program,
of course.
Yep.
Exactly.
Yeah.
And so kind of along those same lines, one of the, one of the things that one of my students
is working on this summer, we're calling it the clickable area question.
And so this is one of my favorite kinds of questions to put on, on introductory exams is
to give them some code.
And then I say, all right, circle, circle, all the variables that are integers in this
example, or circle all the assignment statements in this example.
And so now we can automate that.
We can give them an example and say, click on all of the, click on all of the, assignment
statements or click on all the floating, you know, click on all the things that are of type
float in this code snippet.
Yeah.
That's cool.
Does the program discover the right answer or do you have to teach it?
No, as the, as the instructor, you tell it what the right answer, or, you know, as the
author, I should say, you tell them.
It's not like you understand the abstract, abstract syntax tree and like, oh yeah, here's the three
branches that I could have to create.
Cool.
That would be even cooler.
Because then I would save you the work, but still, that's very awesome.
Yeah.
Very awesome.
Yeah.
So I've, I've mentioned Philip Guau on the show before, cause he has a really cool C
Python, deep dive course from the university.
Are you guys at the same universities or are you just are kind of on the same projects?
Yeah, we've just, I forget exactly how we met, but yeah, we've just been working.
He's at, University of Rochester in New York and I'm here in Iowa.
And yeah, we just, we see each other at conferences and we Skype and email and write papers together.
Yeah, that's cool.
I'm a fan of what he's doing.
So that's really nice.
I had no idea of this connection until we started talking.
That's great.
So one of the things that you said you guys are up to and you're actively doing it right
now, maybe one of your, your summer, students is doing this is upgrading and moving
from web to PI over to flask for your web platform.
Yeah.
So we've been running with web to PI, since 2011 when we first kind of went online with
this.
And, I mean, one of the cool things about the research that I do is I always, I always
have to try to tie it somehow into my teaching or into a class that I'm working on.
And so I teach this, I teach this, internet programming course and I really like,
I really like web to PI as a kind of as a teaching platform.
You know, it really does a great job of, of enforcing that kind of model view controller,
um, paradigm into, into building web apps with just kind of by the naming structures that
it uses and, and so on.
Um, but as we've grown and as we've, as we've started to, you know, as started to have to
scale this system to support all of the schools that are starting to use it and all the people
around the world.
Um, and just, you know, like any system, right.
Uh, especially a research system like this, it's, it's become an organically grown mess.
And so, so in order to kind of take the next step, you know, I really took a step back
over the last six months and really kind of thought about all the parts of the system and
how we should re-architect it.
And, and it became very clear to me that, that it was time to kind of move from web
to PI, to a different framework.
And so I looked around and, and it seems to me that Flask is the right now, at least for
what I want to do, the kind of the best choice.
Um, so, so that's what we're doing.
We're moving to much more of a microservices model, for the backend services and Flask works
really well for that.
Yeah.
It does seem like Flask is, is really what people are choosing for those types of apps.
And because you're running Python on the client, it seems like you have a lot of fairly static
HTML and you just need some backend services.
And it seems like Flask is a real good fit for that.
Yeah.
I mean, I sort of in, in modern speak, I sort of, you know, think of each page of the textbook
or each section of the textbook as a, as a single page application with these microservices
running in the background.
Yeah.
That's great.
Yeah.
Another thing you're using is Sphinx and restructured text.
Yep.
So that's what I use to generate all the static, you know, static, web pages.
So instead of coding like a formatted HTML or exporting from word or something terrible
like that, you just do restructured.
Yeah.
Everything is written in restructured text.
Yeah.
So, and then, and then what I really love about restructured text, you know, over something
like Markdown is that it is very extensible.
So you can go in and you can add your, in, in, in restructured text speak, you can add your
own directives.
Right.
So the coding, so the runnable code examples, what we call active code, there's an active
code directive that you write in Sphinx.
Um, and instead of having to do a whole bunch of JavaScript, you just say dot, dot space,
active code, and then indent underneath that, put your raw Python code.
And then when you run it through the Sphinx in, the Sphinx generator, it goes out
and generates all the gobbledygook JavaScript that you need in order to make it look on the
page, like this beautiful example with the run button underneath and the, and the canvas
and all that other cool stuff.
Yeah.
So that's, that's really cool.
It makes it really easy to write.
Yeah, indeed.
Where are you guys going with runestone?
So, yeah, so I think we've started on a couple of really cool things, over the last,
last summer and, and not as much this summer as I was hoping, but, we've gathered so
much data over the last three years, that there's just this, I have this huge, huge interest
in, in understanding how I can, I can apply some machine learning techniques to maybe doing
some automated tutoring as a part of the, as a part of the platform.
Okay.
So right now it's, it's kind of very much in the, the university structured class, you
know, CS 101 or something like that.
But if, if you could get it to be more self-supporting, maybe it could be just online training or something
like that, right?
Yeah.
I mean, right now our audience is really divided in two, into two pieces.
We have, we have a huge number of colleges and high schools that are using the book for,
for their sort of traditional classroom style classes.
But we also have the book just open and we get about half of our traffic just from people who
have heard about this site from various sources and just want to come and teach themselves how to
program in Python.
Yeah, that's cool.
So how do they get started doing that?
Do they go, do they go to the book links and they pick a book?
Yep.
And we just have kind of one giant open book that, that anybody can go and read just the,
how to think like a computer scientist book.
Um, and anybody can come up to that and they can create an account if they want.
Um, there's nobody there that's going to grade their homework for them.
Uh, but you know, they can read, they can, they can experiment as they're reading.
They can do the multiple choice questions.
And, yeah, we get a surprising number of people who come in and do that and, and go a long
ways in the textbook.
That's really cool.
It says that you can join more than 850,000 other readers learning to think like a computer
scientist in Python.
Yeah.
That's cool.
You guys have to have some champagne or some good beer or something when that crosses over
a million.
Yeah.
I think we're actually probably already there that I had to actually hard code that 850,000
number, a while ago because it turned out that calculating that was slowing down the whole
website every time somebody brought up one of the pages.
It's just not worth it.
So it just was, yeah, one of those things that I threw in there thinking it would be fun.
And then one day I realized that the whole site crashed because all of my, all of my threads
were busy counting.
Yeah.
That's awesome.
So you, you've, you've taught a lot of students Python over the last three years.
What are some of the takeaways or key things you learned from that experience?
Yeah.
So, I mean, one of the funny things that we've learned is, is something that we've always
suspected and that is that nobody studies on Saturday.
So we, we, we, of course we track all the clicks that the students make from all over the
world.
And it's, it's so consistent every week.
There's this giant dip on Saturday.
So don't even try it.
Let's just work with the way the world is.
So let's just, we'll forget about that.
Back Sunday.
Yep.
I think there were the, the two more real results that I think are interesting.
One of them, one of the first things that we learned in, and we worked with Mark Guzdial
and, and his wife, Barb Erickson down at, at Georgia tech for a year with this.
And they put together a bunch of different metrics and a bunch of different tests.
And so we could try to understand what things were having an impact on students.
And in that, in that preliminary year that we did all this study, what we found was that
there, there actually was a correlation between the students that used code lens a lot.
And the students that ended up doing very well in the class.
So we think that there's a, there's something going on there with, you know, code lens and
how it helps you develop that internal model of what's going on in the interpreter and ultimately
how well you do in the, in the class.
So I think that's if nothing else, that's solid proof that yeah, using code lens is, is a good
thing.
Yeah.
That's really cool.
Are you writing any papers or anything on that?
Yeah.
We've Phillip and I have collaborated on, on I think two papers now and he just got one of
them accepted.
So, so that'll be coming out soon.
Excellent.
And then, and then Mark and his group got another one accepted at the ICER conference.
This episode is brought to you by CodeShip.
CodeShip has launched organizations, create teams, set permissions for specific team members
and improve collaboration in your continuous delivery workflow.
Maintain centralized control of your organization's projects and teams with CodeShip's
new organization's plan.
And as Talk Python listeners, you can save 20% off any premium plan for the next three
months.
Just use the code Talk Python, all caps, no spaces.
Check them out at CodeShip.com and tell them thanks for supporting the show on Twitter where
they're at CodeShip.
Cool.
So it's yielding some results.
That's great.
Yeah.
And then the second thing that we did, which is kind of a really cool part of the, of, you
know, having control of the Python interpreter itself and how you display everything in the
book was between the first year that we used the book and the second year that we used the
book, we spent some time in the summer changing and enhancing how we displayed error messages
to students.
So the first year that we ran that we used the book, we just had a, we actually just had a,
a JavaScript pop-up dialogue box that would come up with the standard Python error message.
If you ran into a syntax error, you know, or whatever.
Right.
And, you know, they really aren't that informative.
So the second year, instead of the pop-up dialogue box, we changed the whole thing and we gave a,
we gave a, an error, we gave the error message.
And then we had a, an error description, a much more like almost a paragraph describing,
this is the error.
These are the kind of conditions that might make this error appear.
Here's a couple examples, maybe even of the kind of things that, that are going to give you an
error like this.
And then we also added a paragraph of here's some ways to try to track this down and how you
should fix this error.
And what we saw was a huge, huge improvement in terms of how efficient students were in completing
homework assignments and doing programming exercises.
Cause we, every time a student runs a programming exercise in the book, we save their code.
And, and we kind of, you know, so we can keep track of how many runs did it take from ground
zero to the point where the student either gave up or, or, you know, completed the, completed
the assignment.
And so we saw this huge decrease in the number of runs after we, after we made that change to
how we presented all this error message information to the students.
That's really, that's really cool.
Those error messages are so frustrating when you're new.
Oh, I know.
You get used to them, but they're, they're not as helpful as, as we looking from an experience
perspective think they are.
Yeah, exactly.
Cool.
So that's, that's a really neat result.
Yeah.
We're taking that same, that same set of, of data that every run data.
And now we've added this thing called code coach.
And we really haven't had the ability to go back and do much assessment of it yet.
But code coach, what it does is actually in the background, it runs pilot over, over each,
each submission.
And then if the student clicks on it, you can actually click through and you can look
at the differences from run to run to run to run.
So you can see kind of after the fact, what did I, what did I change about this code?
And then it'll also then give you any, any hints from, from running pilot on, on, you know,
things that obviously don't generate error messages, but there's some really valuable stuff
in pilot, especially, you know, for beginners.
Yeah.
That'll definitely give them a jumpstart in writing what looks more like professional
code.
Yeah.
You know, like just a quick example of a, of a thing that really catches beginners is forgetting
their parentheses on a function call.
Sure.
Especially a function call that has no parameters, right?
They're always forgetting to put their parentheses in.
Well, that doesn't generate any kind of error message in Python because that's a valid statement.
It's just, it's just useless, right?
It just comes back and tells you that it's a function.
Well, fine.
From a beginner's point of view, there's no value to that when they don't, especially
when they don't see that when they are just running a program.
But if you run it through pilot, it'll tell you, Hey, line 12, that's a useless statement.
And they'll look at it and they'll think, well, wait a minute.
I was trying to make a turtle there.
So, but it's telling me there's something wrong with that line.
So.
Yeah, that's really helpful.
The conversation about parentheses made me think, are you guys doing a Python two or
Python three?
Huh?
So we're doing, we're doing sort of a hybrid and without starting any religious wars.
I just, I think that from a beginner's point of view, the differences in Python two and Python
three are so slight, that it's not really worth worrying about.
Yeah, I agree.
I agree.
So we, we support either parentheses or no parentheses after your print statements.
And, and we, and we support, we have a flag that you can set if you want to make sure
that you're getting the Python three division semantics.
Right.
Okay.
Yeah.
Very cool.
At the heart of all that, of course, is sculpt.
And somewhere along the way you became the maintainer of sculpt.
And by the way, for those listening, it's S K U L P T, right?
Correct.
Yep.
Yeah.
So that was one of those, you know, I found this, I thought it was, I thought it was really
the most awesome code that I'd run into that enabled this Python in the browser.
And unfortunately the time that I was getting super excited about, it was about the same time
that Scott was making a career change and it was sort of more or less losing interest
in the project.
Um, so he was very gracious and we've sort of transitioned that over to where I'm the
maintainer of, of it.
And I moved it over to GitHub and, yeah, now we have this, we have this great, I think
very thriving community of people who are contributing, to sculpt right now.
Yeah.
And just continuing to improve it.
Yeah.
The short story or the tagline for your GitHub project is sculpt.
It's a JavaScript implementation of the Python programming language.
So basically download some JavaScript, which is the Python interpreter, if you will.
And then you write some more Python and just run it in the browser, right?
Yeah, exactly.
Yep.
Yeah.
Very cool.
Yeah.
You guys have almost a thousand stars.
That's pretty excellent.
Yeah.
It's been, it's been a fun project.
It's, it's, it's one of those great things, you know, I get up in the morning and, and there's
people in Germany and there's people in France and there's people all over the world that
are, you know, working on this and submitting pull requests and whatever.
And so it's a, it's a very international effort.
Yeah.
That's great.
One, one thing, that came to mind when I was thinking about this is just this morning,
I was emailing with Ryan Kelly who did pypy.js.
Yeah.
Can you compare those two projects or sort of say like, what's, what's the story?
I mean, these are both kinds of JavaScript implementations in the browser.
Yeah.
So I think there's, there's actually three separate projects right now going on for Python in the
browser.
There's sculpt.
There's a project called Brython.
And then there's this, and then there's a pypy.js.
So pypy.js is really awesome because it's using the, oh shoot.
I'm just going to space out the name.
It's using this extension to LLVM compiler, right?
Where you can compile to a different target.
Instead of compiling it to machine language, you can have it compiled to JavaScript.
Exactly.
So they're actually taking the C source code for pypy, running it through the compiler and
having the compiler generate all the JavaScript form.
So the advantage for pypy.js is that you kind of get, you know, absolutely the CPython implementation.
Um, no question about it.
What, what's lacking there at the moment.
And I know they're working on this is to be able to bridge things like, like the turtle
graphics module or like the processing graphics module so that you can, you know, you can do
the kind of cool interactive graphics kind of things in the browser that you might want to
do.
Yeah.
That's cool.
The other thing, the other difference is that, sculpt is just a tiny fraction of the
size of pypy.js at the moment.
So what's the size of the JavaScript files for sculpt?
Uh, they're like 143 K.
Okay.
That's, that's pretty, that's pretty decent.
Does that include the standard library?
Well, it includes the parts of the standard library that we've implemented.
Right.
Of course.
Yeah.
Which is a fraction of the standard library.
I guess, you know, if you're missing a piece and it's pure Python, maybe you could try to
just run it and try to straight up import it.
That's cool.
Yep.
So I don't know.
There may be a day when we, when, when all this stuff kind of comes together in the great
singularity of Python in the browser.
Yeah.
And we'll get all the best of all the worlds.
It's really exciting to see that happening.
Um, so yeah, I think both those projects are, are super cool.
Did you ever watch, or maybe I should just recommend to the listeners, Gary Bernhardt's
The Birth and Death of JavaScript?
No, I haven't.
Oh my gosh.
It's this fictional, you know, he's hilarious, of course.
And I believe this is presented at PyCon 2014.
I'm not sure when it was, but it's on the video.
And basically he takes us through this fictional history of going from 2005 into 2035 and how
JavaScript has changed.
But there's this sort of real technical underpinning of asm.js and compiling C down into JavaScript
for the, the running in the browser.
And it's definitely worth a look.
I'll put it in the show notes.
Yeah.
It's, it's both hilarious and instructive.
Okay.
So we're kind of coming up on the end of the show.
I have a few questions I always ask on the way out, but before we get there, do you want
to just talk briefly about the books that you have available and, you know, what ones you've
maybe wanted to call people's attention to?
There's, there's a lot of educators listening and also students I know.
So maybe both ends, they would appreciate hearing about what you guys have in this format at RuneScape.
Yeah.
Thanks.
So we have how to think like a computer scientist interactive edition.
And that's based on, I think the very, you know, very well known how to think like a computer
scientist book by Allen Downey and Jeff Elkinger and a couple of other people.
But I think Alan and Jeff were kind of the main authors on that.
And so that, that, that's been an open source textbook for, for quite a few years now.
And I'll just be forever indebted to them for, for doing that because it saved me from yet
again, having to write an introductory chapter about lists when I didn't want to do that ever
again.
So, so we took that, we took their open source textbook and made it interactive and added the
questions.
And, you know, over the years we've, we've added some of our own things to it and added
a couple of new chapters.
But so that, so that book has just has a great pedigree and has, and has proven itself over
the years as a, as a really solid textbook, not only for the college level, but also for
the high school level.
So we have that out there.
And then we have a data structures textbook, problem solving with algorithms and data structures
by Brad Miller and David Ranum.
Um, that that's published by Franklin Beadle, a publisher right out in, in, Oregon in
your neighborhood.
Oh yeah.
Um, and so, our publisher there was, was gracious enough when we approached him about
saying, Hey, we have this great idea to change the world.
We want to make textbooks interactive.
And we showed him kind of a proof of concept using the how to think book.
And he, he, immediately, Jim Lisey, our publisher immediately said, wow, that's
great.
Let's yeah.
You have my permission to, to take your book and put it online like that.
Oh, that's excellent.
Yeah.
So that's, and, and, you know, funnily enough, it's one of those great stories where we put
it online and the year after we put it online, we had our best year in, in royalties ever
from, from the paper book sales.
So that's the real, the real irony of open source sometimes, isn't it?
I mean, I work really close with MongoDB and the guys there and you know, that's a billion,
multi-billion dollar company and you can go to GitHub and get their product and just download
it for free.
I mean, it's amazing.
And you know, Red Hat and OpenStack and all sorts of stuff is, is, is really sort of paradoxical
or in, in the sense you would think giving it away would be a problem, but in fact, it's
actually the thing that makes it catch fire.
And then I have a little book called Java for Python programmers, which is just a short
little book on making the transition from, from Python to Java.
And then we've got, we've got a couple of other, several other books actually.
One of them written by, by my friend, Paul Resnick at the university of Michigan called
programming programs, information, and people.
We call it the pip book.
And that's part of their information science program at the university of Michigan.
That's written using the runestone tools and is now freely,
freely available.
Um, Mark Guzdial at Georgia tech has written a book for, for high school computer science
instructors as part of the APs, as part of the new AP programming class called, what
is it?
Computer.
Uh, look it up.
So it's, it's, it's not Java based.
It's Lang.
What it, what the cool thing about it is it's kind of language agnostic.
So it's a CS principles, sorry.
CS principles is the name of the course.
Excellent.
It's the new course by the, by the AP.
And so Mark has written a textbook just for instructors about how to teach that course.
And then this fall, he'll also be coming out with the student book for that.
The, the, and both of those are based on the runestone tools.
Yeah.
So it sounds like you guys are really building quite a platform for the teaching going forward.
Yeah.
That's what, that's what we hope.
And you know, the more people that do this, it's always one of those crazy, exciting things
when you find somebody on the other side of the world or in someplace else that's suddenly
translated your textbook into Russian or Czech or some other language and is, and is using
your tools to write a book that you never thought of.
Yeah.
That's amazing.
It's, it's really gratifying.
I'm sure.
Yeah.
Brad, I think that's, that might be a good place to wrap it up.
Final thoughts, favorite editor.
Uh, favorite editor, right?
Uh, PyCharm.
Pie charm.
Oh, right on.
Do you use that in your class?
I do.
Yep.
Yeah.
We, we, we stay in the browser for about half the class and then we transition to PyCharm.
So that's cool.
Have you tried their PyCharm education edition?
Uh, I have messed around with it a little bit.
Yeah.
I looked at it.
It's interesting because it kind of guides you through like it's sort of handholding a little
bit in a sense, but I haven't done anything with it either.
Yeah.
All right.
Awesome.
Yeah.
That's the one I use as well.
I love pie.
Charm.
Um, favorite PI package.
Oh, I Python.
Yeah.
I Python is so good.
Yeah.
I use it in all my upper level classes now.
It's so, it's such a great teaching tool that way.
Oh, I bet it is.
I hadn't even really considered sort of the, here's the thing I can give the student component
of it.
Yeah.
I mean, for making class notes, it's, it's really, it's really awesome.
And now with this, you know, with this new, Jupyter integration, you know, I'm, that's
one of my little projects is to get a Jupyter server running on, on one of our servers on
campus here.
Yeah.
So that people can just access it.
So the whole I Python thing will break out of being just Python.
Not that that's terrible, but it'll let it grow significantly.
Right?
Yeah.
Yep.
Awesome.
All right.
Anything you want to, we didn't talk about, you want to let people know some links you want
to give people, things like that.
Yeah.
I would just say if anybody wants to give, if anybody wants to give Sculpt a try or experience
Python in the browser, there's another group of guys that I worked together with very
closely at trinket.io.
Um, and they have this, they're actually a little startup out on the East coast and, yeah,
trinket.io, you could write Python programs right in your browser, save them, share them,
uh, email them to your friends.
Um, so it's, it's also a great way for doing Python in the browser.
So I just wanted to give a, give a shout out to the, to the guys at trinket because they've
been very super helpful in, in keeping the Sculpt project.
Oh, cool.
Yeah.
It's a little bit like, JS Fiddle, but for Python.
Yeah.
I think.
Yeah.
That's cool.
Very nice.
Anything else?
I think we've hit it.
Yeah.
All right, Brad, this has been super interesting.
I really love to sort of see how Python is making its way into education and.
Yeah.
It's really gratifying.
What you're doing over.
Yeah.
Runestone is very cool.
So people should check it out at interactivepython.org.
Yep.
Definitely.
All right.
Thanks for being on the show.
Thanks for having me.
This was a lot of fun.
Yeah, it sure was.
See you later.
This has been another episode of Talk Python to Me.
Today's guest was Brad Miller.
And this episode has been sponsored by Hired and CodeShip.
Thank you guys for supporting the show.
Thank you.
Hired wants to be here.
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.
CodeShip wants you to always keep shipping.
Check them out at codeship.com and thank them on Twitter via at CodeShip.
Don't forget the discount code for listeners.
It's easy.
Talk Python, all caps, no spaces.
You can find the links from the show at talkpythontome.com slash episodes slash show slash 20.
And while you're there, be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be the number one hit right at the top.
You can also find the iTunes and direct RSS feeds in the footer of the website.
Our theme music is Developers, Developers, Developers by Corey Smith, who goes by Smix.
You can hear his entire song on our website.
This is your host, Michael Kennedy.
Thanks for listening.
Smix takes us out of here.
Staying with my voice.
There's no norm that I can feel within.
Haven't been sleeping.
I've been using lots of rest.
I'll pass the mic back to who rocked it best.
Developers, Developers, Developers, Developers, Developers, Developers.
Developers, Developers, Developers, Developers, Developers, Developers, Developers.
.
Thank you.