Giter Site home page Giter Site logo

nitely / v8-cffi Goto Github PK

View Code? Open in Web Editor NEW
36.0 7.0 7.0 20.85 MB

Embed the V8 Javascript Interpreter into Python

Home Page: http://v8-cffi.readthedocs.org

License: MIT License

Python 9.42% C++ 89.81% C 0.59% Makefile 0.18%
python cffi v8-javascript-engine v8

v8-cffi's Introduction

V8-CFFI

Build Status Coverage Status pypi licence

Embed the V8 Javascript engine into Python.

Note: The initial purpose of this library is to render React components server side.

Compatibility

  • GCC +4.8
  • G++ +4.8
  • Python 2.7, 3.4, 3.5 and PyPy 5.3

Note: Linux-x64 is the only (officially) supported platform. To build the binaries for other platforms, the ./dev steps must be adapted (probably to vagrant instead of docker) accordingly. PRs are welcome.

Usage

from v8cffi import shortcuts
shortcuts.set_up()

ctx = shortcuts.get_context()
ctx.load_libs(['./foo_bundled.js'])
ctx.run_script('foo.render("hola mundo");')
# "hola mundo"

Read the docs.

Notes

  • Currently ships with V8 4.9.385.33 (stable).
  • This repo contains V8 static files for Linux-x64, built with CentOS 6.7 (glibc 2.12), it's known to work in Ubuntu 12.04/14.04/16.04.

Resources

Devs

Devs

Benchmarks

This will run some silly benchmarks. It runs about ~110k ops/s on a 1.8GHz CPU.

$ make benchmarks

License

MIT

v8-cffi's People

Contributors

heston avatar nitely avatar thedrow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

v8-cffi's Issues

Thread pool of pre-loaded VMs

Would allow to run JS code in parallel. Should support asyncio. Should be transparent (ie: same API as for managing one VM)

Python 2/PyPy support

I checked your .travis.yml and it seems you only test with Python 3.
Is that on purpose?

C layer platform should be a singleton

This is just for correctness. The underlying V8 platform is a singleton, so the C layer should be implemented as a singleton as well, nothing else should be refactored.

Priority is very low.

Compile with custom v8 shared library

Should allow to compile and link a v8 shared library. Also, this way it should be possible to distribute the binaries for OSX and Windows (static libraries are too big ~600MB).

  • Support for custom rpath

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.