Execute JavaScript Code From Python.
Project description
JS Runner
Run JavaScript From Python.
Installing
pip3 install py_js_runner
How To Use
Note
py_js_runner Uses Node.JS To Run JavaScript Code.
So Make Sure Node.JS Is Installed.
JavaScript
import py_js_runner
# Check If Node.JS Is Installed.
py_js_runner.javascript().check_node() # Gives Error If Not Installed.
# Run JavaScript
py_js_runner.javascript().run("""
// Some JavaScript Comments.
// Blah Blah
// Print Someting
console.log('hello from javascript with python!');
// Some More JavaScript Comments.
// Blah Blah""")
NPM
import py_js_runner
# Check If NPM Is Installed.
py_js_runner.npm().check_npm() # Gives Error If Not Installed.
# Command Line Arguments For NPM
# This Line Will Execute: npm help
py_js_runner.npm().npm_cli("help")
# Check If A NPM Package.
print(py_js_runner.npm().check_if_npm_package()) # Returns Boolean.
# You Can Also Specify Directory To Check If A NPM Package.
print(py_js_runner.npm().check_if_npm_package("./somedirectory"))
# Create NPM Package
py_js_runner.npm().init_npm_package("MY_HELPFUL_PACKAGE_NAME")
# Default Parameters:
# license: str = "MIT"
# author: str = ""
# description: str = ""
# version: str = "1.0.0"
# main: str = "index.js"
# npm_package_path: str = "./"
# Install Packages
py_js_runner.npm().install_packages("nodemon vite")
# Run: npm install
py_js_runner.npm().install()
# Uninstall Packages
py_js_runner.npm().uninstall("nodemon vite")
# Remove NPM Package.
py_js_runner.npm().remove_npm_package() # You Can Specify Path.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py_js_runner-1.0.0.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_js_runner-1.0.0.tar.gz.
File metadata
- Download URL: py_js_runner-1.0.0.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57625767b6fe6a299bf4d0c7bc171db371d85a5ef1a0d3d66f67c5847ebadba1
|
|
| MD5 |
622b6c673be7fc77b0510953bee2c526
|
|
| BLAKE2b-256 |
c07f1a982f8af21b4accf354e98ec4d06b50e26926be73868d4793c55d66dc14
|
File details
Details for the file py_js_runner-1.0.0-py3-none-any.whl.
File metadata
- Download URL: py_js_runner-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
096e153b9b9eefac4e2defbc8f800ee2a932f48f61ea2f06975054a4b5b4cf2e
|
|
| MD5 |
c4673a6c86224170fcf59f54dcad2146
|
|
| BLAKE2b-256 |
3c34f02ce4cc049a9de08a5db8d41e04fcac614efe91c9f13ed44bff8d998bdf
|