Python in the Browser
I’ve had ideas for certain browser-based software for quite some time now. Developing directly in javascript sounds like a world of unnecessary pain, and since I know and like Python, I’m looking for something that will allow me to develop this stuff in Python but run it in a brower.
- Why should it run in the browser?
- Because my target is desktop and “mobile” (phones and tablets for the rest of us), and I’m not excited about doing separate Android (version ???) and iOS versions.
- What sort of functionality am I looking for?
- Ideally, pygame or similar. Many of these programs will be aimed at kids, and need to operate rather like games. Obviously I don’t expect to get that, but we can always dream, right?
The Contenders
The following projects are in the shortlist. The main criterion for being there is that the project attempts to execute Python in the browser, and it’s still alive. Here they are, in no particular order:
- Pyjs - originally Pyjamas.
- Skulpt
- Brython
- RapydScript
Pyjamas
Pyjamas allows you to write a program and have it run on the desktop or in a browser. It implements its own GUI toolkit (derived from something Google did).
Apparently it makes assumptions about JavaScript that aren’t true anymore. Not much is happening over in the github repository recently, which suggests one of two things: It’s mature and not going to change much because of it; or, people are moving on to something else.
Skulpt
Skulpt has a pretty slick website to show itself off. It has a “document” module by which you can access the DOM, JavaScript-style!
Brython
Brython has a slick looking website too, but what really sets it apart is that the python appears inside a <script type="text/python">
tag. I think that’s just awesome right there.
RapydScript
RapydScript is not exactly Python – it’s Python-like. It also allows you to write JavaScript. The website states that RapydScript is “an alternative to Pyjamas for those wishing Python-like JavaScript without the extra overhead and complexity Pyjamas introduces”, indicating that it’s meant to be lightweight.
To Be Continued…
Next time, I’ll take a more serious look at each contender in turn, examining things like:
- What it provides
- Licence
- Ease of installation
- Coolness of the online examples
- Learning curve (with a Hello World example)
- Coverage of the Python standard library
- Ease of programming graphics
Posted Monday, February 9, 2015