Skip to main content

Run JavaScript code from Python.

Project description

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 (except JScript), and replace it with just-in-time compilation and running.
  2. Remove support for python2.
  3. Support async.

Excellent Case

ExeJS is currently an important dependency library of Translators.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

exejs-0.0.7.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

exejs-0.0.7-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file exejs-0.0.7.tar.gz.

File metadata

  • Download URL: exejs-0.0.7.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for exejs-0.0.7.tar.gz
Algorithm Hash digest
SHA256 238d93442f7ba1ac4f156c16d599a89514a57ae46d3f0cd230dd69459fa94c39
MD5 b789c77adb3babdffa4574fb431444a9
BLAKE2b-256 63cde308640d52ddd471d6a26aceff8d8e90557adc0a83fb488e4e60876dee22

See more details on using hashes here.

File details

Details for the file exejs-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: exejs-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for exejs-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ba92cd72ecc5070789bd2418578f69fe2ea1de9942c0a90185449e855f283201
MD5 f0a4a1a0b6753174ff2877b739f6bedc
BLAKE2b-256 b42fa9786ef0130b2de80ed2273a43e0ca7c86333ac61de6b6c9b4307b8fd66b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page