Development update: November 2021

Here’s an update on Numbas development, covering July to November 2021.

I’ve been working on a big update to the Numbas LTI provider, which is pretty much ready but I’d like to test on a few different systems before recommending everyone upgrades.

Other notable additions recently include autocompletion in the editor when writing JME expressions, and variables are automatically added to the Variables tab after you write a reference to them anywhere in the question. These changes should make writing questions quite a bit easier, especially for new authors!

Numbas runtime

I’ve tagged v6.1 of the Numbas runtime on GitHub.


  • There’s now a weighted_random JME function which selects randomly from a list of weighted outcomes. Thanks to Kalpit F for adding this! (issue, documentation)
  • There are now functions for converting numbers to and from non-decimal base representations. There are named functions for binary, octal and hexadecimal, and generic functions for any other base. (documentation)
  • I’ve added a CITATION.cff file to the repository. CITATION.cff files are supposed to make it easier to cite open-source software. (info)
  • Working towards allowing part types which require asynchronous evaluation, Question and Part objects now have an events object which can be used to react to certain things happening repeatedly, such as storing answers. (code)
  • CustomPartType objects now have an input_types dictionary which extensions can add to. We’re using this to add a code editor input type in an extension which hasn’t been published yet. (code)
  • There are two new annotations for the $n pattern in the pattern-matcher: nonzero and nonone. Thanks to odavarci for adding this! (issue, documentation)
  • The Dutch/Nederlands translation is now complete! Thanks to everyone who contributed.


  • The feedback for gap-fill parts doesn’t show the header for gaps that have no feedback. (code)
  • The cast method for number to decimal aims for 15 decimal places instead of 14. When working out the fraction to display as the correct answer to a number entry part when the min/max values are numbers instead of decimals, the less-precise rational approximation routine is used, so that floating-point error doesn’t produce the wrong fraction. (code)
  • The compiler uses the Python html5lib package to parse HTML instead of treating it as XML. (code)
  • The zip files produced by the compiler are now compressed! (code)
  • The results page shows the list of questions in menu mode. This is needed when reviewing an attempt. (code)
  • Questions now have a "revealed" signal which is triggered when the correct answers and advice are revealed. (code)


  • The “allow students to print exam content” option was being interpreted the wrong way round. (code)
  • Fixed typos in the code to render set and list values as TeX introduced in v6.0. (code)
  • External variables used in custom JME functions are now detected. (issue)
  • Numbas.jme.Scope.setConstant makes a copy of the data it’s given, avoiding accidental global scope. (code)
  • Distractor messages in multiple response parts can substitute in HTML. (code)
  • Fixed a bug to do with resuming explore mode questions. (code)
  • The routine to infer the type of an expression deals with the custom constants introduced in v6.0. (issue)
  • The stateful scope used for marking algorithms deals with the case where it’s not the direct parent of the one used for evaluation. (code)
  • Multiple response parts deal with null or undefined values being stored as answers. (code)
  • Fixed a bug in loading the order of questions when “shuffle question groups” is turned on. (code)

Numbas editor

I’ve tagged v6.1 of the Numbas editor on GitHub.


Autocompletion in the variable editor, and automatically adding new variables after you refer to them.
  • The JME editor now offers autocompletion suggestions, which pop up as you type. The suggestions are drawn from functions, variables and constants available in the question. For built-in functions, there’s a link to the documentation. The built-in functions are all tagged with key words, so you should be able to find the function you want by making a guess at its name. (code)
  • When you refer to an undefined variable anywhere in a question, it’s automatically added to Variables tab. I think this makes writing new questions easier: you can write out the content areas and part settings as if variables exist, and then go to the variables tab to define them. This will also make it clear when there’s a reference to an accidentally undefined variable, due to renaming or typos. (issue)
  • You can give other users access to your custom part types. (issue)


  • Anyone with editing access can see the settings page for a theme or extension. Previously only the author could do this. (code)
  • The “themes” and “extensions” pages on your profile now list themes and extensions that you’ve been given access to. (code)



  • Fixed loading variables defined as “random number from a range”. (code)
  • Fixed the error message when using a reserved name in the custom part type editor. (code)
  • In diagnostic mode exams, there’s now a button to delete learning objectives. (code)
  • When reassigning content belonging to a deactivated user to someone else, all their accesses are also reassigned. (code)

Numbas LTI provider

As I said above, v3.0 is a big update. The LTI provider relies on several third-party Python packages, and we’d got stuck on old versions of a couple of packages which prevented upgrading many others. I’ve refactored a lot of the code so that it’s now using the latest version of every package, and I’ve taken the opportunity to work through a lot of the to-do list. Because of the breadth of changes made, I consider this version a “breaking change”, and I’d like to test it thoroughly before recommending everyone upgrades. I’m aiming to have it ready by the start of December, in time for the upgrade window that many institutions have over the Christmas holiday.

The documentation has moved to Documentation for each version is stored separately: v2.13.4 documentation and in-progress v3.0 documentation.

There is a testing branch v3-upgrade which you can use if you want to try the new version, and I’ve tagged v2.13.4 on GitHub with the latest bug fixes.

I’ll describe the minor changes since the last development update up to v2.13.4 below.

See the upgrade instructions for v2.13.4.


  • The date picker widget always uses YYYY-MM-DD format. (issue)
  • Cope with the EMAIL_COMPLETION_RECEIPTS setting not being set. (code)
  • Deal with old exam packages which don’t have a manifest file. (code)
  • When starting a new attempt provided by an access change, it no longer tries to delete an access token that doesn’t exist. (issue)
  • To get around a timing issue which led to out-of-date scores being reported back to the consumer, the score reporter now waits a moment after being called. In v3.0 this will work better. (issue)
  • There was a rare race condition that could cause the diffing process for attempt SCORM data to go wrong. I’ve added a check to stop this happening, and a check to catch old attempts that have already had this problem. (issue)


  • The installation instructions used to say to set LOCALE = 'en-us'. It should be LANGUAGE_CODE = 'en'. Thanks to Soputtra San for noticing that!