Generate quizzes from Python code.
Project description
quizlib
Generate quizzes from Python code.
Features
- Supported Question Types: Essay (ES), Multiple Choice (MC), True/False (TF), Cloze (CZ).
- Renderers: Moodle XML, Markdown
- Python-centric: Define quiz structure and content using native Python classes.
Installation
Install using uv:
uv add quizlib
For development run
uv pip install -e .
Usage
from quizlib import Quiz, Essay, MultipleChoice, TrueFalse, Cloze
from quizlib.renderers import MoodleXMLRenderer
# Initialize quiz
quiz = Quiz(category="Example", info="Sample quiz")
# Add questions
quiz.add(Essay(name="q1", defgrade=5, text="Explain the concept of recursion."))
quiz.add(MultipleChoice(
name="q2",
text="Which of these is a Python keyword?",
answers=[(1, "yield"), (0, "function"), (0, "define")],
))
# Render to Moodle XML
renderer = MoodleXMLRenderer()
xml_output = renderer.render(quiz)
print(xml_output)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quizlib-0.1.0.tar.gz
(6.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
quizlib-0.1.0-py3-none-any.whl
(11.1 kB
view details)
File details
Details for the file quizlib-0.1.0.tar.gz.
File metadata
- Download URL: quizlib-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f03562845d21e0adf3dfdf84d01f1a3741ef2f0ef55b16f5d8fe6c5e8db9126
|
|
| MD5 |
b9c389c5fe4ac914557a438f717a8df2
|
|
| BLAKE2b-256 |
74d3693f2803c8631308fcd8a011424e4cc21a1075639bb1432969fcd4a4eccc
|
File details
Details for the file quizlib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: quizlib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3744e998cbb7677f4032bc41f5733fd7ac002ea88ac158362e01dc7fe8408f65
|
|
| MD5 |
138b19b61871b11d75614a529deb71c4
|
|
| BLAKE2b-256 |
46c611fcad6fcd8b1fad5f1a974d50c33f38738f8ee6db47e7cce73ff01af158
|