Skip to content

Repository files navigation

Just install with

pip install quickjs

Windows binaries are provided for Python 3.7, 64-bit.

Usage

fromquickjsimportFunctionf=Function("f", """ function adder(a, b) { return a + b; } function f(a, b) { return adder(a, b); } """)
assertf(1, 2) ==3

Simple types like int, floats and strings are converted directly. Other types (dicts, lists) are converted via JSON by the Function class. The library is thread-safe if Function is used. If the Context class is used directly, it can only ever be accessed by the same thread. This is true even if the accesses are not concurrent.

Both Function and Context expose set_memory_limit and set_time_limit functions that allow limits for code running in production.

For full functionality, please see test_quickjs.py.

Developing

Use a pipenv shell and make test should work from inside its virtual environment.

About

Thin Python wrapper of https://bellard.org/quickjs/

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages