Pythonpad is a programming environment for tiny Python 3 projects, that can be embedded in web pages. It runs users' Python code with Brython on the web browser, therefore no server-side app is needed to run code in Pythonpad.
It is designed for serving hands-on exercise problems in online introductory programming classes, and comes with a number of
educational libraries that can help students learning how to program for the first time.
Pythonpad also supports auto-grading with Python-based grading scripts to give instant feedback to your students. Our in-memory file system allows you to easily investigate the student code as a file from your grader code in a natural, pythonic way.
Pythonpad is a Vue.js component, but we provide a wrapper module that requires no knowledge about Vue.js to use Pythonpad.
The easiest way to use Pythonpad is to simply load the script found under lib/
in the distribution,
after loading the font-awesome 4.7 stylesheet and the Vue.js script.
For example:
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
<script src="https://cdn.jsdelivr.net/gh/pythonpad/pythonpad.js@v0.1.37/lib/pythonpad.bundle.js"></script>
When you have loaded the scripts like this, a Pythonpad programming environment can be rendered like this:
<div id="pad"></div>
<script>Pythonpad('pad', {src:'print("hello world")'})</script>
This will initialize the programming environment with a piece of code already in it,
and allow users to save the environment in their web browser using the localStorage
object.
Check out our super-simple example on CodePen.
Go see more examples to see what else Pythonpad can do, or read the manual to learn how to customize the Pythonpad instance in your website.