Fork me on GitHub

Python. Client side.

Skulpt is an entirely in-browser implementation of Python.

No preprocessing, plugins, or server-side support required, just write Python and reload.

Demo

The code is run entirely in your browser, so don't feel obligated to "crash the server", you'll only stub your toe. Help, or examples: 1 2 3 4 5 6 7. Ctrl-Enter to run.

Output: (clear)




Your Very Own Copy

Want to give it a shot? Grab it with a:

    git clone https://github.com/bnmnetp/skulpt.git

Skulpt surely isn't done yet.

If you want to check out a list of bugs, or add to it, or see what's been fixed recently, you can head over to the always-euphemistic-sounding issues page.

If you'd like to chit-chat, there's a list for that.

And, if "daring" is your middle name, there's a wee bit of developer docs (New and Improved!).

Skulpt in the Wild

If you have a project that uses skulpt and would like me to link to it here, let me know on our github page.

Getting Started

Getting started with skulpt on your own page can seem a little intimidating, but here's a really simple example that gets you going. You can copy and paste or grab the code from this gist.
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
<script src="skulpt.js" type="text/javascript"></script>
<script src="builtin.js" type="text/javascript"></script>

</head>

<body>

<script type="text/javascript">
// output functions are configurable.  This one just appends some text
// to a pre element.
function outf(text) {
    var mypre = document.getElementById("output");
    mypre.innerHTML = mypre.innerHTML + text;
}
function builtinRead(x) {
    if (Sk.builtinFiles === undefined || Sk.builtinFiles["files"][x] === undefined)
            throw "File not found: '" + x + "'";
    return Sk.builtinFiles["files"][x];
}

// Here's everything you need to run a python program in skulpt
// grab the code from your textarea
// get a reference to your pre element for output
// configure the output function
// call Sk.importMainWithBody()
function runit() {
   var prog = document.getElementById("yourcode").value;
   var mypre = document.getElementById("output");
   mypre.innerHTML = '';
   Sk.canvas = "mycanvas";
   Sk.pre = "output";
   Sk.configure({output:outf, read:builtinRead});
   eval(Sk.importMainWithBody("<stdin>",false,prog));
}
</script>

<h3>Try This</h3>
<form>
<textarea id="yourcode" cols="40" rows="10" >import turtle

t = turtle.Turtle()
t.forward(100)

print "Hello World"
</textarea><br />
<button type="button" onclick="runit()">Run</button>
</form>
<pre id="output" ></pre>
<!-- If you want turtle graphics include a canvas -->
<canvas id="mycanvas" ></mycanvas>

</body>

</html>

License

Skulpt may be licensed under:

  1. The MIT license.
  2. Or, for compatibility with Python, the PSFLv2.

Please note that this dual license only applies to the part of Skulpt that is included in the runtime, and not necessarily to surrounding code for build processing or testing. Tests are run using V8, and Closure Compiler, and some test code is taken from the tinypy and Python test suites, which may be distributed under different licensing terms.

About

The Father of skulpt is Scott Graham, you can find his blog here: personal page (and blog)

My own personal page and blog is Reputable Journal