Sponsor:
LabQuiz is a Python package that allows to seamlessly integrate interactive quizzes directly into Jupyter notebooks β useful for labs, tutorials, practical assignments, continuous assessment, and controlled exams.
- ππΌ
Live versionTry it in binder !
It combines:
- β Multiple-choice and numerical questions
- π§© Template-based parameterized questions
- π Configurable number of attempts
- π‘ Hints and detailed feedback
- π Automatic scoring
- π Optional remote logging (Google Sheets)
- π Real-time monitoring dashboard (if logging)
- π Integrity checks and anti-tampering mechanisms
And it comes with two optional companion tools:
- βοΈ
quiz_editorβ Create, edit, encrypt, and export question banks streamlit app | src code - π
quiz_dashβ Monitor, correct, and analyze results in real time streamlit app | src code
flowchart LR
%% Nodes
A["YAML Quiz<br/>(Quiz-as-Code)"]
B["quiz_editor<br/>Authoring Interface<br/>(optional)"]
C["Jupyter Notebook<br/>+ Interactive Quizzes"]
D["Remote Backend<br/>(e.g., Google Sheets)"]
E["quiz_dash<br/>Monitoring Dashboard"]
F[Analytics]
G[Marks Table]
H[Student Reports]
I[Exports: <br/>Web-based Training Quizzes <br/>AMC / LaTeX Paper Quizzes]
%% Flows
B -.-> A
A ---> C
C -.-> D
D --> E
E --> F
E --> G
E --> H
A -.-> I
%% Styles
classDef authoring fill:#e3f2fd,stroke:#1e88e5,stroke-width:1px;
classDef runtime fill:#e8f5e9,stroke:#43a047,stroke-width:1px;
classDef backend fill:#fff3e0,stroke:#fb8c00,stroke-width:1px;
classDef dashboard fill:#f3e5f5,stroke:#8e24aa,stroke-width:1px;
classDef outputs fill:#fce4ec,stroke:#d81b60,stroke-width:1px;
classDef export fill:#e0f7fa,stroke:#00838f,stroke-width:1px;
%% Assign classes
class A,B authoring;
class C runtime;
class D backend;
class E dashboard;
class F,G,H outputs;
class I,J export;
Figure: Overview of the LabQuiz ecosystem. Dashed arrows indicate optional components. YAML quizzes drive both interactive notebooks and exports, monitored via a dashboard producing analytics, marks tables, and student reports.
Installation:
# From source
pip install git+https://github.com/jfbercher/labquiz.git
# or from PyPI
pip install labquizLabQuiz is designed for active learning and controlled assessment in computational notebooks.
It helps instructors:
- Increase student engagement with embedded exercises
- Provide structured feedback during lab sessions
- Monitor progress in real time
- Run controlled tests and exams
- Detect configuration tampering or integrity violations
It helps students:
- Learn through interaction and immediate feedback
- Track their progress
- Work within structured assessment modes
Inside your notebook, you can:
- β
Add multiple-choice questions (
mcq) - π’ Add numerical questions with tolerance (
numeric) - π§© Create parameterized template questions
- π Limit attempts
- π‘ Provide hints and corrections
- π Compute automatic scores
- π Log all activity to a Google Sheet backend (optional)
- π Enable exam mode with integrity checks
Example:
from labquiz import QuizLab
quiz = QuizLab(URL, "my_quiz.yml", retries=2, exam_mode=False)
quiz.show("quiz1")LabQuiz supports four types:
| Type | Description |
|---|---|
mcq |
Standard multiple-choice |
numeric |
Numerical answers with tolerance |
mcq-template |
Context-dependent MCQ |
numeric-template |
Context-dependent numerical questions |
Template questions allow dynamic evaluation based on runtime variables β ideal for practical lab computations.
Example:
quiz.show("quiz54", a=res1, b=res2)Variables can also be generated dynamically
quiz.show("quiz54", autovars=True)The expected solution is dynamically computed using Python expressions.
LabQuiz supports three pedagogical modes:
- Learning mode (hints + correction available, score display)
- Test mode (limited attempts, score display but no correction)
- Exam mode (no feedback, secure logging)
Quizzes are defined in simple YAML format and support
- Logical constraints (XOR, IMPLY, SAME, IMPLYFALSE)
- Bonuses and penalties
- Relative and absolute tolerances
- Variable generation for templates
All data can be stored in a Google Sheet backend.
LabQuiz can log: Validation events, Parameters, User answers, Integrity hashes... LabQuiz also includes multiple anti-cheating mechanisms (Machine fingerprinting, Source hash verification, Detection of parameter tampering, Optional encrypted question files, Runtime integrity daemon...)
From PyPI
pip install labquizFrom source:
pip install git+https://github.com/jfbercher/labquiz.gitImport:
import labquiz
from labquiz import QuizLabInstantiate:
quiz = QuizLab(URL, QUIZFILE,
retries=2,
needAuthentication=True,
mandatoryInternet=False)Creating YAML files manually works β but quiz_editor is intended to makes it easier. It can also be useful outside ob LabQuiz as a general quiz-editor with export capabilities.
-
Visual question editing (MCQ, numeric, templates)
-
Categories & tags
-
Variable generation for templates
-
Bonus / malus configuration
-
Logical constraints (XOR, IMPLY, SAME, etc.)
-
One-click export to:
- β YAML
- π Encrypted version
- π Interactive HTML (training mode)
- π HTML exam version (Google Sheet connected)
- π AMCβLaTeX format (paper exams)
Online version: π https://jfb-quizeditor.streamlit.app/
Install locally:
pip install quiz-editorquiz_dash is the companion dashboard for instructors.
It connects to your Google Sheet backend and provides:
- π Live tracking of submissions
- Live class overview
- π€ Student-by-student monitoring
- π Integrity checks (mode changes, retries tampering, hash verification)
- β Adjustable grading weights
- π Automatic recalculation
- π₯ CSV export of results
Online version: π https://jfb-quizdash.streamlit.app/
LabQuiz can run entirely in the browser using JupyterLite (WASM). Perfect for fully web-based lab environments.
| Tool | Purpose |
|---|---|
| labquiz | Notebook quiz engine |
| quiz_editor | Question bank creation & export |
| quiz_dash | Monitoring & correction dashboard |
π¦ Repositories:
- https://github.com/jfbercher/labquiz
- https://github.com/jfbercher/quiz_editor
- https://github.com/jfbercher/quiz_dash
Online tools:
- Prepare questions (YAML or
quiz_editor) - Optionally encrypt file
- Create Google Sheet backend
- Instantiate
QuizLabin notebook - Run lab / test / exam
- Monitor using a python console or with
quiz_dash - Post-correct with adjustable grading
See:
labQuizDemo.ipynbinextras/- ππΌ
Live versionπ Try it in binder
GPL-3.0 license





