News for hackers. Stuff that matters.
Re:Show HN: Minimal, modern embedded V8 for Python by galazzah on Tuesday August 02, 2016 @02:30PM (#12212080)
What're the use cases for this?
Re:Show HN: Minimal, modern embedded V8 for Python by jbaviat on Tuesday August 02, 2016 @03:23PM (#12212565)
One of PyMiniRacer author speaking.

Use cases are many. For instance, Rails uses ExecJS to minify assets, to compile JavaScript assets from ES6 to older JS runtimes using Babel, for compiling CoffeeScript... In another world - and that's Sqreen use case for this, JavaScript is the 2016 alternative to Lua.

Furthermore, PyMiniRacer is a lightweight alternative to NodeJS if you are a pythonist and need to run JavaScript, for production or for hacking :)

Re:Show HN: Minimal, modern embedded V8 for Python by jbaviat on Wednesday August 03, 2016 @03:42AM (#12216325)
And server side rendering :)
Re:Show HN: Minimal, modern embedded V8 for Python by santa_boy on Tuesday August 02, 2016 @11:10PM (#12215306)
Cool. This looks similar to V8 for R that I use for data analysis.

Link to V8: [jeroenooms/V8: Embedded JavaScript Engine for R](https://github.com/jeroenooms/V8)

I use this sometimes because I am so comfortable with nodejs libraries like Moment that I get lazy to figure out things using R.

Re:Show HN: Minimal, modern embedded V8 for Python by ivan_ah on Tuesday August 02, 2016 @10:04PM (#12215049)
Could this be used to render React views on the server side? I'd love to use something like https://github.com/markfinger/python-react but without the need to run node.js server on the side.

Is there an example I can copy to imitate this approach?

Re:Show HN: Minimal, modern embedded V8 for Python by jbaviat on Wednesday August 03, 2016 @02:16AM (#12215970)
It seems quite straightforward to me if you use:

1. the C# example from React doc, https://facebook.github.io/react/docs/environments.html

2. The BabelJS example from PyMiniRacer: https://github.com/sqreen/PyMiniRacer/blob/master/helpers/ba...

I would be glad to hear more about that :)

Re:Show HN: Minimal, modern embedded V8 for Python by gardentheory on Tuesday August 02, 2016 @05:17PM (#12213489)
This seems pretty cool. I just tried using jslint to lint a file, it works! https://gist.github.com/ianjosephwilson/7c6c0a2c833e92b3a82c...
Re:Show HN: Minimal, modern embedded V8 for Python by jbaviat on Tuesday August 02, 2016 @07:36PM (#12214281)
The PyMiniRacer repository is also bundled with a BabelJS (https://babeljs.io/) example:

https://github.com/sqreen/PyMiniRacer/blob/master/helpers/ba...

You can easily try it once PyMiniRacer is installed to transpile JavaScript files:

cat some-file.js | python helpers/babel.py