This repository contains a collection of tools to simplify working with Moodle quizzes.
make-questions: Generate Moodle quiz questions from simple YAML documents to minimize the use of the web interface.analyze-results: Analyze the results of a Moodle quiz to improve question quality.
moodle-tools is distributed as a Python package.
You can install it from PyPI using pip:
pip install moodle-toolsEither clone the repository:
git clone https://git.tu-berlin.de/dima/moodle-tools
cd moodle-tools
python3 -m venv venv
source venv/bin/activate
pip install .Or directly install it from GitLab:
pip install git+https://git.tu-berlin.de/dima/moodle-toolsSpecialized question types that require additional dependencies are not installed by
default. To use them, you need to install the respective dependency group with
pip install "moodle-tools[GROUPNAME]". The following groups are available:
isda: Adds support forCoderunnerDDLQuestion,CoderunnerDQLQuestion, andCoderunnerStreamingQuestionquestions.
For example, to install the isda questions execute:
pip install "moodle-tools[isda]"Once installed, you can access the tools as Python modules or via their command line interface.
from moodle_tools import make_questions, analyze_resultsmake-questions -h
analyze-results -hThe API documentation of
moodle-tools is hosted on GitLab pages.
If you want to contribute a bug fix or feature to moodle-tools, please open an issue
first to ensure that your intended contribution aligns with the project.
Different to a user installation, you also need to install the dev requirements and
activate pre-commit in your copy of the repository before making a commit.
# Activate your virtual environment first
pip install -e ".[dev]"
pre-commit installThe source code for Moodle's XML parser is located here in case we need to reverse engineer behavior changes.