--- id: js2py version: "0.74" license: MIT license_treatment: permissive maintenance: dormant --- # Js2Py — JavaScript to Python Translator & JavaScript interpreter written in 100% pure Python. License: permissive · Maintenance: dormant · Downloads: 837.0K/mo ## 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 above — verify before relying. Js2Py translates and executes JavaScript code in pure Python, supporting ECMAScript 5.1 and experimental ES6 via Babel transpilation, allowing you to run JS functions and libraries directly from Python. 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 pip install js2py uv add js2py poetry add js2py ## Installing Js2Py 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. 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 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. 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 837.0K/month (top 5,000 on PyPI) - Known vulnerabilities: 2 ## Tags javascript interpreter python, run javascript code python, js to python translator, execute javascript from python, javascript library in python, ecmascript 5 python, transpile javascript python, javascript-interpreter, transpiler [View on SkillFed](https://skillfed.io/packages/js2py) · [View on PyPI](https://pypi.org/project/js2py/)