Registry / http-networking / dukpy
library0.5.1pypypi✓ verified 84d ago

DukPy is a simple, lightweight JavaScript interpreter for Python, embedding the Duktape JavaScript engine. It allows executing JavaScript code directly from Python applications. As of version 0.5.1, it supports modern Python versions (up to 3.14) and maintains a steady release cadence, often aligning with new Python releases or Duktape engine updates.

pip install dukpy
INSTALL
IMPORT
SIG · DUKPY
D
dukpy
http-networkingpythonv0.5.1
Install
1.7s avg
Import
Disk
26MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.5.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 27.3MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.000s · 29MB
26MB installed
● package 26MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

JSInterpreter
from dukpy import JSInterpreter
import dukpy; dukpy.evaljs(...)

Demonstrates basic JavaScript evaluation, passing data from Python to JavaScript, and calling Python functions from within JavaScript.

import dukpy # Basic JavaScript evaluation result = dukpy.evaljs("1 + 2") print(f"1 + 2 = {result}") # Passing data to JavaScript result = dukpy.evaljs("a + b", data={'a': 10, 'b': 20}) print(f"a + b (with data) = {result}") # Calling Python functions from JavaScript def my_python_sum(x, y): return x + y js_code = "var sum = my_python_sum(5, 7); sum;" result = dukpy.evaljs(js_code, python_functions={'my_python_sum': my_python_sum}) print(f"JS calling Python function = {result}")
Debug
Known issues
breakingSupport for older Python versions (2.x, 3.4-3.6) has been deprecated and eventually removed. Modern versions of DukPy require Python 3.7+.
fix
Upgrade Python to version 3.7 or newer. If legacy Python is unavoidable, use an older DukPy version (not recommended).
affects: <0.3.0
gotchaVersions prior to 0.4.0 might crash or produce incorrect output when handling JavaScript strings containing unicode emoji or other non-Basic Multilingual Plane (BMP) characters, due to encoding issues.
fix
Upgrade to DukPy 0.4.0 or newer, which switched to CESU-8 encoding for better Unicode handling.
affects: <0.4.0
gotchaVersions prior to 0.2.2 contained a memory leak in the `dukpy.evaljs` function, which could lead to increased memory consumption in long-running applications.
fix
Upgrade to DukPy 0.2.2 or newer to benefit from the memory leak fix.
affects: <0.2.2
gotchaWhen using `python_functions` to expose Python callables to JavaScript, ensure the function name matches exactly. Older versions (pre-0.3.1) might provide less informative error messages if the function is not found.
fix
Upgrade to DukPy 0.3.1 or newer for improved error messages, and always double-check function names when setting up Python callbacks.
affects: <0.3.1
gotchaIf pre-built wheels are not available for your specific platform/Python version, `pip install dukpy` will attempt to build from source, which requires a C compiler (e.g., GCC or Clang) installed on your system.
fix
Ensure a C compiler is installed, or use an environment where pre-built wheels are provided (e.g., common Linux distros, macOS, Windows with official Python releases).
affects: All versions (when building from source)
Upgrade
Version history
0.5.1latest on PyPI · released Feb 7, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
1
Resources
dukpy — pip install dukpy · libregistry