{"id":24466234,"url":"https://github.com/tangledgroup/quickjs-cffi","last_synced_at":"2026-02-09T23:03:19.880Z","repository":{"id":260654379,"uuid":"881535747","full_name":"tangledgroup/quickjs-cffi","owner":"tangledgroup","description":"Python QuickJS CFFI","archived":false,"fork":false,"pushed_at":"2024-11-28T10:53:41.000Z","size":175,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T04:19:20.425Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tangledgroup.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-31T19:10:15.000Z","updated_at":"2024-11-28T10:53:44.000Z","dependencies_parsed_at":"2025-04-13T11:00:42.137Z","dependency_job_id":null,"html_url":"https://github.com/tangledgroup/quickjs-cffi","commit_stats":null,"previous_names":["tangledgroup/quickjs-cffi"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tangledgroup/quickjs-cffi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fquickjs-cffi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fquickjs-cffi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fquickjs-cffi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fquickjs-cffi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangledgroup","download_url":"https://codeload.github.com/tangledgroup/quickjs-cffi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangledgroup%2Fquickjs-cffi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29284746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-09T21:57:15.303Z","status":"ssl_error","status_checked_at":"2026-02-09T21:57:11.537Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-21T06:14:00.140Z","updated_at":"2026-02-09T23:03:14.874Z","avatar_url":"https://github.com/tangledgroup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# quickjs-cffi\n\n\u003c!--\n[![Build][build-image]]()\n[![Status][status-image]][pypi-project-url]\n[![Stable Version][stable-ver-image]][pypi-project-url]\n[![Coverage][coverage-image]]()\n[![Python][python-ver-image]][pypi-project-url]\n[![License][mit-image]][mit-url]\n--\u003e\n[![PyPI](https://img.shields.io/pypi/v/quickjs-cffi)](https://pypi.org/project/quickjs-cffi/)\n[![Supported Versions](https://img.shields.io/pypi/pyversions/quickjs-cffi)](https://pypi.org/project/quickjs-cffi)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/quickjs-cffi)](https://pypistats.org/packages/quickjs-cffi)\n[![Github Downloads](https://img.shields.io/github/downloads/tangledgroup/quickjs-cffi/total.svg?label=Github%20Downloads)]()\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n**Python** binding for [QuickJS Javascript Engine](https://bellard.org/quickjs/) using **cffi**. Supports **x86_64** and **aarch64** platforms.\n\nNOTE: Currently supported operating system is Linux (`manylinux_2_28` and `musllinux_1_2`)\n\n## Install\n\n```bash\npip install quickjs-cffi\n```\n\n## Features\n\n- ✅ Use **npm** to install packages and use them directly\n- ✅ In case you need to use complex **ECMAScript** or **TypeScript** modules/libraries/packages see [Yjs](https://github.com/yjs/yjs) example below how to use [esbuild](https://esbuild.github.io/) to transpile their code to [QuickJS](https://bellard.org/quickjs/) compatible ECMAScript modules\n- ✅ Import remote and local ECMAScript scripts/modules\n- ✅ Define Python objects and pass them to JavaScript\n- ✅ Define JavaScript objects and pass them to Python\n- ✅ Python objects live in Python environment\n- ✅ JavaScript objects live in JavaScript environment\n- ✅ Freely use Python objects in JavaScript\n- ✅ Freely use JavaScript objects in Python\n\n\n## Usage\n\n```python\nfrom quickjs import JSEval, JSRuntime, JSContext, JSError\n\n# create runtime and context\nrt = JSRuntime()\nctx: JSContext = rt.new_context()\n\n# load lodash from remote location\n# it also accepts local JavaScript files\nctx.load('https://raw.githubusercontent.com/lodash/lodash/refs/heads/main/dist/lodash.min.js')\nlodash: JSValue = ctx['_']\n\n# call lodash.range to create array JavaScript side\n# and return its handler to Python side\nr: JSValue = lodash.range(10, 100, 10)\n\n# on Python side, define JavaScript function\n# and use it to filter JavaScript array\nf0: JSValue = ctx.eval('n =\u003e n \u003e= 50')\nr: JSValue = lodash.filter(lodash.range(10, 100, 10), f0)\n\n# on Python side, define Python function\n# and use on JavaScript side to filter array\ndef f1(n, *args):\n    return n \u003e= 50\n\nr: JSValue = lodash.filter(lodash.range(10, 100, 10), f1)\n\n# on Python side, define Python lambda function\n# and use on JavaScript side to filter array\nf2 = lambda n, *args: n \u003e= 50 # noqa\nr: JSValue = lodash.filter(lodash.range(10, 100, 10), f2)\n\n# on Python side, define pass inplace Python lambda function\n# and use on JavaScript side to filter array\nr: JSValue = lodash.filter(lodash.range(10, 100, 10), lambda n, *args: n \u003e= 50)\n\n# on Python side, define Python lambda function\n# then set it as global function in JavaScript\n# and use it on JavaScript side to filter array\nctx['f3'] = lambda n, *args: n \u003e= 50\nr: JSValue = lodash.filter(lodash.range(10, 100, 10), ctx.eval('f3'))\n```\n\n## Build\n\n```bash\npython -m venv venv\nsource venv/bin/activate\npip install poetry\npoetry install --all-extras\n```\n\n## Demos\n\nFirst setup temp node project, so node modules can be installed and used inside QuickJS examples:\n\n```bash\nnpm init -y\nnpm install esbuild\n```\n\nHuge number of isoloted JavaScript contexts:\n\n```bash\npython -B examples/demo_contexts.py\n```\n\nLodash example:\n\n```bash\nnpm install lodash\npython -B examples/demo_lodash.py\n```\n\nHandlebas example:\n\n```bash\nnpm install handlebars\npython -B examples/demo_handlebars.py\n```\n\nYjs example:\n\n```bash\nnpm install yjs\nesbuild node_modules/yjs/src/index.js --bundle --outfile=examples/yjs.js --format=iife --loader:.ts=ts --global-name=\"Y\"\npython -B examples/demo_yjs.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangledgroup%2Fquickjs-cffi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangledgroup%2Fquickjs-cffi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangledgroup%2Fquickjs-cffi/lists"}