Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install pywidl

How to install pywidl

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install pywidl
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
0.1.0
0.1.0 Available View build log
Linux (32-bit)
0.1.0
0.1.0 Available View build log
0.1.0
0.1.0 Available View build log
Linux (64-bit)
0.1.0
0.1.0 Available View build log
0.1.0
0.1.0 Available View build log
0.1.0
0.1.0 Available View build log
 
License
MIT
Dependencies
Lastest release
version 0.1 on May 24th, 2012

Generic code generator from WebIDL interfaces.

pywidl parses WebIDL code using PLY, builds the interface object model and emits whatever code using user's mako templates or even user's native python module.

WebIDL object model

Defined in pywidl/model.py

Common usage in tests/idl.py

Example usage

$ cat fragment.idl

exception GraphicsException {
DOMString reason;

System Message: WARNING/2 (<string>, line 25)

Definition list ends without a blank line; unexpected unindent.

};

interface Paint { };

interface SolidColor : Paint {
attribute float red; attribute float green; attribute float blue;

System Message: WARNING/2 (<string>, line 33)

Definition list ends without a blank line; unexpected unindent.

};

interface Pattern : Paint {
attribute DOMString imageURL;

System Message: WARNING/2 (<string>, line 37)

Definition list ends without a blank line; unexpected unindent.

};

[Constructor] interface GraphicalWindow {

System Message: ERROR/3 (<string>, line 41)

Unexpected indentation.

readonly attribute unsigned long width; readonly attribute unsigned long height;

attribute Paint currentPaint;

void drawRectangle(float x, float y, float width, float height);

void drawText(float x, float y, DOMString text);

System Message: WARNING/2 (<string>, line 49)

Block quote ends without a blank line; unexpected unindent.

};

$ cat mako.tpl

// ${foo} % for definition in definitions: ${definition.name} % endfor

$ pywidl -m -o fragment.txt -t mako.tpl fragment.idl -- --foo=bar

$ cat fragment.txt

// bar GraphicsException Paint SolidColor Pattern GraphicalWindow

$ cat native.py

def render(definitions=[], source=None, output=None,

template=None, template_type=None, foo=None, **kwargs):

System Message: WARNING/2 (<string>, line 72); backlink

Inline strong start-string without end-string.
with open(output, 'w') as out:

print >>out, "// %s" % foo for definition in definitions:

System Message: ERROR/3 (<string>, line 77)

Unexpected indentation.
print >>out, definition.name

$ PYTHONPATH=".:$PYTHONPATH" pywidl -n -o fragment.txt -t native fragment.idl-- --foo=bar

$ cat fragment.txt

// bar GraphicsException Paint SolidColor Pattern GraphicalWindow

Subscribe to package updates

Last updated May 24th, 2012

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.