Js2Py-3.13
JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python.
What it is and what it does
Js2Py is a pure-Python JavaScript interpreter and translator that lets you execute JavaScript code from within Python applications. It translates ECMAScript 5.1 code to Python and can execute it, or evaluate JavaScript expressions directly. The package supports importing npm modules as if they were Python libraries, converting JavaScript objects to Python types automatically, and even provides experimental ES6 support by internally using Babel to downgrade ES6 to ES5 before translation.
The package is useful when you need to run untrusted or third-party JavaScript logic without spawning a Node.js process, integrate JavaScript libraries into Python workflows, or parse and analyze JavaScript code. It has three runtime dependencies (tzlocal, six, pyjsparser) and installs with low friction. However, maintenance is dormant—the last commit was in May 2024—so active development has stalled and edge cases in the translator may not be addressed.
Use it for:
- Execute JavaScript functions from Python without a Node.js dependency, such as running crypto-js for encryption/decryption workflows
- Import and use npm packages directly in Python code by translating them on the fly with js2py.require()
- Parse JavaScript files to an AST for analysis or transformation using js2py.parse_js()
- Translate standalone JavaScript files to Python modules for offline use with js2py.translate_file()
- Test JavaScript logic in a Python test suite without spawning external processes
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Js2Py translates and executes JavaScript code (ECMAScript 5.1, with experimental ES6 support) directly in Python, enabling you to run JS functions, evaluate expressions, and import npm packages without a JavaScript runtime.
Yes, if you need lightweight JavaScript execution in Python and can tolerate dormant maintenance. The package is stable for ECMAScript 5.1 code, has no known vulnerabilities, and installs easily. However, avoid it if you rely on active bug fixes, ES6 features beyond experimental status, or performance-critical JavaScript translation—consider a Node.js subprocess or headless browser for those cases.
Install
js2py-3-13 on PyPI
pip
pip install js2py-3-13uv
uv add js2py-3-13poetry
poetry add js2py-3-13Installing Js2Py-3.13
Before you install
Low friction: pure Python package with only three runtime dependencies (tzlocal, six, pyjsparser). Maintenance is dormant—last commit was 2024-05-06 and no release activity since 2025-02-07—so expect no active bug fixes or feature updates.
License in practice
MIT license is permissive, allowing use in commercial and proprietary projects with minimal restrictions; you must include a copy of the license and acknowledge the original author.
Quickstart
import js2py
# Evaluate a simple expression
result = js2py.eval_js('2 + 3')
print(result) # 5
# Define and call a JavaScript function
add = js2py.eval_js('function add(a, b) {return a + b}')
print(add(1, 2)) # 3
Verify before relying
- Whether Python 2 support (mentioned in description) is still functional or tested in version 0.74.1
- Performance characteristics when translating or executing large JavaScript files (description mentions 50k+ line files)
- Stability of ES6 support beyond the experimental label—what edge cases remain unsupported
- Whether the 15-second Babel import overhead (mentioned in description) is acceptable for typical use cases
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — tzlocal, six, pyjsparser |
| Maintenance | dormant — 553 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 179,003/month — #10,181 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: Js2Py_3.13-0.74.1-py3-none-any.whl
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
Js2PyJs2Py translates and executes JavaScript code…
permissive · top 5,000 on PyPI
pyjsparserParses JavaScript source code into an abstract…
permissive · top 15,000 on PyPI
dukpyDukPy is a JavaScript interpreter for Python…
permissive · top 15,000 on PyPI
esprima2Parses and tokenizes JavaScript code up to ECMA…
permissive · top 15,000 on PyPI
py-mini-racerEmbeds a modern V8 JavaScript engine in Python,…
permissive · top 5,000 on PyPI
esprimaEsprima parses ECMAScript (JavaScript) source…
permissive · top 15,000 on PyPI
mini-racerEmbeds Google's V8 JavaScript engine in Python,…
permissive · top 5,000 on PyPI
quickjs-rsExecutes JavaScript code inside a WebAssembly…
permissive · top 15,000 on PyPI
pscriptPScript compiles a Python subset to JavaScript,…
unclear · top 15,000 on PyPI
groovyTranspiles Python functions to JavaScript,…
permissive · top 5,000 on PyPI