node-calls-python
Advanced tools
Comparing version
export class PyModule | ||
{ | ||
private _type: 'PyModule'; | ||
private constructor() {} | ||
private constructor(); | ||
} | ||
@@ -10,3 +10,3 @@ | ||
private _type: 'PyObject'; | ||
private constructor() {} | ||
private constructor(); | ||
} | ||
@@ -13,0 +13,0 @@ |
{ | ||
"name": "node-calls-python", | ||
"version": "1.7.6", | ||
"version": "1.7.7", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "This module lets you run python code inside node without spawning new processes", |
 | ||
# node-calls-python - call Python from NodeJS directly in-process without spawning processes | ||
# node-calls-python - call Python from Node.js directly in-process without spawning processes | ||
@@ -10,2 +10,9 @@ ## Suitable for running your ML or deep learning models from Node directly | ||
## Motivation | ||
Current solutions spawn a new process whenever you want to run Python code in Node.js and communicate via IPC using sockets, stdin/stdout, etc. | ||
But creating new processes every time you want to run Python code could be a major overhead and can lead to significant performance penalties. | ||
If the execution time of your Python code is less than creating a new process, you will see significant performance problems because your Node.js code will keep creating new processes instead of executing your Python code. | ||
Suppose you have a few NumPy calls in Python: do you want to create a new process for that? I guess your answer is no. | ||
In this case, running the Python code in-process is a much better solution because using the embedded Python interpreter is much faster than creating new processes and does not require any IPC to pass the data around. The data can stay in memory and requires only some conversions between Python and Node types (using the N-API and Python C API). | ||
## Installation | ||
@@ -47,3 +54,3 @@ ``` | ||
### **Mac**: install XCode from AppStore, [NodeJS](https://nodejs.org/en/download/) and [Python](https://www.python.org/downloads/) | ||
### **Mac**: install XCode from AppStore, [Node.js](https://nodejs.org/en/download/) and [Python](https://www.python.org/downloads/) | ||
``` | ||
@@ -50,0 +57,0 @@ npm install node-calls-python |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
77485
1.3%241
2.99%