Metadata-Version: 2.3
Name: quizlib
Version: 0.1.0
Summary: Generate quizzes from Python code.
Keywords: quiz,moodle,education,testing,markdown
Author: Hannes Knoll
Author-email: Hannes Knoll <git@hannesknoll.de>
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Topic :: Education :: Testing
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: typst>=0.14.7
Requires-Python: >=3.13
Project-URL: Repository, https://gitlab.com/hhoegl-tha/snp-rs/quizlib
Description-Content-Type: text/markdown

# 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:

```sh
uv add quizlib
```


**For development run**
```sh
uv pip install -e .
```

## Usage

```python
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)
```
