Skip to content

tangledgroup/quickjs-cffi

Repository files navigation

quickjs-cffi

PyPI Supported Versions PyPI Downloads Github Downloads License: MIT

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)

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