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 the tool directly from GitHub:

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.0.2"

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

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 gemini --ai-model gemini-flash-latest --ai-timeout 30 essays/requirements-txt-essay.md

--ai-timeout must be greater than zero.

Security notes:

  • Never hardcode or commit API keys in source control.
  • Use environment variables (GEMINI_API_KEY) only.
  • 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/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.0.2.tar.gz (27.3 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.0.2-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for quizmd-2.0.2.tar.gz
Algorithm Hash digest
SHA256 efd0b9e6560da2c0adca8bb2c00b70806dc48fdf6084d326c4498d268e45231b
MD5 fb84372679cba15ad1b1ca0ca33d160a
BLAKE2b-256 cada653450b5d441938c6b4bc9b1935d1d1466829d1e1ca9602d0223b05e78a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: quizmd-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 20.4 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.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec8869aa603c0c295c94a969d46a030098b8fd9d92c6b6edf7065d3f86418bf2
MD5 a3cdb1dc546c6752c18e494ecd83dcae
BLAKE2b-256 7bfacb64df9b1eba9f26da8e3990bc659c40061171b3c40a454a93784c9f58ab

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