EiplGrader
⚠️ Research Tool Notice: This is a research tool. Breaking changes between versions are expected.
EiplGrader automatically grades programming assignments where students explain algorithms in natural language. It uses large language models to generate code from student explanations and tests that code against predefined test cases.
Quick Start
pip install eiplgrader
Set up your API keys:
Option 1: Environment Variables
export OPENAI_API_KEY="your-api-key-here" # For OpenAI models
export META_API_KEY="your-api-key-here" # For Meta/Llama models
# export ANTHROPIC_API_KEY="your-api-key-here" # Coming soon
Option 2: Using .env file
cp .env.example .env
# Edit .env and add your API keys
Example: Code Generation Based Grading (CGBG)
from eiplgrader.codegen import CodeGenerator
from eiplgrader.tester import CodeTester
import os
# Choose your provider and get the appropriate API key
client_type = "openai" # or "meta" for Llama, "ollama" for local models
api_key = os.getenv("OPENAI_API_KEY") # or META_API_KEY for Llama
# Generate code from natural language description
code_generator = CodeGenerator(api_key, client_type=client_type, language="python")
result = code_generator.generate_code(
student_response="that adds two numbers and returns the result",
model="gpt-4o", # or "Llama-4-Maverick-17B-128E-Instruct-FP8" for Llama
function_name="add_numbers",
gen_type="cgbg"
)
# Test the generated code
test_cases = [
{"parameters": {"a": 1, "b": 2}, "expected": 3},
{"parameters": {"a": -1, "b": 1}, "expected": 0},
{"parameters": {"a": 0, "b": 0}, "expected": 0}
]
code_tester = CodeTester(
code=result["code"][0],
test_cases=test_cases,
function_name="add_numbers",
language="python"
)
test_result = code_tester.run_tests()
print(f"Tests passed: {test_result.successes}/{test_result.testsRun}")
Features
- Multi-language Support: Python, JavaScript, Java, C++, C, Go, Haskell
- LLM Providers: OpenAI (GPT models), Meta (Llama models), Ollama (local models)
- Type Inference: Automatic type detection for Python and JavaScript
- Multiple Generation Modes: CGBG (Code Generation), Function Redefinition, Segmentation
- Comprehensive Testing: Built-in test runner with detailed results
- Research-backed: Based on peer-reviewed educational research
Resources
- 📚 Full Documentation
- 🔧 Complete Examples - See
example_cgbg.py,example_redef.py,example_segmentation.py - 📝 Test Cases Format Guide
Language Support
| Language | Type Inference | Type Annotations Required |
|---|---|---|
| Python | ✅ Automatic | Optional |
| JavaScript | ✅ Automatic | Optional |
| Java | ❌ | Required |
| C++ | ❌ | Required |
| C | ❌ | Required |
| Go | ❌ | Required |
| Haskell | ❌ | Required |
Supported LLM Providers
| Provider | Models | Status | Environment Variable |
|---|---|---|---|
| OpenAI | GPT-4o, GPT-4, GPT-4.5, GPT-4.1 | ✅ Fully Supported | OPENAI_API_KEY |
| Meta | Llama-4-Maverick-17B-128E-Instruct-FP8, Llama-4-Scout-17B-16E-Instruct-FP8, Llama-3.3-70B-Instruct, Llama-3.3-8B-Instruct | ✅ Fully Supported | META_API_KEY |
| Ollama | codellama:instruct, stable-code:instruct | ✅ Fully Supported | N/A (local) |
| Anthropic | Claude models | 🚧 Coming Soon | ANTHROPIC_API_KEY |
Planned Features
The following features are planned for future releases:
- Additional LLM Providers: Anthropic (Claude) support
- Enhanced Segmentation: Improved mapping between explanations and code
- Performance Optimizations: Faster test execution and parallel processing
- Extended Language Support: Rust, TypeScript, and more
Citation
When using this tool, please cite:
@inproceedings{smith2024code,
author = {Smith IV, David H. and Zilles, Craig},
title = {Code Generation Based Grading: Evaluating an Auto-grading Mechanism for "Explain-in-Plain-English" Questions},
year = {2024},
isbn = {9798400706004},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
url = {https://doi.org/10.1145/3649217.3653582},
doi = {10.1145/3649217.3653582},
booktitle = {Proceedings of the 2024 on Innovation and Technology in Computer Science Education V. 1},
pages = {171–177},
numpages = {7},
keywords = {auto-grading, eipe, gpt-4, large language models},
location = {Milan, Italy},
series = {ITiCSE 2024}
}
Related Research
- Code Generation Based Grading: Evaluating an Auto-grading Mechanism for "Explain-in-Plain-English" Questions
- Explaining Code with a Purpose: An Integrated Approach for Developing Code Comprehension and Prompting Skills
- Prompting for Comprehension: Exploring the Intersection of Explain in Plain English Questions and Prompt Writing
Metadata
Release files for eiplgrader 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eiplgrader-1.0.0.tar.gz | 4.9 MB | Without provenance | Details for eiplgrader-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eiplgrader-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for eiplgrader-1.0.0-py3-none-any.whl |
Total release size: 14.0 MB
Release files / eiplgrader-1.0.0.tar.gz
| Download URL | eiplgrader-1.0.0.tar.gz |
|---|---|
| Size | 4.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8231140833536add67a9af2d1d80d975603c69f399215315e58e6d49f06bd7c
|
|
BLAKE2b-256 checksum How to use checksums |
7436e1f58bff32c7769752b70aa233c0f24090140f4d1ef73f7eddca7bd2529c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.13.5 Linux/6.15.2-arch1-1
|
Release files / eiplgrader-1.0.0-py3-none-any.whl
| Download URL | eiplgrader-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7309f679fceec1f5ad58e72d7a46bd301d8b996196d3698965a8fc8b83ee7b8c
|
|
BLAKE2b-256 checksum How to use checksums |
0583f0579bd604929c84123337eee8c0651f969963077ddb7d99630c017621ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.0.0 CPython/3.13.5 Linux/6.15.2-arch1-1
|
Security for eiplgrader 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.