Skip to main content

quickjs-py

Python bindings for QuickJS, Fabrice Bellard's small and embeddable JavaScript engine.

The QuickJS engine is included as a git submodule and compiled directly into the extension, so there is no external dependency on a system QuickJS install.

Installation

Install the latest release from PyPI:

pip install quickjs-bindings

From source

To build from a checkout, the engine lives in a git submodule, so initialise it first:

git submodule update --init
pip install -e .

A C compiler and the Python development headers are required to build the extension.

QuickJS uses GCC extensions and POSIX headers and cannot be compiled with MSVC. On Windows install mingw-w64 (for example choco install mingw) and make sure gcc is on PATH; the build selects the mingw toolchain automatically. Linux and macOS use the system GCC/Clang.

Quick start

import quickjs

# One-off evaluation
print(quickjs.eval("1 + 2"))            # 3

# A reusable context
ctx = quickjs.Context()
ctx.eval("var counter = 0;")
ctx.eval("counter += 10;")
print(ctx.eval("counter"))              # 10

# Pass Python values into JS
ctx.set("data", {"name": "Ada", "scores": [90, 95]})
print(ctx.eval("data.scores[1]"))       # 95

# Expose Python callables to JS
ctx.set("greet", lambda name: f"hi {name}")
print(ctx.eval('greet("world")'))       # hi world

# Convert JS values back to Python
result = ctx.eval("({a: 1, b: [2, 3]})")
print(result.to_python())               # {'a': 1, 'b': [2, 3]}

# JS errors surface as Python exceptions
try:
    ctx.eval('throw new Error("boom")')
except quickjs.JSError as exc:
    print(exc)                          # Error: boom

Architecture

  • quickjs._quickjs - a C extension wrapping the QuickJS C API (Runtime, Context, Value).
  • quickjs - the public package re-exporting those types plus convenience helpers.

See CLAUDE.md for the full design and TODO.md for the roadmap.

Documentation

  • docs/api.md - full API reference for Runtime, Context and Value.
  • examples/ - runnable example scripts; see examples/README.md.
  • CHANGELOG.md - release history.

Type conversion

Python JavaScript
None null
bool boolean
int number / bigint
float number
str string
bytes ArrayBuffer
list / tuple Array
dict Object
callable function

JS objects, arrays and functions returned to Python are wrapped as quickjs.Value. Call .to_python() to recursively convert arrays/objects into native list/dict structures.

JS null becomes Python None; JS undefined becomes the distinct quickjs.Undefined singleton.

More features

import quickjs

ctx = quickjs.Context()

# Compile once, run many times (and serialise to bytecode)
compiled = ctx.compile("Math.PI * r * r")
blob = compiled.write_object()
restored = ctx.read_object(blob)

# ArrayBuffer / TypedArray access
buf = ctx.new_array_buffer(b"\x01\x02\x03")
ctx.eval("new Uint8Array([4, 5, 6])").to_bytes()      # b'\x04\x05\x06'

# Embed an arbitrary Python object opaquely inside JS
handle = ctx.new_host_object(open("data.txt"))         # round-trips unchanged

# Accessor properties backed by Python callables
obj = ctx.new_object()
obj.define_property("now", get=lambda: __import__("time").time())

# Custom ES module loader
ctx.set_module_loader(lambda name: MODULES.get(name))
ctx.eval("import { x } from 'mod';", module=True)

# Run async JS: async_eval pumps the job queue until the result settles
ctx.eval("async function add(a, b) { return await Promise.resolve(a + b); }")
ctx.async_eval("add(2, 3)")                            # -> 5

# await_promise bridges QuickJS promises into asyncio
async def main():
    return await ctx.await_promise(ctx.eval("add(40, 2)"))   # -> 42

# Engine memory counters
ctx.runtime.compute_memory_usage()                     # -> dict

# Context manager
with quickjs.Context() as c:
    c.eval("1 + 1")

Testing

pip install pytest
pytest -q

License

MIT. The vendored QuickJS sources are under the MIT license; see vendor/quickjs/LICENSE.

Metadata

Release files for quickjs-bindings 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quickjs-bindings 0.1.1
File Size Uploaded Provenance
quickjs_bindings-0.1.1.tar.gz 591.9 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for quickjs-bindings 0.1.1
File
quickjs_bindings-0.1.1-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
quickjs_bindings-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
quickjs_bindings-0.1.1-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
quickjs_bindings-0.1.1-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
quickjs_bindings-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
quickjs_bindings-0.1.1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
quickjs_bindings-0.1.1-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
quickjs_bindings-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
quickjs_bindings-0.1.1-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details

Total release size: 10.8 MB

Release files / quickjs_bindings-0.1.1.tar.gz

Download URL quickjs_bindings-0.1.1.tar.gz
Size 591.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f18ae265c9c360580714e114442b45d4cb01f69fff6f7026c8f4aed8be034c71
BLAKE2b-256 checksum
How to use checksums
7d5fc8313ea2b765b3382636a7d64553cae9a86df6cd9e8634c7fed81603f532
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp313-cp313-win_amd64.whl

Download URL quickjs_bindings-0.1.1-cp313-cp313-win_amd64.whl
Size 460.9 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
ae804edf6c763fcc544339c4da79fcdcb9fb67fabd5de84db52ef60dbf5ba780
BLAKE2b-256 checksum
How to use checksums
4e1eb5b1f205eb7cb6a458eb5e29a4ad0a94aafd7e89bac970514d26eedd1485
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL quickjs_bindings-0.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.4 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
99c67b6a7f874d819ecda862498d172154bd57c5b20b37b9d05ed629c18cd0e2
BLAKE2b-256 checksum
How to use checksums
057f0ad5e3edfe9e76149cd1954d638ff236b0a1b17dc2b82791c2bd5a1d073e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp313-cp313-macosx_11_0_arm64.whl

Download URL quickjs_bindings-0.1.1-cp313-cp313-macosx_11_0_arm64.whl
Size 511.4 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a7d00d759c84c3878cb812869fed3c6f9c5854424d7f744de9d7d24e7508777e
BLAKE2b-256 checksum
How to use checksums
4d2476f4c6041e58cae9af89c73ed9e41c1901d34220a4717613b9d634771876
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp311-cp311-win_amd64.whl

Download URL quickjs_bindings-0.1.1-cp311-cp311-win_amd64.whl
Size 460.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
19fcb9845fd29e54c62753dc7a1b2eaee745e4e27ccaaa86f0846af1cd147e9b
BLAKE2b-256 checksum
How to use checksums
1e4b83e210ee47a3efeaa117539ede27a75c67ad1052ffbf89e3336c5f747e02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL quickjs_bindings-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.4 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
40969870dd8d493f2089ad98f706d4472a7a4fcc776e059c3bf528e9fc5f8154
BLAKE2b-256 checksum
How to use checksums
5b813e104d6ad606774d3c3d9aa272e9a4db30b9c97b9400a5156d825d44ff67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp311-cp311-macosx_11_0_arm64.whl

Download URL quickjs_bindings-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Size 511.2 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
76f3af2d9812de752de071c1ba0c7097e0586a37ab11deacfce2c64796491ce3
BLAKE2b-256 checksum
How to use checksums
228cd60f4b1294bdcf817618a26a1e44bf38099130973f93e7a59a9ffd18ff26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp39-cp39-win_amd64.whl

Download URL quickjs_bindings-0.1.1-cp39-cp39-win_amd64.whl
Size 460.1 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
bfadbdc2fbc5e289543b4f212baacc9360cc51a8a3612b4ff38045c0d787897e
BLAKE2b-256 checksum
How to use checksums
7f029788059dec8830455e500e83058643ab34483f0909fbf8d05b7b7452e7b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL quickjs_bindings-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 2.4 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
68622f17f05afbd922b474a32a0aac3df09e6857ff902170ae1269093c38748b
BLAKE2b-256 checksum
How to use checksums
f0bfdcd3e7ab1a1311e3f7c829cd0ed3da30bdd7fa1568e4dd0834013dd98d01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Release files / quickjs_bindings-0.1.1-cp39-cp39-macosx_11_0_arm64.whl

Download URL quickjs_bindings-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Size 511.3 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c3e2a49610ceb40ec2b722c0369547e084226289a942c539ce6dcad09b77bdf7
BLAKE2b-256 checksum
How to use checksums
01bc69ef2b8ca883b6aa325d1ced9bbb44df9b2432f4896399161414beafc64d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

Security for quickjs-bindings 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 10 files in this release have been uploaded with provenance metadata.

Select from 10 files

Attestation for quickjs_bindings-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

10 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page