Skip to main content

Run markdown quizzes in the terminal

Project description

quizmd

quizmd runs markdown-based quizzes in the terminal with timers, single/multiple choice support, and answer export.

Install

Install from PyPI (recommended):

pip install quizmd

Install directly from GitHub (latest repo state):

pip install "git+https://github.com/steliosot/quizmd.git"

For a reproducible install, pin a release tag:

pip install "git+https://github.com/steliosot/quizmd.git@v2.2.1"

Then check the CLI:

quizmd --version

If you already installed it and want the latest updates:

pip install --upgrade --force-reinstall "git+https://github.com/steliosot/quizmd.git"

Add it to requirements.txt if you want teammates/students to install from GitHub:

git+https://github.com/steliosot/quizmd.git

Install vs Examples

  • pip install ... installs the quizmd command.
  • git clone ... downloads this repository so you can use the bundled example quizzes.

Run a Quiz

If you want the bundled examples, clone the repo:

git clone https://github.com/steliosot/quizmd.git
cd quizmd
quizmd quizzes/harry-potter-quiz.md

Quickest start for new users:

quizmd init
quizmd --validate hello-quiz.md
quizmd hello-quiz.md
quizmd --validate hello-imposter.md
quizmd hello-imposter.md

Validate quiz files without running the interactive UI:

quizmd --validate quizzes/harry-potter-quiz.md

Validate and run an essay quiz:

quizmd --validate essays/requirements-txt-essay.md
export GEMINI_API_KEY="your_key_here"
quizmd essays/requirements-txt-essay.md

Optional AI settings for essay mode:

quizmd --ai-provider auto --ai-timeout 30 essays/requirements-txt-essay.md
quizmd --ai-provider gemini --ai-model gemini-flash-latest --ai-timeout 30 essays/requirements-txt-essay.md
quizmd --ai-provider openai --ai-model gpt-4o-mini --ai-timeout 30 essays/requirements-txt-essay.md
quizmd --ai-provider anthropic --ai-model claude-3-5-haiku-latest --ai-timeout 30 essays/requirements-txt-essay.md

--ai-timeout must be greater than zero. --ai-provider auto (default) checks keys in this order: GEMINI_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY. If the first provider fails at runtime, auto mode tries the next available provider before falling back to deterministic feedback.

Security notes:

  • Never hardcode or commit API keys in source control.
  • Use environment variables only:
    • GEMINI_API_KEY
    • OPENAI_API_KEY
    • ANTHROPIC_API_KEY
  • If a key is exposed, rotate/revoke it immediately.

Privacy note:

  • Essay answers are only saved if you choose y at the save prompt.
  • Choose n to keep answers out of local answers/ files.

Theme options for better readability on light or dark terminals:

quizmd --theme auto quizzes/harry-potter-quiz.md
quizmd --theme light quizzes/harry-potter-quiz.md
quizmd --theme dark quizzes/harry-potter-quiz.md

Windows Setup Notes

Create and activate a virtual environment on Windows:

python -m venv .venv
.venv\Scripts\activate

Install and run:

pip install "git+https://github.com/steliosot/quizmd.git"
quizmd --version
quizmd --validate .\quizzes\harry-potter-quiz.md
quizmd .\quizzes\harry-potter-quiz.md

Example Quizzes Included (No LLM Needed)

  • quizzes/harry-potter-quiz.md
  • quizzes/world-geography-quiz.md
  • quizzes/python-basics-quiz.md
  • quizzes/python-basics-imposter.md
  • quizzes/math-foundations-quiz.md
  • quizzes/history-and-civics-quiz.md
  • quizzes/general-science-quiz.md

Essay Examples (LLM-Based)

Essay files are separate and use Gemini evaluation:

  • essays/requirements-txt-essay.md
  • essays/venv-essay.md
  • essays/pinned-versions-essay.md

MCQ quizzes in quizzes/ do not call LLMs and do not need GEMINI_API_KEY.

Simple Quiz Example

Create a file named my-quiz.md:

# My First Quiz

## Question 1
What is 2 + 2?

- 3
- 4
- 5

Answer: 2
Type: single
Time: 20
Explanation: 2 + 2 is 4.

Run it:

quizmd --validate my-quiz.md
quizmd my-quiz.md

Guide: How to Create a Quiz

  1. Start with a single # quiz title.
  2. Add each question as a ## block.
  3. Put the question text on the next line.
  4. Add answer options using - bullet lines.
  5. Add required fields:
    • Answer: (1-based indexes, comma-separated for multiple)
    • Type: (single or multiple)
  6. Add optional fields:
    • Time: positive integer seconds
    • Explanation: any text
  7. Run quizmd --validate your-quiz.md before sharing.

Quiz File Rules

  • Each question must start with ##.
  • Text outside the title and ## blocks is rejected.
  • Answer: is required and must be valid indexes.
  • Type: is required and must be single or multiple.
  • Duplicate answers like Answer: 2,2 are rejected.
  • Time: (if present) must be greater than zero.

Common Validation Errors

  • missing required field(s): options
  • missing required field(s): answer
  • missing required field(s): type
  • duplicate answer indexes
  • unsupported question type
  • unexpected content outside question blocks
  • no valid questions found

Student End-to-End Check (Clean Environment)

Use these exact steps before class to confirm everything works:

python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install "git+https://github.com/steliosot/quizmd.git"
quizmd --version
git clone https://github.com/steliosot/quizmd.git
cd quizmd
quizmd --validate quizzes/harry-potter-quiz.md
quizmd quizzes/harry-potter-quiz.md

Development

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m unittest discover -s tests -q

Releases

  • Release tags are immutable.
  • Never retag an existing version.
  • Publish a new tag for every release (v2.0.3, v2.0.4, ...).
  • See CHANGELOG.md and RELEASE.md.
  • PyPI publishing is configured via GitHub Trusted Publishing in .github/workflows/release.yml.

Community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quizmd-2.2.1.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quizmd-2.2.1-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file quizmd-2.2.1.tar.gz.

File metadata

  • Download URL: quizmd-2.2.1.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for quizmd-2.2.1.tar.gz
Algorithm Hash digest
SHA256 2e9c50b445ff74a46d9595a4649edbe68a108aa777b3610956e5bb29c17e5b06
MD5 d63c10c325daa9e0ac6f7da60ac326dc
BLAKE2b-256 a4b0bf4471d9419eb10ebbbd50faa87530435e1f2dba38747128e7ed8e2254ba

See more details on using hashes here.

File details

Details for the file quizmd-2.2.1-py3-none-any.whl.

File metadata

  • Download URL: quizmd-2.2.1-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for quizmd-2.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dac764a4274465d69899768e1a047742dd6932f890992b01477adc7f0e6bbede
MD5 5f3f540009904f7e0212c2754c573f5f
BLAKE2b-256 7e629dba3b8b6fc93458070fba32c09d0ea61d6d9f0c9edb8706309aa760cbb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page