Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Another way to do this would be to use numba package to generate LLVM IR from Python bytecode (it supports a rich set of instructions including numpy stuff, has type inference, etc), and then run it in the browser via emscripten, with some adjustments to the IR if required.

Quick googling yields a related blog post: http://cyrille.rossant.net/numpy-browser-llvm/



Numba is not a general-purpose Python compiler, and does not handle (or intend to handle) many basic Python statements (like class or function definition) at all: http://numba.pydata.org/numba-doc/0.20.0/reference/pysupport...

And most general-purpose Python (e.g. dicts, most builtins, etc...) require running in "object mode" which is not standalone, it calls into the CPython API and thus requires an underlying CPython runtime.

So no, numba is not an other way to do that. shedskin[0] might be though.

[0] https://github.com/shedskin/shedskin/


Actually many more general constructs like lists and class definitions are on the roadmap or in open PRs.


Point remains that Numba doesn't intend to be a complete general-purpose Python compiler.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: