Load Magic for Python and a call to discuss how we deliver exercises to learners

How do you deliver exercises

This post describes a teaching tip I shared at CarpentryCon 2018 and how it thrust me into deeper Carpentries involvement. It also aims to start a larger conversation about how we deliver exercises in workshops and how the lesson infrastructure can better support instructors and learners.

Let’s talk about exercises

One challenge I had before my first workshop was figuring out how to deliver exercises to learners. I asked around, but when I thought about myself as a learner trying to do exercises based on the descriptions I got, I imagined being confused and distracted. I found the load magic of IPython/Jupyter notebook to give exercises to learners that enabled them to focus on the concepts I was teaching, not fumble with tools. I shared the idea at CarpentryCon, got great feedback, and have thought more about how we could update the infrastructure to support it over the past few months. In the Carpentries, teaching and learning come first, so before the lesson infrastructure committee implements changes, we wanted to get more feedback on the general approach, and how instructors are delivering and would like to deliver exercises. I wanted to share my path on how I got to this question, why I’m interested in addressing it, and start that conversation.

How do you deliver exercise content to learners? What formats (rendered html, language-specific script files, integration with a survey tool, etc.) would help you teach more effectively? Join the conversation on this issue on the lesson infrastructure repository.

How I used load magic

When I was preparing to teach my first workshop, I didn’t know logistically how to handle exercises. Instructor training had covered teaching thoroughly, but not the low level detail of how to tell the learners what the exercise is. I asked people how they do it at the introduction meeting for the instructors and host of that workshop and they shared a polling tool for multiple choice questions and said otherwise they show it on the screen or paste in the etherpad. I asked at my pre-workshop instructor discussion session and got the ‘copy and paste to etherpad’ answer again. I was afraid that a lot of context switching via flipping screens/tab to copy and paste or looking up and down between their computer and the projector would distract learners from the task at hand. I wanted to minimize the number of distractions, so the learners could focus on the exercises’ content. The exercises we provide are sometimes question-answering from memory, but quite often are programming exercises that require writing code, especially in the Python lesson I was about to teach.

I was planning to use a Jupyter notebook to teach. It’s a tool that I use in my daily research life, so I could contextualize it well for learners, and a good tool to reinforce the broader concepts of reproducible research. I guessed that the notebooks might have something that could support my goal here, since I knew they were used a lot in teaching and even have related grading tools. I found that cool features for the IPython kernel (what Jupyter notebooks in Python use for Python) that are installed by default are called magics. The %load magic reads in a file (or an excerpt of one) into a notebook cell for editing.

load magic animation

I decided to use this for the exercises of this workshop. As I went through the material to prepare for teaching, I also copied the exercises into separate .py files for this purpose. I set them all up in a separate GitHub repository that also had a data folder. Since GitHub also allows people to download a .zip of the repository, using GitHub to host it meant that I could keep the workflow that I’m comfortable with, including last minute updates, and still allow the learners to download a file type that they were already familiar with, since we were teaching Git after Python. I gave the learners a download link, had them unzip it, and launch the Jupyter Notebook from that directory. Then we could load an exercise with load code/keyword. I made a Jupyter notebook on how I used Git branches to give the learners an original download, updates on day two, and post workshop content.

I have now taught three full workshops this way (SWC-python-gapminder at UCSF, DC-python-socialsci at UC Berkeley and CarpentryConnectSZA) and mini workshop based on the Python Ecology Lesson with Kari Jordan where load magic enabled us to cover enough to be interesting in only 90 minutes. Using load magic to the exercises has worked well each time. The helpers and co-instructors, many of whom have more Carpentries experience than me, have found it to be a helpful way of delivering exercises. Getting used to some features of the notebooks tends to be a little hard at the beginning for the learners. A few activities were to enforce concepts more than actually writing code, so those were best formatted as markdown cells instead of Python cells, and switching cell types also caused some friction at the beginning. By the second half of the lesson though, most learners seem comfortable with these activities. They seem to like the notebooks, in addition to seeing that Python is powerful and I hope that the push to learn a little bit more about manipulating Jupyter notebooks makes using them in their own work more comfortable.

Starting a conversation

After Kari and I had the session at NSBE, she encouraged me to apply for a travel grant to attend CarpentryCon and I guessed that submitting an abstract would help my case, or at least justify using funds from my professional development budget at work. Also, I wanted to share this tip and consider updating the infrastructure, but I wasn’t yet sure how the community worked in order to get the proposal to the right people. I submitted an abstract to give a lightning talk on load magic as a teaching tip and present a poster on a proposal to update the infrastructure to better support this way of delivering exercises. I felt a bit of imposter syndrome, offering a tip on how to teach curriculum from an organization that was 20 years old when I had taught 1.125 workshops and suggesting to change infrastructure I had contributed to once in checkout, but everyone I had interacted with had told me it was a welcoming environment, so I did anyway.

My submission was accepted and I was awarded a travel grant to be able to attend CarpentryCon. After my lightning talk, I was invited to Johannesburg, South Africa for CarpentryConnect. At my poster, I was busy engaged in discussions and met François [Michonneau] and other members of the lesson infrastructure committee. My input was welcomed and people were excited about how we can use the technology we teach in more flexible ways and smooth the operations of a workshop. I was invited to join the lesson infrastructure committee and encouraged to submit a blog post about using load magic.

A conversation on exercises

Since I’ve joined the lesson infrastructure committee, we’ve discussed my proposal, how the Carpentries could make this trick more accessible, and how it would apply to lessons other than Python. We are considering changes to the infrastructure (styles repository) so that exercises can be rendered and exported in more flexible ways. With GitHub pages and the available automation support, we have a lot of powerful tools available that can make all sorts of things happen without changing the workflow for editing the content of the lessons much, if at all. Before we start adding widgets, however, we want to know more about how the lessons are and will be used. Central to the Carpentries mission is the in-person teaching; we want the lesson infrastructure to support instructors, welcome community content contributions, and be easy on maintainers more than we want to have cool features. We’ve started the discussion with the maintainers, but we still need input from the broader teaching community to refine our plan and determine a plan of action.

Our current plan is to support at least the following:

  • parsing out exercise files into individual files that can be used, for example with load magic or opened in RStudio as a fill-in-the-blank or pseudo-code-styled exercise;
  • a single page with all exercises for the lesson;
  • a page per exercise.

We look forward to a discussion and learning more about how instructors use the exercises currently and what they wish they could do, so again, I encourage you to join the conversation.


Community CarpentryCon Infrastructure Learners

Dialogue & Discussion