Call and interop Node.js APIs with Python
Low maintenance activity. Last release 14 months ago, commits in 0 of the last 26 weeks. Weaker on commit activity and recent releases.
Consider insteadpythonmonkeyPythie’s Index: 7288.1K downloads/moCompare →
pip install javascriptJSPyBridge
Interoperate Node.js and Python. You can run Python from Node.js, or run Node.js from Python. Work in progress.
Requires Node.js 18 and Python 3.8 or newer.
Key Features
- Ability to call async and sync functions and get object properties with a native feel
- Built-in garbage collection
- Bidirectional callbacks with arbitrary arguments
- Iteration and exception handling support
- Object inspection allows you to easily
console.logorprint()any foreign objects - (Bridge to call Python from JS) Python class extension and inheritance. See pytorch and tensorflow examples.
- (Bridge to call JS from Python) Native decorator-based event emitter support
- (Bridge to call JS from Python) First-class Jupyter Notebook/Google Colab support. See some Google Colab uses below.
Basic usage example
See some examples here. See documentation below and in here.
Access JavaScript from Python
pip install javascript
from javascript import require, globalThis
chalk, fs = require("chalk"), require("fs")
print("Hello", chalk.red("world!"), "it's", globalThis.Date().toLocaleString())
fs.writeFileSync("HelloWorld.txt", "hi!")