Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Python Wrapper for Google V8 Javascript Engine
Python C++ JavaScript
Branch: master

This branch is 1 commit ahead of flier:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
demos
doc
src
MANIFEST.in
PyV8.py
PyV8.vs2010.sln
README.markdown
buildconf.py.example
ez_setup.py
index.html
setup.py

README.markdown

PyV8 is a python wrapper for Google V8 engine, it act as a bridge between the Python and JavaScript objects, and support to hosting Google's v8 engine in a python script.

>>> import PyV8
>>> ctxt = PyV8.JSContext()          # create a context with an implicit global object
>>> ctxt.enter()                     # enter the context (also support with statement)
>>> ctxt.eval("1+2")                 # evalute the javascript expression
3                                    # return a native python int
>>> class Global(PyV8.JSClass):      # define a compatible javascript class
...   def hello(self):               # define a method
...     print "Hello World"    
...
>>> ctxt2 = PyV8.JSContext(Global()) # create another context with the global object
>>> ctxt2.enter()                    
>>> ctxt2.eval("hello()")            # call the global object from javascript
Hello World                          # the output from python script

Please check the unit tests for more detail.

Please check the change history for the lastest v0.9 version.

ps: lkcl has finished a similar binding example.

Something went wrong with that request. Please try again.