Running your JS code in Python
blog.sheetjs.com
blog.sheetjs.com
http://pyv8.googlecode.com/svn/trunk/demos/node.py
But I think node itself can be used with pyv8 since they are both v8. There may be some issues with the event loops but that's not an extremely hard problem. IIRC, node-webkit (or appjs?) hacked up the node event loop with the event loop from chromium.
Another neat pyv8 trick is this (incomplete..) commonjs implementation:
https://github.com/flier/pyv8/blob/master/demos/commonjs/com...
.. so you can import node (or other commonjs) modules into python.
Although this isn't pyv8, it's possible to get python/javascript bindings for the webkit js environment (shared variables/functions/objects):
https://gist.github.com/kanzure/6581415
I am eager to figure out how to do a similar trick with blink or servo.
But I do see syntax errors if the bare slash is at the end:
>>> r'slash at end\'
File "<stdin>", line 1
r'slash at end\'
^
SyntaxError: EOL while scanning string literalSpecifically, a raw string cannot end in a single backslash (since the backslash would escape the following quote character).
I would LOVE to see tighter integration of Python and JavaScript, but if you are planning on using PyV8 in any production code (as I am), I would think very carefully about it.
Is your custom version published online anywhere? It would be great to build off the stability work you already seem to have done.
I'll have to see about publishing my work publicly, as I don't explicitly own it. My biggest piece of advice is to always build from the latest branched version of v8, rather than the trunk. Right now, that would be 3.23. The branched version tends to be a bit more stable than the trunk. Sadly, since the PyV8 maintainer works from the trunk, I've often had to build a few revs back to get things to compile if there was a major structural v8 change.
If you'd be willing to share the details of your build environment, I can see if my work is even applicable and go about getting the permission to publish what I've done.
BTW, I want to be clear that in no way am I disparaging the PyV8 maintainer. He's been very responsive and helped fix some problems that would have taken me weeks to fix on my own. The project simply isn't focused on stability at the moment.
The end result was, I had a Python module that could take a recorded selenium test and output Python code to run that test. The only dependency was spidermonkey.
I didn't want to write that logic in both javascript (for client) and python / go (for server) and create a suite of tests to attempt to verify that the server and client logic was equivalent.
I looked around for ways to either run (minimal) python functions in javascript or else run (minimal) javascript functions in python, but at the time didn't come up with anything workable (within the constraints of using GAE).
* no classes, objects, function attributes, prototypes, etc etc necessary, just chess move validity checking