Skip to main content

An interactive Python learning platform with automated code testing and feedback

Project description

Zest

Python programming challenge platform with secure code execution.

Structure

zest/
├── website/           # Flask web application
│   ├── auth.py       # User authentication
│   ├── models.py     # Database models
│   ├── questions.py  # Question routes
│   ├── api.py        # Submission API
│   └── templates/    # HTML templates
├── aws-lambda/       # Code executor (Docker container)
├── terraform/        # Infrastructure as code
├── tests/            # Pytest test suite
└── src/zest/         # Python package

Local Development

# Install dependencies
pip install -e ".[dev]"

# Run development server
python run.py

# Run tests
pytest

Deployment

AWS Lambda (Code Executor)

cd terraform
terraform init
terraform apply -target=aws_ecr_repository.executor

# Build and push Docker image
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $(terraform output -raw ecr_repository_url | cut -d'/' -f1)
cd ../aws-lambda && docker build -t zest-code-executor .
docker tag zest-code-executor:latest $(cd ../terraform && terraform output -raw ecr_repository_url):latest
docker push $(cd ../terraform && terraform output -raw ecr_repository_url):latest

# Deploy Lambda + API Gateway
cd ../terraform && terraform apply

# Save these outputs
terraform output api_gateway_url
terraform output -raw api_key_value

PythonAnywhere (Web App)

# Upload code via Git or Files tab
git clone https://github.com/yourusername/zest.git

# Create virtualenv in PythonAnywhere console
mkvirtualenv --python=/usr/bin/python3.10 zest
pip install -e .

# Configure web app:
# - Source code: /home/username/zest
# - Working directory: /home/username/zest
# - Virtualenv: /home/username/.virtualenvs/zest
# - WSGI file: from website import create_app; application = create_app()

# Set environment variables in WSGI file:
import os
os.environ['AWS_LAMBDA_URL'] = 'your-api-gateway-url'
os.environ['AWS_API_KEY'] = 'your-api-key'
os.environ['SECRET_KEY'] = 'generate-random-key'

# Reload web app

aws logs tail /aws/lambda/zest-code-executor --follow


View API Gateway metrics in AWS Console or CloudWatch.

## Cost Estimates

For low-moderate usage (~10,000 submissions/month):
- **Lambda**: ~$0.50/month
- **API Gateway**: ~$0.04/month
- **ECR**: ~$0.05/month
- **CloudWatch**: ~$0.50/month

**Total**: ~$1-2/month

## Troubleshooting

### Code execution fails
1. Check `.env` configuration
2. Test locally: `python scripts/test_executor_local.py`
3. Check Lambda logs in CloudWatch

### Database errors
1. Ensure `DATABSE_DEV` setting matches your database
2. Check database credentials
3. Run migrations if needed

### AWS deployment issues
See [terraform/README.md](terraform/README.md) troubleshooting section.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

zest-0.1.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file zest-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: zest-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for zest-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 99fc778ebbd1d87b408e63909cbaee87276cfdd67729545fd00c104340bf1e0b
MD5 53f09ca02a94a62fcedfd355ea54b239
BLAKE2b-256 f6f6bd550386b013db4a8dd1210c8c6a247f7b46c3a6dd7665e2c67a7ab08ee1

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