pyxpcomext

pyxpcomext

resources:
Python extension

About the Python Extension (pythonext)

This project provides Python Mozilla 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 PythonExt just like any other Mozilla/Firefox extension. The Python bindings are a combination of PyXPCOM and PyDOM.

Update: Project has moved to PythonExt in Google code.

The Python 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
  • Provides a Python GUI toolkit to build applications (XULRunner)

What does Python bring to Mozilla?

  • ctypes support, easily accessing the native OS libraries
  • additional network protocol support, like SFTP, SSH 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-15MB
  • PythonExt 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 and DOM

How does it all work?

  • The Python 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, pyxpcom and pydom)
  • 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
  • Provide additional samples and more documentation...
  • Finish the paramiko SFTP channel
  • Other builds (64-bit, Linux libcpp6, etc...)
  • Create a python library to facilitate in the creation of new XULRunner/Python application skeletons (possibly a Komodo project extension as well)
  • Work out a system to easily support platform dependant binary python modules (add a specific platform directory to the PYTHONPATH automatically?)

Additional references

The pyxpcomext project can be contacted through the mailing list or the member list.
Copyright © 2000-2012. All rights reserved. Terms of Use & Privacy Policy.   

原文地址:https://www.cnblogs.com/lexus/p/2338753.html