1.0.4 • Published 2 years ago

starless-crossrunner v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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: "...",
});
1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago