starless-crossrunner
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i starless-crossrunner

Weekly Downloads

1

Version

1.0.4

License

ISC

Unpacked Size

9.98 kB

Total Files

7

Last publish

Collaborators

  • jst_htet