Install & Compatibility
Where this runs
tested against v1.19.4 · 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
py 3.10
✕ build_error
✓ 1.55s
py 3.11
✕ build_error
✓ 1.65s
py 3.12
✕ build_error
✓ 1.5s
py 3.13
✕ build_error
✕ build_error
py 3.9
✕ build_error
✓ 2.15s
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Function
✓ from quickjs import Function
The primary class for executing JavaScript functions.
Context
✓ from quickjs import Context
Allows for lower-level interaction with the QuickJS runtime context, but is thread-hostile.
This example demonstrates how to define and execute a simple JavaScript function using the `quickjs.Function` class. Python values are automatically converted to JavaScript types, and the return value is converted back to a Python type.
from quickjs import Function
# Create a callable JavaScript function from Python
f = Function("f", """
function adder(a, b) {
return a + b;
}
function f(a, b) {
return adder(a, b);
}
""")
# Call the JavaScript function from Python
result = f(1, 2)
print(f"Result of JavaScript function call: {result}")
assert result == 3
Debug
Known issues
gotchaThe `Context` class is thread-hostile, meaning that all interactions with a `Context` instance or objects derived from it must occur within the same Python thread. The `Function` class, however, is designed to be thread-safe.fixPrefer using `Function` for thread-safe operations. If using `Context` directly, ensure all calls are serialized to a single thread or use separate `Context` instances per thread.
affects: All versions
breakingThe official GitHub repository (PetterS/quickjs) linked by PyPI is marked as 'Archived due to lack of maintenance'. While PyPI still shows recent releases (e.g., 1.19.4 in November 2023), this indicates that the primary development source is no longer actively maintained. Future updates, bug fixes, or compatibility with newer Python/QuickJS versions might be uncertain or originate from unlinked forks.fixMonitor PyPI and other community resources for information on alternative forks or maintenance efforts if new features or critical updates are required beyond existing releases.
affects: 1.19.4 and potentially future versions
gotchaInstallation on Windows systems often requires a C++ compiler (e.g., Microsoft C++ Build Tools) if pre-built wheels are not available for your specific Python version and architecture. Without it, `pip install quickjs` may fail during the 'Building wheel' step.fixFor Windows, install 'Desktop development with C++' tools via the Visual Studio Installer. Alternatively, try `pip install --only-binary :all: quickjs` or upgrade Python to a version for which official wheels are provided.
affects: All versions when wheels are unavailable
gotchaQuickJS is a minimalist JavaScript engine and does not include browser-specific APIs like `setTimeout`, `setInterval`, or DOM manipulation functions by default. Attempting to use these will result in `ReferenceError`.fixIf such functionality is required, you must explicitly provide Python implementations to the JavaScript context using `add_callable` or similar mechanisms, or use a more comprehensive JavaScript runtime if browser APIs are essential.
affects: All versions
Upgrade
Version history
1.19.4latest on PyPI · released Nov 19, 2023
Audit
Dependencies
No dependency data recorded yet.
Resources
No resource links recorded.