8000 GitHub - UlionTse/exejs: Run JavaScript code from Python.「髯祭司」是一个旨在使用python运行javascript的库。
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

UlionTse/exejs

Repository files navigation

ExeJS

PyPI - Version Conda - Version PyPI - License PyPI - Python PyPI - Status PyPI - Wheel PyPI - Downloads


Run JavaScript code from Python.

Supported Runtime

ID Runtime Browser Engine Team
1 Node Chrome Google
2 JavaScriptCore Safari Apple
3 SpiderMonkey Firefox Mozilla
4 JScript IE Microsoft
5 PhantomJS Webkit* Apple
6 SlimerJS Gecko* Mozilla
7 Nashorn Java* Oracle

Installation

# PYPI
pip install --upgrade exejs

# Conda
conda install conda-forge::exejs

# Source
git clone https://github.com/UlionTse/exejs.git
cd exejs
python setup.py install

Getting Started

import exejs

# evaluate:
print(exejs.evaluate("'red yellow blue'.split(' ')"))

# call:
print(exejs.compile('function add(x, y) { return x+y; }').call('add', 1, 2))

Reference

PyExecJS (EOL)

Why

  1. We need to run javascript by python, but pyexecjs was EOL in 2018. Issue#1
  2. Package builds that rely on pyexecjs will fail or be cancelled. Issue#2
  3. Because pyexecjs will temporarily write compiled files by default, it will cause antivirus software to issue an alarm and block the program from running. Issue#3

Improvement and Change

  1. Remove the interactive behavior of temporarily writing compiled code locally, and replace it with just-in-time compilation and running.
  2. Remove support for python2.

Excellent Case

ExeJS is currently an important dependency library of Translators.

About

Run JavaScript code from Python.「髯祭司」是一个旨在使用python运行javascript的库。

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0