--- id: dukpy version: "0.6.0" license: MIT license_treatment: permissive maintenance: active --- # dukpy — Simple JavaScript interpreter for Python License: permissive · Maintenance: active · Downloads: 610.6K/mo ## What it is and what it does DukPy embeds a JavaScript interpreter in Python, allowing you to execute JavaScript code directly from Python and get results back as JSON-serializable objects. It also includes built-in transpilers for TypeScript, JSX, and LESS, making it useful for asset pipelines and build workflows that need to run on the server side without spawning external processes. The package supports both one-off code evaluation via `evaljs()` and persistent interpreter instances via `JSInterpreter` for scenarios where bootstrap cost matters. It can load JavaScript modules via `require()` and run ES modules or CommonJS files. Since version 0.6.0, it has no external runtime dependencies—the interpreter is bundled—and supports Python 3.9 through 3.14 across multiple platforms. Use it for: - Transpile TypeScript or JSX on the server during build or request time without invoking external tools. - Evaluate dynamic JavaScript expressions passed as configuration or user input and return results to Python. - Compile LESS stylesheets as part of a Python-based asset pipeline or web framework. - Run JavaScript unit tests or validation logic from within a Python test suite or CI workflow. - Load and execute npm modules in a Python application without a separate Node.js process. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. DukPy is a JavaScript interpreter for Python that runs JavaScript code and transpiles TypeScript, JSX, and LESS without requiring an external runtime. Yes, if you need to run JavaScript or transpile TypeScript/JSX/LESS from Python without external dependencies. The package is actively maintained, has no known vulnerabilities, and supports current Python versions. Install friction is moderate but manageable. Not recommended if you need high-performance JavaScript execution or have complex npm ecosystem dependencies beyond what DukPy's loader can resolve. ## Install pip install dukpy uv add dukpy poetry add dukpy ## Installing dukpy Before you install: Medium install friction due to compiled wheels for multiple platforms and Python versions (3.9–3.14). The package is actively maintained with a recent release (22 days old) and no external runtime dependencies, making it straightforward to deploy once installed. License in practice: Licensed under MIT, a permissive license that allows commercial and private use with minimal restrictions. Quickstart: pip install dukpy import dukpy # Evaluate JavaScript result = dukpy.evaljs("var o = {'value': 5}; o['value'] += 3; o") print(result) # {'value': 8} # Transpile TypeScript ts_code = "class Greeter { constructor(public greeting: string) {} }" js_code = dukpy.typescript_compile(ts_code) # Transpile JSX jsx_result = dukpy.jsx_compile('var react_hello = Hello, world!;') # Compile LESS less_result = dukpy.less_compile('.class { width: (1 + 1) }') Verify before relying: - Whether the package's performance is suitable for production workloads involving large or frequent JavaScript evaluations. - Compatibility and integration details with WebAssets pipelines beyond the documented examples. - Whether npm package installation via dukpy.install_jspackage is fully functional (description excerpt cuts off mid-sentence). ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 610.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags javascript interpreter python, typescript compiler python, jsx transpiler python, less compiler python, run javascript from python, javascript evaluation python, embedded js runtime, javascript-interpreter, transpiler, asset-pipeline [View on SkillFed](https://skillfed.io/packages/dukpy) · [View on PyPI](https://pypi.org/project/dukpy/)