quickjs-cffi
Python binding for QuickJS Javascript Engine using cffi. Supports x86_64 and aarch64 platforms.
NOTE: Currently supported operating system is Linux (manylinux_2_28 and musllinux_1_2)
Install
pip install quickjs-cffi
Features
- ✅ Use npm to install packages and use them directly
- ✅ In case you need to use complex ECMAScript or TypeScript modules/libraries/packages see Yjs example below how to use esbuild to transpile their code to QuickJS compatible ECMAScript modules
- ✅ Import remote and local ECMAScript scripts/modules
- ✅ Define Python objects and pass them to JavaScript
- ✅ Define JavaScript objects and pass them to Python
- ✅ Python objects live in Python environment
- ✅ JavaScript objects live in JavaScript environment
- ✅ Freely use Python objects in JavaScript
- ✅ Freely use JavaScript objects in Python
Usage
from quickjs import JSEval, JSRuntime, JSContext, JSError
# create runtime and context
rt = JSRuntime()
ctx: JSContext = rt.new_context()
# load lodash from remote location
# it also accepts local JavaScript files
ctx.load('https://raw.githubusercontent.com/lodash/lodash/refs/heads/main/dist/lodash.min.js')
lodash: JSValue = ctx['_']
# call lodash.range to create array JavaScript side
# and return its handler to Python side
r: JSValue = lodash.range(10, 100, 10)
# on Python side, define JavaScript function
# and use it to filter JavaScript array
f0: JSValue = ctx.eval('n => n >= 50')
r: JSValue = lodash.filter(lodash.range(10, 100, 10), f0)
# on Python side, define Python function
# and use on JavaScript side to filter array
def f1(n, *args):
return n >= 50
r: JSValue = lodash.filter(lodash.range(10, 100, 10), f1)
# on Python side, define Python lambda function
# and use on JavaScript side to filter array
f2 = lambda n, *args: n >= 50 # noqa
r: JSValue = lodash.filter(lodash.range(10, 100, 10), f2)
# on Python side, define pass inplace Python lambda function
# and use on JavaScript side to filter array
r: JSValue = lodash.filter(lodash.range(10, 100, 10), lambda n, *args: n >= 50)
# on Python side, define Python lambda function
# then set it as global function in JavaScript
# and use it on JavaScript side to filter array
ctx['f3'] = lambda n, *args: n >= 50
r: JSValue = lodash.filter(lodash.range(10, 100, 10), ctx.eval('f3'))
Build
python -m venv venv
source venv/bin/activate
pip install poetry
poetry install --all-extras
Demos
First setup temp node project, so node modules can be installed and used inside QuickJS examples:
npm init -y
npm install esbuild
Huge number of isoloted JavaScript contexts:
python -B examples/demo_contexts.py
Lodash example:
npm install lodash
python -B examples/demo_lodash.py
Handlebas example:
npm install handlebars
python -B examples/demo_handlebars.py
Yjs example:
npm install yjs
esbuild node_modules/yjs/src/index.js --bundle --outfile=examples/yjs.js --format=iife --loader:.ts=ts --global-name="Y"
python -B examples/demo_yjs.py
Metadata
Release files for quickjs-cffi 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 38.2 MB
Release files / quickjs_cffi-0.1.3-pp310-pypy310_pp73-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-pp310-pypy310_pp73-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 PyPy 3.10 PyPy 3.10 7.3 |
|
SHA-256 checksum How to use checksums |
f85a44a638b8db4b0bd8ef1a0bf25965cd14d8a6bf94eddc40d4cd686f68a151
|
|
BLAKE2b-256 checksum How to use checksums |
64f27fe57f7e891075caf0087bb135e8eab4ed3e78ccaf20d092bc6558110864
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-pp310-pypy310_pp73-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-pp310-pypy310_pp73-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 PyPy 3.10 PyPy 3.10 7.3 |
|
SHA-256 checksum How to use checksums |
263cf3f62fb055b3a9266d95768b628fc09de96c46fb2cba72f138c33ef5c768
|
|
BLAKE2b-256 checksum How to use checksums |
1fd20348e95e3653c0b1aa3e3e385461b3a8d4f58a00e95e2c88280ff4663d93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp313-cp313-musllinux_1_2_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp313-cp313-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.13 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
c863c072d85b712051ab98603215e0cf1e54e045c8fc1a47d9bafc21b739f56e
|
|
BLAKE2b-256 checksum How to use checksums |
f94324a5bf732404601be8a0f6c80097ade0fd3e09e6518564a577025ebef6a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp313-cp313-musllinux_1_2_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp313-cp313-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.13 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
afaac20d6816ccdde714f2f7a096633b4e0e43a16b6dcf8dd59d6c8fef0fc4fa
|
|
BLAKE2b-256 checksum How to use checksums |
ea109ae400062fa58b818c236a1b34cfb03f0af1d42c840ce078781f7e9a702d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp313-cp313-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
50c8b59d6096f06594128d3ece82e3168e03376cec4a68de0a8f51baedab546b
|
|
BLAKE2b-256 checksum How to use checksums |
209a7c853b9820b761304444501cc404a2b8ec01d36a50eb8481dfd564476698
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp313-cp313-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp313-cp313-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
8cfb30b7d7643ba0b9c612f774c7b8805936e0594c9b931855384d79138e24bc
|
|
BLAKE2b-256 checksum How to use checksums |
69a6b3bdf2a6c0964c9fb2abd795823ea78358db61811adb69894fc458076a14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp312-cp312-musllinux_1_2_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp312-cp312-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.12 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
a1c88946f620205380f47d9ce6efe89804bdbf3653f9d878ad587e1ec30b24c0
|
|
BLAKE2b-256 checksum How to use checksums |
fd83e4af7e43411b35a9cbf3fb623661f9f172f064a78a1c49fc15c45c455d26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp312-cp312-musllinux_1_2_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp312-cp312-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.12 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
e8c3da920d39a521a85165eb8f6de6fb1fcb53e70ef7cec3c385a5968295fa40
|
|
BLAKE2b-256 checksum How to use checksums |
933e38fc5befa1e1e87d06c2b6ef34975c92107efef550f18239d3df4101549a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp312-cp312-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
bc239d1e40a7a6e9721340aa95b660c0cdf26bffab1c59444165299611915c4c
|
|
BLAKE2b-256 checksum How to use checksums |
5cb9a1b58cc70e8cd86012830919f339e6483d33a905947e954ad09fe1047b41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp312-cp312-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp312-cp312-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
d6a4462d091936ff5296cf6de179a1c3e01c9cead18ae17b9de99d6cdee1d131
|
|
BLAKE2b-256 checksum How to use checksums |
c9bca2b085280847cbc06d82f25c4e09db46fa8dbe3867c13f83e963894d3e63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp311-cp311-musllinux_1_2_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp311-cp311-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.11 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
a94c98cc4e9d6425bb0e9419d4d39f0127eab95a548ddd538bf1ad6feebf0e27
|
|
BLAKE2b-256 checksum How to use checksums |
2c29cc7e0cd3c38a0a1b07c7e52c791d67343d7bc5e0058f3a8da7703f6d399c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp311-cp311-musllinux_1_2_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp311-cp311-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.11 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
2d37bc49b09596d969bc0d76beb4b64dc8d57e7f696da916744a54ee3478b4f7
|
|
BLAKE2b-256 checksum How to use checksums |
46fa2a1388565e3c9ee0b888b5470a92f09d3e257d4f767804e149d7e2c4d512
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp311-cp311-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2084e3f051c4da5cc2e2d46eda05a1082b279906bf1eaed707d4e08f320250a2
|
|
BLAKE2b-256 checksum How to use checksums |
b5c25d9cab6be4bc86b16882ba6a947bd94f936a0f74249bd9f868775f25c778
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp311-cp311-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp311-cp311-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
01077959d7302ec538fdf35169186fc33b40c8fa08f2fb02803ba8a221dffd86
|
|
BLAKE2b-256 checksum How to use checksums |
bb9a2a3f9b96a41d40de9fca543912a23a75d54a846f4c80d71e1a379544550e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp310-cp310-musllinux_1_2_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp310-cp310-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
d31c114951973d4d5f31ef46658b4451564af2cd4573caf3588d19f79336047e
|
|
BLAKE2b-256 checksum How to use checksums |
c00b64b56cb22d13b54b0401523ce2fb35f1920f1e7fc342fda3f2b28533e1cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp310-cp310-musllinux_1_2_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp310-cp310-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
9dca0831aeb86ae3e5b18b2231aca36262f4eabf7bef88f044fee724e46a50a5
|
|
BLAKE2b-256 checksum How to use checksums |
a219067e6f3f1bf8a2057771a0b097078c89a3d7e4c5e5bacee776d601ed7cee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp310-cp310-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | quickjs_cffi-0.1.3-cp310-cp310-manylinux_2_28_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
66b8ed319b6df71475ae925d9b963c2bcbd35851936d93f2e806a36d6bf51eff
|
|
BLAKE2b-256 checksum How to use checksums |
3e042fbb96c30c81489a50c7079335c15a40c30ffb6d8bf1250078c0fe4894b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Release files / quickjs_cffi-0.1.3-cp310-cp310-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | quickjs_cffi-0.1.3-cp310-cp310-manylinux_2_28_aarch64.manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
caec37e2d8059f2896eb07e78f8d044d27fb8b3d658514334bbd0c66f69c927d
|
|
BLAKE2b-256 checksum How to use checksums |
990649811f019cf923363e842d052dab362ade95b6be32045ca77fc6df26d7ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.7 Linux/6.12.1-arch1-1
|
Security for quickjs-cffi 0.1.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.