This backend is a demonstration of the restricted package in action — built using FastAPI.
It showcases the use of restricted's default configuration to safely evaluate user-submitted Python code with custom import restrictions and structured error handling.
The API provides an endpoint to submit code and receive output, making it ideal for quick browser-based coding.
The frontend of this demo is hosted in Vercel.
- "Sandboxed" Python execution.
- Custom import restrictions with helpful error messages.
- Timeout protection to avoid infinite loops.
- Clone the repo
git clone https://github.com/bimalpaudels/interpreter-api.git
cd interpreter-api- Install dependencies (uv recommended)
pip install -r requirements.txt- Run the server
uvicorn main:app --reload