Js2Py
JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python.
Decision gist · record as of 2026-08-14
Yes, if you need to run JavaScript from Python and can tolerate dormant maintenance. The pure-Python implementation and low install friction make it convenient for prototyping and light use. No, if you require active bug fixes, ES6 performance, or support for edge-case JavaScript patterns. Check the two known vulnerabilities (GHSA-h95x-26f3-88hr, PYSEC-2026-1476) before production use.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- ES6 support requires importing Babel (a translated JS library), which takes approximately 15 seconds on first import; some edge cases (e.g.
- functions with many arguments, 'with' statement) are not supported.
- Low friction: pure Python wheel with three lightweight runtime dependencies (tzlocal, six, pyjsparser).
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, though you must include the license notice.
last release 2022-11-06 (1377 days) · last repo commit 2024-05-06 · 2,571 stars
2 known vulnerabilities (OSV.dev, 2026-08-14) · 837,010 downloads/mo, #4,931 on PyPI
Alternatives
Verify before relying
pip install js2py
import js2py
# Execute JavaScript inline
result = js2py.eval_js('2 + 3')
print(result) # 5
# Define and call a JS function
add = js2py.eval_js('function add(a, b) {return a + b}')
print(add(10, 20)) # 30- Whether the two known vulnerabilities (GHSA-h95x-26f3-88hr, PYSEC-2026-1476) affect typical usage or are mitigated in version 0.74.
- Whether dormant maintenance status poses a risk for your use case—no active support for new JavaScript features or Python version compatibility issues.
- Performance characteristics when translating or executing large JavaScript files.
What it is and what it does
Js2Py is a pure-Python JavaScript interpreter and translator that lets you execute JavaScript code directly from Python. It works by translating JavaScript to Python bytecode, supporting the full ECMAScript 5.1 standard (except the 'with' statement) and experimental ES6 via Babel transpilation. You can evaluate inline JS expressions, define and call JS functions, access JS objects as Python-like wrappers, and import packages as Python modules.
The package is designed for scenarios where you need to run JavaScript logic without a Node.js runtime or browser. It has three lightweight dependencies (tzlocal, six, pyjsparser) and installs as a pure Python wheel, making it easy to deploy. However, it is dormant—last updated in late 2022—so it receives no active maintenance. ES6 support is experimental and slow. Edge cases in complex JavaScript may not translate correctly.
Use it for
- Execute JavaScript snippets or algorithms from Python without spawning a separate runtime.
- Translate JavaScript files to Python for static analysis, testing, or integration into Python-only environments.
- Prototype or test JavaScript logic in a Python REPL without leaving the Python ecosystem.
- Build Python applications that need to interoperate with JavaScript logic or libraries.
- Access JavaScript object APIs and methods from Python code.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to run JavaScript from Python and can tolerate dormant maintenance.
The pure-Python implementation and low install friction make it convenient for prototyping and light use. No, if you require active bug fixes, ES6 performance, or support for edge-case JavaScript patterns. Check the two known vulnerabilities (GHSA-h95x-26f3-88hr, PYSEC-2026-1476) before production use.
Install
js2py on PyPI
Before you install
Low friction: pure Python wheel with three lightweight runtime dependencies (tzlocal, six, pyjsparser). Maintenance is dormant—last release November 2022, last commit May 2024—so expect no active bug fixes or feature updates.
ES6 support requires importing Babel (a translated JS library), which takes approximately 15 seconds on first import; some edge cases (e.g. functions with many arguments, 'with' statement) are not supported.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, though you must include the license notice.
Quickstart
pip install js2py
import js2py
# Execute JavaScript inline
result = js2py.eval_js('2 + 3')
print(result) # 5
# Define and call a JS function
add = js2py.eval_js('function add(a, b) {return a + b}')
print(add(10, 20)) # 30
Verify before relying
- Whether the two known vulnerabilities (GHSA-h95x-26f3-88hr, PYSEC-2026-1476) affect typical usage or are mitigated in version 0.74.
- Whether dormant maintenance status poses a risk for your use case—no active support for new JavaScript features or Python version compatibility issues.
- Performance characteristics when translating or executing large JavaScript files.
Package facts
| License | MIT permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 3 packagestzlocalsixpyjsparser |
| Maintenance | Dormant 1,377 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 837,010 / month, #4,931 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | 2 GHSA-h95x-26f3-88hr, PYSEC-2026-1476 |
Evidence: Js2Py-0.74-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “js to python translator”
- Js2PyJs2Py translates and executes JavaScript code in pure Python,…
- Js2Py-3.13Js2Py translates and executes JavaScript code (ECMAScript 5.1, with…
- jsminMinifies JavaScript code by removing unnecessary characters while…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also Js2Py-3.13 · pyjsparser · dukpy · groovy · pscript · py-mini-racer · CoffeeScript · mini-racer · esprima2 · esprima