Pyjamas (software)

From Seo Wiki - Search Engine Optimization and Programming Languages

Jump to: navigation, search
Original author(s) James Tauber, Luke Leighton, Google
Developer(s) Luke Leighton
Initial release March, 2007
Stable release 0.6 / August 18, 2009; 350522113 ago
Written in Python, JavaScript
Operating system Windows, Mac OS X, Linux
Available in Python
Type Ajax framework, Compiler, Widget set
License Apache License 2.0

Pyjamas is a tool and framework for developing AJAX applications in Python. It contains a stand-alone Python-to-JavaScript compiler, an AJAX Framework and Widget set, and through use of these components, developers can write comprehensive applications, to run in all major web browsers, without writing a single line of JavaScript. Pyjamas is a port of Google Web Toolkit [1] from Java to Python as the input language.



Using Pyjamas, developers can easily write web applications in Python instead of Javascript, so to [2]. The application is compiled to Javascript. Also included is an AJAX library and widget set [3] that provides access to the DOM model of modern JavaScript-capable web browsers. The AJAX library and the widget set library are a hybrid mix of Python and Javascript. Just as with GWT, "Pyjamas is not its libraries", and neither is it "yet another AJAX framework". AJAX Frameworks are strictly limited to providing pre-prepared specific functionality, written almost exclusively in tailor-made Javascript. Both GWT and Pyjamas, being Javascript compilers, allow the developer to work in the language with which they are familiar (Java or Python, respectively), to write their own custom widgets, either entirely from scratch or based on the existing available widgets, yet still target the full range of modern browers. So, far from presenting web developers with a fait-accompli AJAX Framework, Pyjamas gives you the freedom to develop your own.


The pyjamas compiler is written in Python, and uses the Python programming language to compile its input into JavaScript, walking the abstract syntax tree of the program being compiled. Although the compiler is stand-alone, the primary use of pyjamas is for web development, so there is additional infrastructure for building web applications.

The [4] model library is an abstraction layer - a thin layer of Python on top of JavaScript code snippets - use of which provides access to the full document object model of the target browser platform. As with any compiler, the JavaScript snippets are treated as inline assembler.

Furthermore, on top of the model library is an additional abstraction layer,[5], which provides the most useful layer to web developers: a full suite of widgets with which desktop application developers will be familiar. At present, the list of available widgets is a mixture of the complete set of widgets that were available in Google Web Toolkit 1.2, along with a few more that have been forward-ported from GWT 1.5.


The major Pyjamas components include:

pyjs Python-to-JavaScript Compiler
Translates the Python programming language to the JavaScript programming language.
Python builtin and standard emulation library
JavaScript implementations of the commonly used modules, builtins and classes in the Python standard runtime library (such as strings, lists, dictionaries, tuples, sets, getattr, map, filter, range etc.; basic exception handling, a basic datetime and a basic math module).
Pyjamas DOM library [4]
Modules for manipulating the browser DOM Model.
Pyjamas Web UI module [5]
A module for creating widgets as if the web browser was a Desktop Widget Engine.
Pyjamas Desktop ports
Support for running Pyjamas apps as pure Python, under MSHTML, XULRunner or Webkit. Pyjamas Desktop is conceptually close to GWT "Hosted" mode, except that the applications can be deployed live, under Pyjamas Desktop, rather than be used exclusively as a debugging tool.

Pyjamas Desktop

The widget set library [6] that comes with Pyjamas is so similar to PyQt and PyGTK that a port of Pyjamas was made to run Pyjamas applications on the desktop, called Pyjamas-Desktop. The project uses Webkit, XULRunner or MSHTML as the underlying technology, and it is through these browser engines that Pyjamas manipulates the DOM model of the application. Pyjamas and Pyjamas Desktop allow writing cross-platform, cross-desktop, cross-browser and cross-widget applications that run on the web and on the desktop[7] [8].

Sites using Pyjamas


  1. Pyjamas project home at google
  2. Why write in Python instead of in the native Javascript? Please enhance this article explaining, especially the motivation for Pyjamas.
  3. Widget Set diagram at Pyjamas Home Page
  4. 4.0 4.1 DOM module at Pyjamas Home Page
  5. 5.0 5.1 ui module at Pyjamas Home Page
  6. Widget set showcase at
  7. Pyjamas - Python Applications for Desktop and Web
  8. Coding in Pyjamas: Apps for Desktop and the Web

External links

Personal tools

Served in 2.002 secs.