Is this code allowed?
Downloaded: -
Last edit: 04 December 2025
Courses often use a restricted subset of a programming language and its library, to reduce cognitive load, focus on concepts, simplify marking, detect use of copied code, etc.
allowed is a program that checks if code files (and Jupyter notebooks) only use the Python constructs that were taught.
allowed enables teachers to check in advance their examples, exercises and assessment for inadvertent use of constructs that weren’t taught. It also allows students and teachers to check submitted code against the taught constructs.
To do its job, allowed requires a short file that lists which constructs were introduced in which ‘unit’ of the course. That file can be used as a reference document to onboard new teachers and to discuss the design of the course, e.g. to check if important constructs are missing or if some units are overloaded.
- To install the tool, enter
pip install allowedin a terminal - To get a summary of the options, enter
allowed -h To check a file with the default configuration, enterallowed yourfile.py- To check a homework submission against the constructs taught up to unit 5, enter
allowed -u 5 yourfile.py
For full instructions on how to install, use and configure the tool, see https://dsa-ou.github.io/allowed/
If you have queries, or suggestions for features that would help you, please email me.