Package: pyexams
pyexamsGenerates variants of exam questions usingtexsurgery, keeps a question database, exports to pdf and moodle.Much likeR exams, but with the following (main) differences:R-examsrequires use of R for both creating exam variants and managing R-examsitself, whilepyexamsallows any language for exam creation and is called from a command which can be incorporated into your favorite LaTeX editor.R-examskeeps each question in a separate file, then use a simple R script to compose the whole exam, whilepyexamsuse a single LaTeX file for the whole exam.Both R-examsandpyexamskeep a record of past exam questions, butpyexamsalso keeps a database that can be queried in order to find, for instance, all questions with the tagderivativethat appeared in exams at least two years ago. The question code is also saved in plain text and managed in agitrepository, which simplifies the management of a shared question bank, whether group-private or totally open.Last but not least, R-examsis a mature and feature rich project, whilepyexamsis a very young project that still has to deliver.Other important design decisions involved inpyexams:The syntax for the questions is exactly that ofauto-multiple-choiceWe will useamc2moodle(or a custom version of it) to generate the moodle question bank.pyexamsstrives to feel as close to LaTeX as possible to its users, which paradoxically is better done throughtexsurgerythan through a LaTeX package.Warning: Alpha versionThis is still an early version. Use with care.Installationpython3 -m pip install pyexamsInstall also a LaTeX distribution which exposes the commandpdflatex.At this moment, you also have to installauto-multiple-choice. This will not be necessary in the future. It is not required to generate the moodle questions, but part of the pyexams experience is to compile the pdf often for quick feedback.You need to install thejupyterkernels you plan to use. Thepython3kernel gets installed when you pip install pyexams, but in order to run the example, you need to installsympytoo:python3 -m pip install sympyDevelopment installationgit clone https://framagit.org/pang/pyexams.git
cd pyexams
python3 -m pip install -U .Install the sagemath kernel (optional)Right now the only example usessagemath. You need to installsagemath, and then proceed to install thesagemathkernel into your system's jupyter. True, thesagemathbundle comes with a jupyter server inside, but that won't do: you need to execute this command, if you installedsagemathas root:`sudo jupyter kernelspec install YOUR_SAGEMATH_INSTALLATION_PATH/local/share/jupyter/kernels/sagemath`and this other command if you installed it as a regular user:`jupyter kernelspec install --user YOUR_SAGEMATH_INSTALLATION_PATH/local/share/jupyter/kernels/sagemath`Usagecdexamples# generates a pdf for the first student in the list (useful for testing)pyexamssympy_example.tex# generates one pdf for each first student in the list (runs in parallel)pyexamssympy_example-all# generates two pdf files for each first student in the list (runs in parallel)#  one with the exam statement#  other with the correct answer and an explanationpyexamssympy_example-all-both# generates a moodle question bankpyexamssympy_example-moodle# generates a moodle question bank with exactly 5 variants of each questionpyexamssympy_example-moodle-n5How to useMoodle short questionsStart with a template from theexamplesfolder, make a copy, edit it.Usepyexams your_source_file.texto test quickly if your code works.When happy with the result, runpyexams your_source_file.tex -moodle -n 5to generate a moodle question bank with exactly 5 variants of each question.Inspectyour_source_file.xmlfor obvious errors.If the file looks fine, try to upload tomoodle.Long written answerStart with a template from theexamplesfolder, make a copy, edit it.Editstudents.csvwith the real data of your students.Usepyexams your_source_file.texto test quickly if your code works.When happy with the results, runpyexams your_source_file.tex -all -bothto generate two pdf files for each first student in the list:
- one with the exam statement.
- other with the correct answer and an explanation.Distribute the exam statements at the date and time of the exam.Collect the students' solutions using amoodle taskor any similar tool.Distribute the exam solutions at the end of the exam.We suggest two ways to distribute the exam statements inpdf:Through moodle:Prepare amoodle folderactivity in advancePrepare mock pdf files with the same filenames as the real exam statements.Zip all the mock exams into a single file, which you can upload to moodle and unzip to deliver all the mock exams quickly.Instruct your students to download the mock exam, as a check.At the date and time of the exam, upload a zip with the real exam statements, and unzip it to replace the mock exams.Through email:pyexams -send emails_config.ini email_body_templatewill send an email to each student with the exam statement, or the exam solution, or any other file, such as acorrectionwith the teacher's comments to each exam. You can find examples in theexamplesfolder.Talk at ENSEMAT IIThe motivation behind this project and its design decision was presented (in Spanish) at a talk atENSEMAT IISlides for the talk (in spanish)ThanksTo all our colleagues that gave feedback to the early versions, specially Fabricio from ETSIN.UPM and carlos from ETSIAAB.UPM