starless-crossrunner
v1.0.4
Published
Cross runner for communication with other languages.
Downloads
1
Readme
Starless Cross Runner
Cross runner for communication with other languages.
Installation
If this is a brand new project, make sure to create a package.json first with the npm init
command.
Installation is done using the npm install command:
npm install starless-crossrunner
Running Python Script
const { invokePython } = require("starless-crossrunner");
invokePython("main.py", "Hello to python");
Sending Message To Python
invokePython("main.py", { name: "hlm", hobby: "coding" });
import sys
import json
info = json.loads(sys.argv[1]) # { name: "hlm", hobby: "coding" }
Receiving Result From Python
import sys
import json
info = json.loads(sys.argv[1]) # { name: "hlm", hobby: "coding" }
print(json.dumps(info)) # send result back to js
const result = await invokePython("main.py", { name: "hlm", hobby: "coding" });
console.log(result); // { name: "hlm", hobby: "coding" }
Running with Venv
invokePython("main.py", "Hello to python", {
venvPath: "...", // path to venv folder
});
Running with Conda
invokePython("main.py", "Hello to python", {
venvPath: "...", // conda env
isConda: true,
});
Custom Python Path
invokePython("main.py", "Hello to python", {
pythonPath: "...",
});