run-python

Run python commands from node

Usage no npm install needed!

<script type="module">
  import runPython from 'https://cdn.skypack.dev/run-python';
</script>

README

run-python

Run python commands from node

Allows you to run python commands from node. You can declare variables, use loops, import modules (useful if you want to port a python package to node) and everything else you can normally use in python. This needs python to be installed.

This module uses promises.

Installation

  1. Install python
  2. Install node and npm (Developed with node v8.1.3)
  3. Install run-python
$ npm i --save run-python

Example

const rp = new (require('run-python'))

rp.run('import os')
.then(() => {
  rp.run('print("test")')
  .then(() => {
    console.log('Finished');
  })
})