Summary
Learning to program is a rewarding pursuit, but is often challenging. One of the roadblocks on the way to proficiency is getting a development environment installed and configured. In order to simplify that process Aivar Annamaa built Thonny, a Python IDE designed for beginning programmers. In this episode he discusses his initial motivations for starting Thonny and how it helps newcomers to Python learn and understand how to write software.
Preface
- Hello and welcome to Podcast.__init__, the podcast about Python and the people who make it great.
- When you’re ready to launch your next app you’ll need somewhere to deploy it, so check out Linode. With private networking, shared block storage, node balancers, and a 40Gbit network, all controlled by a brand new API you’ve got everything you need to scale up. Go to podcastinit.com/linode to get a $20 credit and launch a new server in under a minute.
- For complete visibility into your application stack, deployment tracking, and powerful alerting, DataDog has got you covered. With their monitoring, metrics, and log collection agent, including extensive integrations and distributed tracing, you’ll have everything you need to find and fix bugs in no time. Go to podcastinit.com/datadog today to start your free 14 day trial and get a sweet new T-Shirt.
- To get worry-free releases download GoCD, the open source continous delivery server built by Thoughworks. You can use their pipeline modeling and value stream map to build, control and monitor every step from commit to deployment in one place. Go to podcastinit.com/gocd to learn more about their professional support services and enterprise add-ons.
- Visit podcastinit.com to subscribe to the show, sign up for the newsletter, and read the show notes.
- Your host as usual is Tobias Macey and today I’m interviewing Aivar Annamaa about Thonny, a Python IDE for beginning programmers
Interview
- Introductions
- How did you get introduced to Python?
- What was your motivation for building an IDE focused on beginning programmers?
- What are the features of Thonny that make it easier for users to understand what is happening in their programs?
- What have you found to be the types of issues that users most frequently struggle with and how does Thonny help overcome those gaps in understanding?
- What kinds of tutorials or supporting material have you found to be the most useful for teaching students the principles that they need to be able to take advantage of the environment that Thonny provides?
- How is Thonny built and what have been the most challenging aspects of writing an IDE in Python?
- What are some of the interface design choices that you have made to avoid confusing or overwhelming beginning users?
- Once a user becomes more proficient in Python is there a point where it no longer makes sense to continue using Thonny for development?
- I noticed that Thonny has an plugin architecture and there is an extension for interacting with the BBC micro:bit. What are some of the other types of extensions that you would like to see built for Thonny?
Keep In Touch
- Aivar
- @aivarannamaa on Twitter
- aivarannamaa on GitHub
- Google Scholar Page
- Thonny
- Website
- Forum
- @thonnyide on Twitter
- Source repository and wiki
Picks
- Tobias
- Aivar
Links
- Thonny
- University of Tartu
- Estonia
- Recursion
- TKinter
- Aivar Estonian Textbook
- Pascal
- MyPy
- BBC Micro:bit
- Version Control
- GitHub
- GitLab
- Elm Compiler Messages
The intro and outro music is from Requiem for a Fish The Freak Fandango Orchestra / CC BY-SA
Hello, and welcome to podcast.init, the podcast about Python and the people who make it great. When you're ready to launch your next app, you'll need somewhere to deploy it, so you should check out Linode. With private networking, shared block storage, node balancers, and a 40 gigabit network, all controlled by a brand new API, you get everything you need to scale. Go to podcastinit.com/lino to get a $20 credit and launch a new server in under a minute. For complete visibility into your application stack, deployment tracking, and powerful alerting, Datadog has got you covered. With their monitoring, metrics, and log collection agent, including extensive integration and distributed tracing, you'll have everything you need to find and fix bugs in no time. Go to podcast then it.com/datadog today to start your free 14 day trial and get a sweet new t shirt.
And to get worry free releases, download Go CD, the open source continuous delivery server built by Thoughtworks. You can use their pipeline modeling and value stream app to build, control, and monitor every step from commit to deployment in 1 place. Go to podcastthenit.com/gocd to learn more about their professional support services and enterprise add ons. And visit podcastthenit.com to subscribe to the show, sign up for the newsletter, and read the show notes. Your host as usual is Tobias Macy, and today, I'm interviewing Haivar Anamah about Thonny, a Python IDE for beginning programmers.
So Haivar, could you start by introducing yourself?
[00:01:32] Unknown:
Hi. As you said, my name is Ivar. I am a teaching assistant in University of Tartu, Estonia. I have a wife, 2 kids, and I have Tony. So this is pretty much my life at the moment.
[00:01:50] Unknown:
And do you remember how you first got introduced to Python?
[00:01:53] Unknown:
Yes. I think I get it correct that 10 years ago I entered, Computer Science PhD program in in my university. And as a PhD student I was supposed to do some teaching. So, I chose to teach the labs, in the in our first programming course which, used, and still uses, Python. So, basically, I my first, serious work with Python was as a Python teacher.
[00:02:32] Unknown:
And, as we mentioned at the open, 1 of the projects that you're heavily involved with is Thonny, which is, an IDE for that that focuses on making it easier for beginning programmers to have a working development environment. So I'm wondering if you can talk about your motivation for building that project.
[00:02:51] Unknown:
Alright. So initially, I had a much more, narrow goal. When I was teaching, recursion in my labs, I noticed that, too many students struggled because they had in their heads, an, oversimplified model about function calls. They seem to think that the function call, it, means simply a jump from the call site to the definition site, and then, somehow magically back again. In in some simple cases, this my model kind of works. But, when you add arguments, local variables, return values, and, recursion, then it becomes really messy. So my solution was to explicitly talk about the concept of the stack frame and, used to, draw it on the blackboard several times.
And when I got fed up with this then I realized I need a tool which, makes this visualization for me. So this was the beginning of the journey actually. So it was not planned as full featured IDE actually.
[00:04:10] Unknown:
And you mentioned 1 of the features is that visualization of the recursion stack and how the function actually ends up calling itself so that users can get a better visual understanding of what's actually happening. And I'm wondering if you can list some of the other features that you have added in over time that make it easier for users to understand what's happening in the context of their programs.
[00:04:33] Unknown:
Well, the most important features are everything, yeah, as you said, everything which, uncovers what happens during the program run time. So in other words, everything related to stepping, through the program. Well, most IDEs, can step through the program, but I believe Tony has, managed to to make it more approachable and, more meaningful for beginners. First, Thonny doesn't require the user to set up, any breakpoints. The user doesn't need to know about breakpoints at all. You just run the program with a special command and then start pressing certain key until you reach the end of the program. That's it.
That's, in my opinion, enough for, total beginners. Okay. If the programs get larger, this, stepping with small step or stepping, through the whole program becomes, really tedious. And because of this, I plan to add, proper breakpoints as an optional feature in the future. So it's easier to get started with stepping with, Thonny. 2nd, I think it's important that, Thonny's debugger, follows programs' logical structure, not just code lines as traditional debuggers. So for example, you can step over a whole while statement, or on the other hand step into the smallest subexpression in your program.
So the granularity of the stepping is, dependent on the program structure, not on the textual textual, format of the code. And, I think this offers more flexibility. But, maybe even more importantly, this provides, good opportunity or good support for explaining, Python syntax or the statical structure of the program. When you see how the, debugger focuses 1 or the other part of the code. And as we also already mentioned, the visualization of the call frames, I think this is the feature I'm most proud of in Fanny. Beside of this, if you leave the program flow aside, you can that would also bring out the this special mode for explaining Python memory model. If you select from the View menu an item called heap, then you see that the variable table only maps variable names to addresses and values or objects themselves are living elsewhere.
So Tony shows you another table called heap which, maps, addresses to the actual values. So, I think this is quite useful useful feature for explain explaining mutation and, references. Yeah. I think these are the most important features in phoneme.
[00:07:58] Unknown:
And it sounds like there are a number of very sort of advanced aspects of the program that you've built in order to present some of these concepts in a much simpler manner for your users. I'm wondering what you found to be the most challenging pieces of actually building Thonny to create that simpler view for people who are just beginning to get started and not overwhelm them with too much information?
[00:08:23] Unknown:
Fortunately, Python has been really forthcoming. Because of its, dynamic nature and because, for example, it has, Python parser in the standard library and it has this wonderful inspect module which allows me to check the state of, current, stack frames. So I think the most complex questions were solved several years ago so I have forgotten most of it. Yeah. I think that, well, maybe I start by explaining that, how, how Phony Phony works. So it, it works in 2 operating system processes. 1 for the GUI and the back end process for running the user program and and the tracing or debugging mechanism.
The GUI is this is written in Tkinter and, although many people think this framework is old fashioned and looks ugly then actually the newer versions of it look quite pretty and I've grown to like it like it a lot. And the back end, the the most important idea in this in implementing the debugger is that I don't give Python virtual machine the original user program. So in order to gain more information about the the process of running the code, I modified a program before sending it before running it. So basically Tony parses, user code and then inserts special, function calls to it, special markers.
And these calls, let the bugler know, for example, which subexpression is going to be executed next and what was the value and, the address of the last expression value, etcetera. So Tony is Tony's debugger, uses instrumented code. It will this was the key. This choice, brings along an unfortunate aspect that the debugger is quite inefficient. So if you run a larger program and want to step over a large part of the code then it happens quite slowly. But, Stone is clearly designed and meant for beginners. For this reason I can assume that the programs are not too big. So it's not a too big problem at the moment.
[00:11:16] Unknown:
And as users are first getting introduced to programming and the Python language, I'm wondering if there are any particular kinds of tutorials or supporting material that you found to be the most useful for getting students up to speed on the principles that they need to be able to actually start writing programs and using Phonni to iterate through them? In the similar fashion that I didn't find a good tool for
[00:11:43] Unknown:
for explaining or for visualizing the stack frames and the code stack. I wasn't happy with the Estonian language materials meant for teaching Python for beginners. So, actually, I wrote my own textbook, web based textbook. And, yeah. I think this is the material, material I am most happy with regarding programmers. And I I'm not sure I can outline what have been my principles in writing this textbook. I think I managed to strike good balance on, precision and and avoiding unnecessary formalities. So that's what I was aiming in Tony as well To make the interface or the visualizations intuitive but, at the same time not oversimplified.
[00:12:46] Unknown:
And in terms of the programming environment that Thonny presents, I actually installed it and experimented with it a little bit on a program that I was trying to debug and I was pleased by the lack of visual clutter in the overall environment which can be something that plagues some of the more advanced IDEs. So I'm wondering what types of design decisions you were faced with and what you were aiming for as you were building the UI for users to ensure that there weren't too many options that would confuse or overwhelm the users as they were first getting started?
[00:13:22] Unknown:
User interface design have has been interesting for me for a long time and I always aimed for, user interfaces which are as clear as possible. So in this sense, the work with Tony was not special for me. I guess a couple of times I have for example, I have considered adding, a toolbar over the rebel or the shell pane in addition to the main toolbar. But I have just resisted the search and chose the the clear look of the of the shell pane. Yeah. I guess you just need to give up some of your wishes when you want to maintain this clear appearance or find another way.
I have used menus quite, quite a lot so I think menus are something that that because they are hidden initially, then they are not intimidating for the pec beginner user.
[00:14:29] Unknown:
Yeah. I think that gives a lot of sort of progressive exposure where the user can first just open up the program and start writing something. Yeah. And as they find that they need some additional functionality, they can then go searching through the menus to find it and then enhance their overall capabilities with the tool.
[00:14:47] Unknown:
Mhmm. And that was also the reason why I chose not to show the variables, panel, by default. So I expect that when the students goes to her first lesson then she starts with just running a program and then the instruct instructor tells, no students select the view menu and open up the variables pane. So it's makes the process more gradual.
[00:15:21] Unknown:
And in terms of auto completion, have you found that to be a useful feature as people are first getting started? Or do you think that it adds too much confusion when somebody might start typing a variable name or a library function and have it give them that list of options?
[00:15:37] Unknown:
At the moment, Tony does, support auto completion, but only the user need to explicitly invoke it with the control spacebar or with the tab. And I think I will keep it I will keep this as default because, yes, I think it might be confusing for total beginners if something just, pops up. And as the users become more proficient
[00:16:02] Unknown:
in using Python and programming logic and start building more complicated applications, is there a point where it no longer makes sense to continue using Thonny? Or does it grow with their experience so that they can use it once they start using it in a more professional context?
[00:16:19] Unknown:
Yeah. I think this, point, will arrive because, I have no intentions to, compete with PyCharm or other professional, Python IDs in terms of, let's say, program refactorings or the level of, programmer analysis. So I need to maintain the scope and, yeah. I think when a student has learned the semantics of, required programming concepts and when the programs grow bigger and, he or she will benefit more from the good auto completion and comfortable refactorings, then if she is really wise to abandon Toni and use something heavier instead. In terms of introducing people to the concept
[00:17:09] Unknown:
of programming in general, how have you found Python for being the first language and have you worked with any other languages for the introductory material to have any sort of comparison?
[00:17:22] Unknown:
I like I think, Python is a pretty good language, pretty good, first language. Myself, I was using Pascal as a first language when I was learning programming. Sometimes I do regret that, Python doesn't have static types as they were in Pascal. Because occasionally I see that, students that the dynamic typing of the of Python allows students to or I don't know what it allows or invites students to be less precise in their thinking. Something that, static languages really punish, quickly. If you don't understand what will be in your variable, then you will write the wrong, type annotation.
In Python, I quite often see that the student even gets the program, working correctly. But when I ask him, what kind of, values can be in this particular variable, he's unable to answer this question. And I think this is the place where static, languages have an advantage. But, on the other hand Python of course has the advantage of, enabling people to do complex stuff faster than many other languages. So it's not a
[00:18:47] Unknown:
clear clear answer whether it's a perfect language for for beginners or not. And are there any any other kinds of bad habits that you feel that Python invites users to develop when they're learning or any other pitfalls that you see students falling into on a somewhat frequent basis as they're beginning to start programming with Python?
[00:19:08] Unknown:
At the moment, nothing else, comes to my mind. At least, not anything which is which, stems from the language. So in fact I have been planning to experiment with this, mypy project which allows, Python to be used kind of a static static way. So we'll see whether it is whether I can make some exercises for students where they are forced to annotate their variables. So with this, support, maybe it's possible to get rid of even even this this problem. But I don't see any other obstacles caused by the Python language
[00:19:50] Unknown:
when they are regarding learning to program. And as I was reading through the documentation, I noticed the fact that Bonnie has a plug in architecture and that there's currently an extension that was written for interacting with the BBC micro:bit, which is a hardware module that was introduced in classrooms in the United Kingdom for introducing students to concepts of programming and hardware interfaces. So I'm wondering if there are any other types of extensions that you would like to see built for Thonny or if you have any thoughts or interaction with the, creator of that micro:bit extension. Actually, the creator of this extension is a student
[00:20:28] Unknown:
student of mine. So it was his bachelor thesis part of his bachelor thesis and I was his supervisor. So I have been quite closely connected to this project. The plug in system is quite flexible. Actually, most of the functionality in Toni, actually, even including the user interface part of the debugger is, implemented as a plug in. So in this sense, I could rephrase your question that what I wish, people would build into Tony, whether by a a plug in or by just directly, contributing to Tony's code. Yeah. I have some plans for, extensions myself. But if I'm thinking about the extensions, I wish Tony would have, but I but I have don't have time for this myself. And I wish Tony has a tutorial or exercise system. Something like which would work like this.
An instructor, writes down a tutorial or exercise, for example, also with, automatic tests, let's say, in restructured text format, uploads it, to GitHub and Thon is able to download the specification and, display it in a separate, panel, in a side panel so that the student can see the exercise definition and his code at the same time. And the system is able to test a user's code against these specifications. This is sometimes something that I planned to do but I haven't had time for this. So if somebody else wishes to do this I would be really happy. Also I'm, thinking that it would be nice if Tony had a basic or simplified support for version control. So that you could open files from GitHub and save them back to GitHub.
I've missed, these features, in a classroom where the students didn't have their own, accounts in the class in the lab, computers. So some of them did have USB sticks with them. Some of them have had forgotten them. So it was quite messy. So it would be really nice if it's possible to save save your work into cloud or let's say into GitHub with Thonny. Also, in the next version of Thonny I hope to have completed a system for defining, visual themes. And when this is ready ready, I expect people to contribute new themes to Tony. Yeah. But, mostly I I wish that people just or I expect that people are extending Tony in ways that I don't
[00:23:23] Unknown:
anticipate at the moment, implementing features that I haven't thought of. And so for anybody who does want to experiment with Thonny or contribute back to it, I'll make sure to add the link to the project repository in the show notes. Are there any other topics that we didn't discuss yet that you think we should cover whether in the context of beginning programmers or introduction to the Python language or the Thonny project in particular?
[00:23:48] Unknown:
I think I have, spoken, about all the most important topics for me. Yeah. About the the future plans and also, yeah, to release maybe to previous question about the extends extending Tony. There's 1, at the moment, Tony will help people to, learn the semantics of their program or semantics of their program constructs. But, total beginners, in 1st weeks, their most urgent or most frustrating problems are syntax errors. And at the moment, Honey doesn't, offer any support for this. So, I plan to add, some support myself. For example, if while statement is missing a colon, then Tony could tell the user that you are missing a colon here. Not that you are having a syntax error here. But, I think these kinds of, support is something that, can come from, many contributors.
Like, there might be different problems that, different, instructors perceive. And it would be really good if we could collaborate and, get get the best, support for programming errors also into Toni.
[00:25:09] Unknown:
Yeah. I can definitely agree that cryptic error messages can be rather off putting, especially as you're first getting started and linting can occasionally help with that where you can see before you try to run the program that the syntax isn't, correct or that the structure isn't sort of meeting the general community best practices, but oftentimes even those messages aren't structured in a way that are easy to understand. And so I know that a lot of other language communities, particularly things like Elm and Elixir have put in a lot of effort to make sure that their compiler messages are very descriptive and helpful and provide references to additional documentation that will help people with understanding where the source of their error happens. So I think that having that similar functionality within Thonny or even, any, you know, Python linter would be very valuable to beginning programmers.
[00:26:02] Unknown:
For example, in recent weeks, I have, met several students who were pulling their hair because they were, let's say, they were writing a program with Python turtle and they named their program turtle. Py. And they were wondering why their program doesn't work. So it's quite easy to support to to give a proper and helpful error message in these cases.
[00:26:33] Unknown:
Well, for anybody who wants to follow the work that you're up to or get in touch about the work you're doing, either in Thonny or in your classroom, I'll have you add your preferred contact information to the show notes. And so with that, I'll move us on into the picks. And this week, I know that I've mentioned a few times in past episodes, just briefly that I have another podcast, but I'm going to call it out specifically that I have been, the past couple of months releasing weekly the data engineering podcast, which is focused on the challenges and technologies around modern data management and data engineering practices. So for anybody who is working in that space or curious about, any of the trends there, I definitely would appreciate you giving that a listen. And then my other pick this week is a movie that I watched over the weekend with my son called Kubo and the 2 strings. And it was just a very well done movie with very interesting animation style and a really well done story. So I highly recommend that. And so with that, I'll pass it to you. Do you have any picks for us this week?
[00:27:33] Unknown:
Yeah. I was thinking of, 2 items. So first is, MicroPython. I don't know how popular or how well known it is in the Python community but, we were already mentioning this, bbc microbit which is able to, run a really nice version of Python called MicroPython which invites Python programmers to the to the field of electronics or robotics. And myself also am quite fascinated about this field lately. I'm not expert in this field, but I find it very fun to play around with small microcontrollers supporting MicroPython. So I invite Python programmers to look up MicroPython and maybe buy a $10 board to play with.
Okay. And, another pick. I'm reading a book about children. It's called How to Talk so Kids Will Listen and How to Listen so Kids Will Talk. And if there is a parent who hasn't read it yet, then I definitely recommend it. It really gives different it might give you different, view on your on the problems of your kids or on your relationship with your kids.
[00:29:04] Unknown:
Alright. Well, thank you very much for taking the time today to talk to me about your work with Thonny and with teaching, beginning programmers. I definitely appreciate that and I'm planning on using Thonny to teach my own children how to program So thank you for your work on that and I hope you enjoy the rest of your day. Thank you.
Introduction to Haivar Anamah and Thonny
Motivation and Features of Thonny
Challenges in Building Thonny
Supporting Materials and Tutorials
Design Decisions for Thonny's UI
Thonny's Growth and Limitations
Python as a First Programming Language
Extensions and Plugins for Thonny
Future Plans for Thonny
Listener Picks and Recommendations