skillfed

Js2Py-3.13

JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python.

js2py-3-13 v0.74.1 179.0K downloads/30d#10,181 on PyPI2,571
Permissive license MIT DORMANT released

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-13

uv

uv add js2py-3-13

poetry

poetry add js2py-3-13

Installing 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

javascript interpreter pythonrun js code in pythonjavascript to python translatorexecute javascript from pythonnpm packages in pythonecmascript 5 pythonjavascript evaluation python
javascript-interopcode-translationinterpreter

More Software Development packages