[ANN] pywebkit - python bindings for webkit DOM (alpha)

lkcl at lkcl.net lkcl at lkcl.net
Thu Oct 7 01:19:20 CEST 2010

From: lkcl at lkcl.net
To: python-list at python.org

i've been kindly sponsored by http://www.samurai.com.br to create
direct python bindings to webkit's DOM:

the significance of this project is that it makes python a peer of
javascript when it comes to manipulating HTML through DOM functions
(including gaining access to the full features of HTML5 for example).
anything that can be done with javascript (such as
getElementsByTagName, appendChild etc.) can be done with python, in a
declarative programming style (not as < script language="python" >).
that means that the powerful features of HTML5 that were formerly
pretty much exclusively available to javascript programmers are now
equally available to python programmers, and webkit is known as being
especially suited to embedded environments.

anyone who has been following pywebkitgtk or pyjamas development will
be aware that the previous python webkit DOM bindings, written in
2008, were based on top of glib/gobject bindings and used
python-gobject to autogenerate them.  whilst this approach worked, its
future was made slightly awkward when the development of the gobject
bindings were kindly taken over by free software developers who have
been working hard to incorporate the full features of the original
gobject bindings into webkit for almost a year, now.  the pythonwebkit
project therefore begins again, with *direct* access to webkit DOM
functions and properties instead of going via an intermediate layer
such as gobject.

the source code for the pywebkitgtk project has been directly
incorporated into the pythonwebkit project, making it a much simpler
prospect to build.  that does not mean that it's easy - just easier!
for build instructions, please read the instructions at
http://www.gnu.org/software/pythonwebkit/ which recommend reading of
the original webkit build instructions on the original webkit
developer web site, with specific advice on the additional python
requirements.  (please note that the ongoing development focus is on
linux and embedded linux systems: windows and macosx developers are
very much "on their own" as far as build procedures are concerned, but
macosx developers are best advised to start from darwinports and to go
from there.  windows developers: good luck.  send us a postcard from
whatever loony bin you end up in, if they allow you access to

for those people interested in pyjamas (http://pyjs.org), pyjamas
desktop has already been updated accordingly, and is already useable
with pywebkit.

please note that this is a very early announcement, with quite a lot
still left to do, but whilst there are known issues, the project is
definitely at the "working" state and so is worthy of an announcement
if anyone is interested in testing and contributing or just seeing
what the fuss is about.


p.s. it's worthwhile pointing out, for anyone who is interested, that
if you wish to access a browser engine's DOM model on windows, it is
much easier to use python-COM bindings to MSHTML than it is to try
building webkit with python bindings on windows - but should you ever
succeed in building pythonwebkit on windows, please do get in touch.
if however you See The Light and realise in good time that it's a
train coming straight at you, and decide to use python COM instead, i
recommend looking at pyjd/mshtml.py and associated code in the pyjamas
project - http://pyjs.org - and beginning from there.  compiling
webkit (and xulrunner) on windows really is that bad, and
incorporating python into the mix really is likely to push your sanity
off the edge of a cliff.  if you succeed however, there are quite a
lot of people who will be extremely grateful for your sacrifice, and
who will come visit you and bring you flowers and children's colouring
picture books on a regular basis.

More information about the Python-announce-list mailing list