Support for dynamic files and wildcards in workspaces
Posted on 2024-07-23 by Jonatan Schroeder
Two new features have been introduced for PrairieLearn workspaces: randomized starting files, and wildcards for graded files.
It is now possible to provide students with randomized workspaces, by introducing files containing random elements. This can be done in one of two ways:
-
A new
workspaceTemplates/
directory that allows files to be rendered using Mustache rules (like{{params.value}}
); -
A special parameter set in
server.py
containing the name and content of each file.
You can find more details on how to set up these files in the PrairieLearn documentation.
Additionally, you can now set up your question to use wildcard patterns to specify graded files. This will allow questions to accept files based on different names and directory structures. For example, to accept any C or H files in the home directory or its subdirectories, you may now change your question as following:
{ // ... "workspaceOptions": { // ... "gradedFiles": [ "**/*.h", "**/*.c" ] } }
For details on accepted wildcard patterns, again check the PrairieLearn documentation.