Exams management

Jupman comes with a script to manage exams called exam.py, which allows to manage the full cycle of an exam.

What is an exam

Exam text is represented as Jupyter notebooks, which are taken from _templates/exam/solutions/exam-yyyy-mm-dd.ipynb

Exercises for students: they are supposed to be the exam notebook itself and / or plain python files (or the notebook itself) plus unittests and relative solutions.

Marks spreadsheet: By default there is also an LibreOffice spreadsheet to give marks, in case you need it.

When you initialize an exam with the init command, for example for date 2000-12-31, all the presets in _templates/exam/ are copied to private/2000-12-31/ and private/2000-12-31/solutions. Presets can be changed at will to suit your needs. When packaging, student zip is assembled in private/2000-12-31/student-zip

System is flexible enough so you can privately work on next exams in private/ folder and still being able to publish modifications to main website. After an exam, you can copy the private exam to the public folders in past-exams/.

Exam commands

To see the help:

python3 exam.py -h

To see help for a particular subcommand, like i.e. init, type the subcommand followed by -h :

python3 exam.py init -h

Running commands should be quite self-explanatory.

NOTE: as of today (Dec 2019) software may contain bugs, but at least we check for major misuses (like trying to overwrite existing exams).

In the file create-exam-example.sh there is a typical run of the script, which creates the example exam for date 2000-12-31. Notice it might ask you to delete the existing 2000-12-31 exam, if it does just follow the instructions. Here’s the output:

> ./create-exam-example.sh
python3 exam.py init 2000-12-31
  Detected release from git: 3.2.0-3-g30a995c
No GOOGLE_ANALYTICS environment variable was found, skipping it

  You can now edit Python solutions, tests, exercises and exam notebook here  :

     _private/2000-12-31/solutions

  DONE.

python3 exam.py package 2000-12-31
  Detected release from git: 3.2.0-3-g30a995c
No GOOGLE_ANALYTICS environment variable was found, skipping it
  Cleaning _private/2000-12-31/server/jupman  ...
  Copying exercises to _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/
  Copying code
    from  _private/2000-12-31/solutions
    to    _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/
    Writing (patched) _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/exam-2000-12-31.ipynb
    Generating _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/trees.py
    Writing _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/example.txt
    Generating _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/lists.py
    Writing (patched) _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/trees_test.py
    Writing (patched) _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/lists_test.py
  Creating dir _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/img
    Writing _private/2000-12-31/student-zip/jupman-2000-12-31-FIRSTNAME-LASTNAME-ID/img/mountains.jpg
  Building pdf ..
  Creating student exercises zip:  _private/2000-12-31/server/jupman-2000-12-31-exam.zip
  Writing jupman.py
  Writing my_lib.py
  Writing _static/img/cc-by.png
  Writing _static/js/jupman.js
  Writing _static/css/jupman.css
  Writing _static/js/toc.js
  Writing _static/js/pytutor-embed.bundle.min.js
  Wrote _private/2000-12-31/server/jupman-2000-12-31-exam.zip

  DONE.


------- Simulating some shipped exams...
mkdir -p _private/2000-12-31/shipped/john-doe-112233
cp _templates/exam/solutions/lists_sol.py _templates/exam/solutions/lists_test.py _templates/exam/solutions/trees_sol.py _templates/exam/solutions/trees_test.py _private/2000-12-31/shipped/john-doe-112233
mkdir -p _private/2000-12-31/shipped/jane-doe-445566
cp _templates/exam/solutions/lists_sol.py _templates/exam/solutions/lists_test.py _templates/exam/solutions/trees_sol.py _templates/exam/solutions/trees_test.py _private/2000-12-31/shipped/jane-doe-445566
------- Done with shipped exams simulation, time to grade ...

python3 exam.py grade 2000-12-31
  Detected release from git: 3.2.0-3-g30a995c
No GOOGLE_ANALYTICS environment variable was found, skipping it
  Copying Python files to execute and eventually grade in _private/2000-12-31/graded/john-doe-112233/graded
  Copying original shipped files (don't touch them!) in _private/2000-12-31/graded/john-doe-112233/shipped
  Copying Python files to execute and eventually grade in _private/2000-12-31/graded/jane-doe-445566/graded
  Copying original shipped files (don't touch them!) in _private/2000-12-31/graded/jane-doe-445566/shipped

  DONE.

python3 exam.py zip-grades 2000-12-31
  Detected release from git: 3.2.0-3-g30a995c
No GOOGLE_ANALYTICS environment variable was found, skipping it

  You can now find zips to send to students in _private/2000-12-31/graded


  DONE.

python3 exam.py publish 2000-12-31
  Detected release from git: 3.2.0-3-g30a995c
No GOOGLE_ANALYTICS environment variable was found, skipping it
  Copying solutions to exams/2000-12-31/solutions
  Copying exam PDF text

  Exam Python files copied.

  You can now manually build and run the following git instructions to publish the exam.
    ./build.py
    git status  # just to check everything is ok
    git add .
    git commit -m 'published 2000-12-31 exam'
    git push


  DONE.


  Finished example exam run !!
[ ]: