@savearray2/py.js
v0.2.2
Published
Node.js/Python Bridge; Node.js-hosted Python.
Downloads
6
Readme
I'm a bit busy at the moment, but have launched the library in a basic form. The library functions properly, but the async code that handles Node functions being asynchronously called from Python needs to be completed. The code should be cleaned up a bit, as well. If there's community demand, I'll try to devote more time to the library.
py.js
Node.js/Python Bridge; Node.js-hosted Python.
Documentation can be found here. Click here for here a few basic examples.
This project is currently a WIP (work-in-progress) and is currently in alpha. Significant changes are to come.
let chalk = require('chalk')
let p = require('@savearray2/py.js')
p.init({ pythonPath:
`${process.cwd()}/local:/usr/local/lib/python3.8/site-packages`
})
let plotly = p.import('plotly')
let np = p.import('numpy')
let go = plotly.graph_objs
let pio = plotly.io
let [x,y,colors,sz] =
[0,0,0,0].map(() =>
np.random.rand(100n))
sz = sz.__mul__(30n)
let fig = go.Figure()
fig.add_scatter.$apply({
x: x, y: y, mode: 'markers',
marker: {
size: sz, color: colors,
opacity: 0.6, colorscale: 'Viridis'
}
})
pio.write_image(fig, 'image.png')
console.log(chalk`{cyan Success:} Chart saved!`)
Recommended Configuration
- Node.js >= v10.4.0
- Python >= v3.5
- C++14 compatible compiler, or better
Note: x86 and ARM architectures have yet to be tested.
Current Testing Matrix
Linux
- Ubuntu 14.04 LTS, g++6, Node.js 14 LTS, Python 3.5 (x64)
- Ubuntu 16.04 LTS, g++8, Node.js 14 LTS, Python 3.9 (x64)
- Ubuntu 16.04 LTS, g++8, Node.js 15, Python 3.9 (x64)
OS X
- OS X 10.15, Node.js 14, Python 3.9 (x64)
- OS X 11.1, Node.js 15, Python 3.9 (x64)
Windows
- Windows 10, Node.js 14 LTS, Python 3.9, MSVS 2019 (x64)
- Windows 10, Node.js 15, Python 3.9, MSVS 2019 (x64)
See our build tests here: Linux & Mac, Windows.