5 ms·
Show HN: Minimal, modern embedded V8 for Python
- gardentheory 10y agoThis seems pretty cool. I just tried using jslint to lint a file, it works! https://gist.github.com/ianjosephwilson/7c6c0a2c833e92b3a82c6d1c8e50286c https://gist.github.com/ianjosephwilson/7c6c0a2c833e92b3a82c...
- jbaviat 10y agoThe PyMiniRacer repository is also bundled with a BabelJS (https://babeljs.io/ https://babeljs.io/) example: https://github.com/sqreen/PyMiniRacer/blob/master/helpers/babel.py 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
- galazzah 10y agoWhat're the use cases for this?
- jbaviat 10y agoOne 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 :)
- jbaviat 10y agoAnd server side rendering :)
- ivan_ah 10y agoCould this be used to render React views on the server side? I'd love to use something like https://github.com/markfinger/python-react 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?
- jbaviat 10y agoIt seems quite straightforward to me if you use: 1. the C# example from React doc, https://facebook.github.io/react/docs/environments.html https://facebook.github.io/react/docs/environments.html 2. The BabelJS example from PyMiniRacer: https://github.com/sqreen/PyMiniRacer/blob/master/helpers/babel.py https://github.com/sqreen/PyMiniRacer/blob/master/helpers/ba... I would be glad to hear more about that :)
- santa_boy 10y agoCool. 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 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.