pyxpcomext
| resources: | Home Installation Downloads Samples Source Code Members Mailing List Bugs |
|---|
About the PyXPCOM Extension (pyxpcomext)
This project provides PyXPCOM bindings that enables Python to be used inside of Mozilla applications. The Python bindings are wrapped up in an extension (XPI file) so that users can easily install PyXPCOM just like any other Mozilla/Firefox extension.
The Python XPCOM extension is using Python 2.5.2 and is available to be used in most Mozilla based applications, including Firefox, Thunderbird and XulRunner.
Why do this?
- It gives the power of Python to Mozilla extension developers
- Easy to setup multi-threaded tasks
- Rapidly build cross platform extensions, no compilation issues!
- Great base of core library functionality
- Not limited to JavaScript
What does Python bring to Mozilla?
- ctypes support, easily accessing the native OS libraries
- additional network protocol support, like SFTP, SCP access through Paramiko
- create UDP sockets (see Mozilla bug 191187)
- thousands of additional python packages
What are the limitations
- The extension is large, between 5-10MB
- PyXPCOM uses a separate extension (xpi file) for every operating system supported
What's inside the extension?
- The Python 2.5.2 interpreter, libraries and necessary files
- The bindings to enable Python to communicate with Mozilla XPCOM
How does it all work?
- The PyXPCOM extension is download and installed into a Mozilla application as a regular extension
- Upon starting of the application, the extension is registered, and loads the internal dynamic linked libraries (python and pyxpcom)
- Additional extension directories are then checked to see if there are any extensions using pyxpcom that need to be registered (and appropriately registers them)
- The internal Python path (sys.path) is updated to reflect any "pylib" directories found in the installed extensions
Still TODO:
- Include the Python DOM component in the Mozilla 1.9 builds
- Get the paramiko SFTP channel fully working... (it's 90% working)
- Provide additional samples and more documentation...
- Other builds (64-bit, Linux libcpp6, etc...)
- Work out a system to easily support platform dependant binary python modules
Additional references
- Mark Hammond has talked about this previously
http://osdir.com/ml/mozilla.devel.xpcom.python/2006-06/msg00013.html - Alex Badea has actually made a pyxpcom extension for Firefox3, but
it is a somewhat different approach as it relies on a matching python being
installed on the system and other extensions using pyxpcom may not get
registered :(
http://vamposdecampos.googlepages.com/pyxpcom