Node.js addon that embeds Python using N-API and Python C API, allowing direct in-process execution of Python code without spawning child processes. Version 1.11.1 ships TypeScript types and supports Python 3.x. Unlike child_process or socket-based approaches, it keeps data in shared memory and avoids IPC overhead, making it suitable for rapid ML/DL model inference or small NumPy operations. Release cadence is moderate; requires node-gyp for native compilation. Better than python-shell for latency-sensitive scenarios but limited to Python 3 and may need platform-specific build setup.
npm install node-calls-pythonNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows async/sync calling, class instantiation, and memory management with node-calls-python.
Install python3-dev (Linux), windows-build-tools (Windows), or Xcode (macOS). See README FAQ.
Use import { interpreter } from 'node-calls-python' or set package.json type to commonjs.Always call await interpreter.destroy(pyObject) when finished, or use a try/finally pattern.
Ensure python3 points to Python 3.x and python3-dev is installed.
npm install --arch=arm64 --target_arch=arm64 node-calls-python
sudo apt install make g++
npm install node-calls-python
const py = require('node-calls-python').interpreter; // or use ESM importpip install numpy (or install in the same Python environment that node-gyp links to)