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
muslpy 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 27.3MB
glibcpy 3.10–3.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+.fixUpgrade 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.fixUpgrade 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.fixUpgrade 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.fixUpgrade 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.fixEnsure 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.