beeware / batavia

A JavaScript implementation of the Python virtual machine.
http://pybee.org/batavia
Other
1.39k stars 424 forks source link

Convert Pandas to Javascript? #821

Closed abalter closed 5 years ago

abalter commented 5 years ago

If I compiled the entire Pandas library (or scipy, statsmodels, numpy, etc.) down to bytecode, would it run in Batavia? Could I then call it directly with JS?

freakboy3742 commented 5 years ago

@abalter Unfortunately, it's not quite that simple. Numerical processing libraries (like scipy and numpy) contain some Python code, but the core of the logic is implemented in C. Batavia is a pure Bytecode machine - it can't do anything with C code.

If you're interested in running NumPy etc in the browser, you may want to look into Pyodide. Pyodide uses WASM to compile both the Python interpreter and the C module code into web assembly, which means it can run in the browser.

abalter commented 5 years ago

@freakboy3742 Makes sense. I sort of knew that, but I wasn't sure if the core still somehow ended up running on the python virtual machine.