[Fragment] Jupyter Notebooks and Moodle

Via a comment, Ger Tielemans alerted me to the SageCell filter for Moodle that lets you embed an executable code cell powered by Sage Cell Server, which was also new to me, in a Moodle content page.

From what I can tell, Sage Cell Server provides a stateless was of executing SageMath, R or Python code.

This contrasts with approaches such as Thebelab (e.g. as described in Using ThebeLab to Run Python Code Embedded in HTML Via A Jupyter Kernel), which will connect all the cells in a web page to the same Jupyter kernel, and as such allow state to be shared between them.

It also strikes me that ScriptedForms provide another possible way of accessing Jupyter/python executable code from a frame embed.

So now I’m wondering – might the SageCell filter for Moodle provide a basis for a Thebelab filter for Moodle?

The comment also prompted me to look around for other Moodle’n’Jupyter integrations.

We have an auth hack for running temporary notebooks via Jupyterhub in which students who are logged in to the Moodle VLE are presented with a URL containing a secret than can be used to log them in to a notebook launching Jupyterhub server running on Azure/Kubernetes. This uses some sort of Moodle plugin for adding the secret token, I think? (Note to self: find out how this works and what the Moodle plugin is! Rod….????!)

I was reminded of another weak integration we have with OU learning environments and Jupyter notebooks in a reply posting to the Moodle forums by Mark Johnson on Moodle integration with Jupyter notebooks. OpenDesign Studio, which allows students to upload and comment on media objects, has a plugin that allows students to upload and view Jupyter notebooks as a media asset. As I replied to the thread:

The OpenStudio plugin requires users to upload a zip file with an `.nbk` suffix that contains the notebook `.ipynb` file and an HTML export view of it; (the html view can be a bit ropey eg if the notebook has run output cells that originally contained IFrames). A crude notebook extension provides a toolbar button to create the `.nbk` package that uses `nbconvert html_embed` filter to generate the html.

The original proposal was for an OpenStudio plugin architecture that would allow .ipynb to be uploaded and then rendered back to users of OpenStudio using nbviewer. That was blocked, presumably on grounds of complexity, available project time/resource and maybe also security…

One other code related thing we have running in Moodle is Moodle CodeRunner. I think I’d originally hassled for this to be installed in a demo server when Tim Hunt had originally mentioned it to me, though part of me wishes I hadn’t! The plugin adds simple code testing to Moodle quizzes, so students can enter code which is then executed and checked against a test.

As to why I don’t like it: I think that because we have Moodle CodeRunner installed, it will act as a blocker to exploring any ways in which we might look at code runners that run using Jupyter protocols against Jupyter kernels. I don’t know if CodeRunner can be tweaked to run against such kernels, or otherwise patched to become a Jupyter client?

One of the things that concerns me about CodeRunner is what happens if we want to assess students on code that requires packages (either python packages, or operating system packages they call on) that are preinstalled as part of the computing environment we give students?

Other issues arise if we want to test students more widely, for example if we wanted to test students’ ability to use python to query, or even update, a linked database such as the one we install in the TM351 VM?

What would be nice if we could containerise a student computing environment and then use that as the back end to an automated tester eg running something like Thebelab or perhaps better, a variant of something like the stateless Sage Cell Server.

One thing that is still on my to do list is to explore nbgrader as a tool for annotating assessment notebooks and providing a means for ALs to manually mark and comment on them. (I note that as well as supporting automated tests with nbgrader, Jess Hamrick also started to look at tools to support the automated marking of matplotlib charts: jhamrick/plotchecker. I guess another way would be to use automated testing tools like Selenium to render charts and then test them, but this would presumably on work for exact image / hash matches only?

Unfortunately, I haven’t been able to get nbgrader to work with my standalone notebook server – the formgrader isn’t found. I need to return to this when I get a chance (unless some has working babystep instructions for getting nbgrader running with a standalone Jupyter notebook server?)

PS as far as integrations with other learning environemnts go, I note the Open edX Jupyter Notebook Viewer that lets you “fetch and display part of, or an entire Jupyter Notebook in an XBlock“.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s