A simple, elegant Python framework for creating and running interactive quizzes
Project description
Quizy
Overview
A lightweight, API-first Python quiz framework for creating interactive quizzes and assessments. Features async execution, timers, partial credit, shuffling, and AI-powered question generation.
Key Features:
- Async/await support with
execute_async() - Real-time countdown timers with visual feedback
- Partial credit for flexible grading
- Question option shuffling and randomization
- Interactive CLI with color-coded results
- AI-powered question generation via OpenAI
Installation
pip install quizy # comes with OpenAI
Manual Questions
Create different question types:
from quizy import Quiz, MultipleChoiceQuestion, MatchingQuestion
quiz = Quiz(title="My Quiz", time_limit=60)
# Multiple Choice
quiz.add_question(MultipleChoiceQuestion(
text="What is the capital of France?",
options=["London", "Berlin", "Paris", "Madrid"],
correct_answer="Paris",
shuffle_options=True,
time_limit=10
))
# Matching
quiz.add_question(MatchingQuestion(
text="Match programming terms",
pairs={
"def": "Function definition",
"class": "Class definition",
"async": "Asynchronous function"
},
shuffle_answers=True,
allow_partial_credit=True,
time_limit=15
))
# Execute
result = quiz.execute(answer_provider=lambda q, idx: input(q.text + "\n> "))
print(f"Score: {result.score_percentage:.1f}%")
AI-Generated Questions
Generate quiz questions automatically using OpenAI and test it on terminal using QuizCLI:
import asyncio
from quizy import Quiz, QuizCLI
from quizy.ai_generator import AIQuestionGenerator
from quizy.core import QuestionType
async def my_quiz():
# Initialize the AI question generator
generator = AIQuestionGenerator()
# Generate questions asynchronously
questions = await generator.generate_questions_set_async(
topic="Python Programming",
num_questions=5,
question_types=[
QuestionType.MULTIPLE_CHOICE,
QuestionType.TRUE_FALSE,
QuestionType.MULTIPLE_SELECT,
QuestionType.SHORT_TEXT,
QuestionType.MATCHING,
],
difficulty="medium"
)
# Build the quiz
quiz = Quiz(title="AI-Generated Python Quiz", time_limit=300)
for q in questions:
if q:
quiz.add_question(q)
return quiz
if __name__ == "__main__":
quiz = asyncio.run(my_quiz())
QuizCLI.run_interactive(quiz)
Question Types
- MultipleChoiceQuestion: Single correct answer
- MultipleSelectQuestion: Select all correct answers (supports partial credit)
- MatchingQuestion: Match items to descriptions (supports partial credit)
- TrueFalseQuestion: Binary choice
- ShortTextQuestion: Free-form text answers
Future Enhancements (v0.5+)
- Web-based UI components
- Database integration for result persistence
- Advanced analytics and reporting
- Real-time leaderboards
- Support for more AI providers (Claude, Gemini, etc.)
- More partial credit options
- Fine-tuning for domain-specific questions
Support
GitHub: https://github.com/rustampy/quizy | Issues: https://github.com/rustampy/quizy/issues
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quizy-0.4.5.tar.gz.
File metadata
- Download URL: quizy-0.4.5.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad7570253afc4eb9784d740b1fe048bb21088a3e0409f753f69b55c107b7f3b8
|
|
| MD5 |
8256c2cb986d1b7e580a9960349dd9d7
|
|
| BLAKE2b-256 |
2f93d5589c59a1b3d40b0b5d8764f48bff2bcc61e5f326473710f0ea9e3e093f
|
File details
Details for the file quizy-0.4.5-py3-none-any.whl.
File metadata
- Download URL: quizy-0.4.5-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b002a3520419a41b9e1d776c5f95f14a65ca3660d7c6ad7d2cb9e760d3e6174
|
|
| MD5 |
b86bb392f05ed810db32c11b25921b19
|
|
| BLAKE2b-256 |
ab4ee2062c68dc831db36b396da0b316d28391b2004564bc55ea4ddf2704e57d
|