No description
Find a file
Illia Bahlai d471144372 feat: add PDF/MD export with bundled font, migrate CLI to typer
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>
2026-02-15 10:29:41 +01:00
src feat: add PDF/MD export with bundled font, migrate CLI to typer 2026-02-15 10:29:41 +01:00
.gitignore init commit 2026-02-07 20:32:19 +01:00
pyproject.toml feat: add PDF/MD export with bundled font, migrate CLI to typer 2026-02-15 10:29:41 +01:00
README.md feat: add PDF/MD export with bundled font, migrate CLI to typer 2026-02-15 10:29:41 +01:00
uv.lock feat: add PDF/MD export with bundled font, migrate CLI to typer 2026-02-15 10:29:41 +01:00

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 rich library
  • 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 typer with 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

  1. Clone the repository:

    git clone https://forgejo.3dcra.eu/i.bahlai/quiz-master.git
    cd quiz-master
    
  2. 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

  1. Select a Test: Choose from available quizzes
  2. Choose a Mode: Pick one of 3 quiz modes (Uczenie się, Sprawdzenie, Master)
  3. Choose Number of Questions: Select how many questions you want to answer (defaults to 20)
  4. Answer Questions: For each question, select the correct answers by entering the corresponding letters
  5. 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:

  1. Create a new Python file in the src/quiz_master/tests/ directory
  2. Define your test questions using the TestQuestion structure:
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...
]
  1. Import your test in src/quiz_master/quiz.py and add it to the TESTS list:
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 rich library for beautiful terminal output
  • Inspired by educational quiz applications for technical subjects