No description
Bundle DejaVu Sans fonts for cross-platform PDF export with Polish characters. Replace argparse with typer for cleaner CLI with subcommands. Add markdown table rendering support in PDF export via markdown library. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| src | ||
| .gitignore | ||
| pyproject.toml | ||
| README.md | ||
| uv.lock | ||
Quiz Master
Quiz Master is an interactive command-line quiz application built in Python. It provides a rich interface for taking quizzes on various topics with immediate feedback and scoring.
Features
- Interactive quiz interface with colorful output using the
richlibrary - Support for multiple-choice questions with multiple correct answers
- Randomized question selection and answer ordering
- Configurable number of questions per quiz
- 3 quiz modes with different levels of feedback
- Detailed results summary with question history
- Export to PDF and Markdown with proper Unicode and markdown table support
- Bundled DejaVu Sans font — PDF export works on any system without extra font installation
- CLI powered by
typerwith subcommands and--help - Built-in tests for "Internet Rzeczy" (IoT), "Sztuczna Inteligencja" (AI), "Wykład Monograficzny", "Wykład Metod Wielokryterialnych", "Bezpieczeństwo Sieci Komputerowych", and "Etyka i Ekonomia Bisnesu Informatycznego"
Quiz Modes
| Feature | Uczenie się | Sprawdzenie | Master |
|---|---|---|---|
| Feedback ✔/✘ after answer | ✅ | ✅ | ❌ |
| Highlighted correct answers | ✅ | ❌ | ❌ |
| Shown wrong selections | ✅ | ❌ | ❌ |
| Visible score | ✅ | ✅ | ❌ |
| History table at the end | ✅ | ✅ | ❌ |
| Progress (question X/Y) | ✅ | ✅ | ✅ |
- Uczenie się — full feedback: correct answers highlighted in green before answering, wrong selections shown, score and history at the end
- Sprawdzenie — only ✔/✘ feedback after each answer, score and history at the end, no hints
- Master — no feedback, no score, only question progress shown
Installation
-
Clone the repository:
git clone https://forgejo.3dcra.eu/i.bahlai/quiz-master.git cd quiz-master -
Install dependencies using uv:
uv sync
Usage
Run the interactive quiz:
uv run quiz_master # interactive mode
uv run quiz_master -n 5 # quick 5 questions
Export tests to PDF / Markdown:
uv run quiz_master export # all tests, both formats
uv run quiz_master export -t 1 --format pdf # single test, PDF only
uv run quiz_master export --correct-only -o ./out # correct answers only
See all options:
uv run quiz_master --help
uv run quiz_master export --help
How It Works
- Select a Test: Choose from available quizzes
- Choose a Mode: Pick one of 3 quiz modes (Uczenie się, Sprawdzenie, Master)
- Choose Number of Questions: Select how many questions you want to answer (defaults to 20)
- Answer Questions: For each question, select the correct answers by entering the corresponding letters
- Review Results: See your score and a detailed breakdown of your answers (depending on the mode)
Adding New Tests
To add a new quiz/test:
- Create a new Python file in the
src/quiz_master/tests/directory - Define your test questions using the
TestQuestionstructure:
from quiz_master.types.base_test import TestQuestion
MY_NEW_TEST: list[TestQuestion] = [
{
"question": "What is the capital of France?",
"answers": ["Paris"],
"noise_answers": ["London", "Berlin", "Madrid"]
},
# Add more questions...
]
- Import your test in
src/quiz_master/quiz.pyand add it to theTESTSlist:
from quiz_master.tests.my_new_test import MY_NEW_TEST
TESTS = [
# ...existing tests...
{"label": "My New Test", "test": MY_NEW_TEST},
]
Project Structure
quiz-master/
├── pyproject.toml # Project metadata and dependencies
├── README.md # This file
└── src/
└── quiz_master/
├── __init__.py # Re-exports main() from quiz.py
├── __main__.py # Entry point
├── export.py # PDF + Markdown export
├── fonts/ # Bundled DejaVu Sans TTF fonts
├── modes.py # QuizMode ABC + 3 mode classes
├── ui.py # QuizUI — Rich rendering layer
├── quiz.py # Quiz class + typer CLI
├── tests/ # Quiz test definitions
└── types/ # TestQuestion TypedDict
Dependencies
- Python >= 3.12
- rich >= 14.3.2 (for rich text formatting and interactive elements)
- typer >= 0.15.0 (CLI framework)
- fpdf2 >= 2.8.3 (PDF generation)
- markdown >= 3.7 (markdown-to-HTML conversion for PDF tables)
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with the
richlibrary for beautiful terminal output - Inspired by educational quiz applications for technical subjects