Python bindings for the Rust crate 'boa', an embeddable JavaScript engine
Project description
boabem
Boabem (/po.a.bɛm/, 'bo-ah-bem') is a Python binding for the Rust crate boa — an embeddable JavaScript engine.
Run small bits of JavaScript from Python, get back plain Python values, and keep state across evaluations.
Install
Python 3.9+ is required.
- If a prebuilt wheel is available for your platform:
- pip install boabem
- Otherwise, build from source.
Quick start
from boabem import Context
ctx = Context()
ctx.eval("var x = 41")
print(ctx.eval("x + 1")) # 42
print(ctx.eval("'A' + 'B'")) # 'AB'
print(ctx.eval("[1,2,3].length")) # 3
print(ctx.eval("JSON.stringify({a:1})")) # '{"a":1}'
Load code from a file:
from pathlib import Path
from boabem import Context
ctx = Context()
result = ctx.eval_from_filepath(Path("script.js"))
API
- boabem.Context
- eval(source: str) -> Any
- eval_from_bytes(source: str) -> Any (same behavior as eval)
- eval_from_filepath(path: str | os.PathLike[str]) -> Any
- boabem.Undefined
- Sentinel type representing JavaScript
undefined. - String representation: "Undefined".
- Sentinel type representing JavaScript
State persists within a single Context instance between calls. Each Context is isolated from others.
Value mapping (JS -> Python)
- undefined -> boabem.Undefined
- null -> None
- boolean -> bool
- number -> float (NaN/Infinity preserved as float("nan")/float("inf"))
- BigInt -> int
- string -> str
- Array -> list
- Object -> dict
Notes:
- Some JS values (e.g., Symbol) cannot be converted and will raise an error.
- Each
undefinedyou get back is a distinct Python object, but compares equal to anotherUndefined.
Threading and processes
Context is not thread-sendable or picklable:
- Do not move or use a Context across threads (ThreadPoolExecutor will fail).
- Do not send a Context to another process (cannot pickle).
- Create and use a Context only in the thread where it was created.
Errors
- JavaScript exceptions (e.g.,
throw new Error('boom')) raise RuntimeError with the JS message. - Syntax/Reference/Type errors surface as RuntimeError messages (e.g., "SyntaxError", "ReferenceError").
License
Dual-licensed under MIT or Apache-2.0.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file boabem-0.1.0.tar.gz.
File metadata
- Download URL: boabem-0.1.0.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
941aadf19c4a52b5c89cd3f8ea01f57e44a172339c2698ae2a274fac2deeff3c
|
|
| MD5 |
bb3b34e57ea848c57c87a64fd86b6089
|
|
| BLAKE2b-256 |
25aecfa5fd577d0d1f9fb1fab463837561f1bf206af73a2b18751a51bca93c13
|
Provenance
The following attestation bundles were made for boabem-0.1.0.tar.gz:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0.tar.gz -
Subject digest:
941aadf19c4a52b5c89cd3f8ea01f57e44a172339c2698ae2a274fac2deeff3c - Sigstore transparency entry: 421236763
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-win_arm64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-win_arm64.whl
- Upload date:
- Size: 8.1 MB
- Tags: CPython 3.9+, Windows ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17aa5ba43880752995ff0c32b75af73d3858afe97ea4d26e9075fff2422f06f0
|
|
| MD5 |
64615db78b6a12cf9ebdbd622e12210e
|
|
| BLAKE2b-256 |
b07f8854cda3f5fe3b1d10183b5b2b7be9c14b863952b83d6ac91a574bfc2406
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-win_arm64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-win_arm64.whl -
Subject digest:
17aa5ba43880752995ff0c32b75af73d3858afe97ea4d26e9075fff2422f06f0 - Sigstore transparency entry: 421236879
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 8.4 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59f72de0eb3ecbff520f2e49482eb88b34600611d4fa3e372202f405819f363f
|
|
| MD5 |
9fc0996265ea3916e08c47abf3435caf
|
|
| BLAKE2b-256 |
53e2f1658360c85a63df791d943b9b452425974f54c9660c9d772131264dc60e
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-win_amd64.whl -
Subject digest:
59f72de0eb3ecbff520f2e49482eb88b34600611d4fa3e372202f405819f363f - Sigstore transparency entry: 421236784
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 8.5 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d59d666cf5ff98c38e6eab4af9d880866a012601aa05b819308b050d4f22f47
|
|
| MD5 |
c293bd58bc347f8d8d38f5a26df93019
|
|
| BLAKE2b-256 |
199122481a43c8a7f3969bf1a5cd97c006a2f70962f6540b3d117f095fdeb326
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
6d59d666cf5ff98c38e6eab4af9d880866a012601aa05b819308b050d4f22f47 - Sigstore transparency entry: 421236925
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-musllinux_1_2_riscv64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-musllinux_1_2_riscv64.whl
- Upload date:
- Size: 8.5 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ riscv64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4117f2be3fc60a40b00b58f9fbbc989dfaab729eb6defb9851bb22e6bef1e99
|
|
| MD5 |
39c9e073272aef1a4c78d20896cedd6b
|
|
| BLAKE2b-256 |
a74432a5a1812542e2a7da80036c4f040c21827952fc1ecb2b0145937dd87af6
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-musllinux_1_2_riscv64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-musllinux_1_2_riscv64.whl -
Subject digest:
b4117f2be3fc60a40b00b58f9fbbc989dfaab729eb6defb9851bb22e6bef1e99 - Sigstore transparency entry: 421236858
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 8.2 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f18057b9e7af8d4360b402a32d76430f4cbd85c2fa4533fb431e640e10f8a59
|
|
| MD5 |
680237b1c0cbc8ce42ee1d090a6df369
|
|
| BLAKE2b-256 |
5d813bea27b7ef139ddedc86d07f2b2dfecfb23a1f01f9c34b0cb2eeb0db0166
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
6f18057b9e7af8d4360b402a32d76430f4cbd85c2fa4533fb431e640e10f8a59 - Sigstore transparency entry: 421236906
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-manylinux_2_31_riscv64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-manylinux_2_31_riscv64.whl
- Upload date:
- Size: 8.5 MB
- Tags: CPython 3.9+, manylinux: glibc 2.31+ riscv64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
288c4c79bdb2eea7936f7f1eda3f5fd95bbdfc92403b0e10b6cc20a285dd90dc
|
|
| MD5 |
39a467a37da33b3dfb75ecd1feed58ef
|
|
| BLAKE2b-256 |
2ec4c0f7b67e66b88677b359aa5b24fcf117a51679358b99ad4074b5c8b0c6a2
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-manylinux_2_31_riscv64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-manylinux_2_31_riscv64.whl -
Subject digest:
288c4c79bdb2eea7936f7f1eda3f5fd95bbdfc92403b0e10b6cc20a285dd90dc - Sigstore transparency entry: 421236946
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 8.4 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c44ad6080dc605600341fadf7036ea723e02146078b46ee5578019b94abadc5
|
|
| MD5 |
859d2c0d2cef94f9a213599dce075f1a
|
|
| BLAKE2b-256 |
70a4fc29c6618785a01810dc240e984eb6ccc329de974d722f98a62d913be19f
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
0c44ad6080dc605600341fadf7036ea723e02146078b46ee5578019b94abadc5 - Sigstore transparency entry: 421236820
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 8.0 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
877984797c35a70ff4e208fef88f445cb55a55784b506fe2a48e10ce352315aa
|
|
| MD5 |
d30ee923824bc36abcf2d8c82be1e26d
|
|
| BLAKE2b-256 |
bc286fef55b0da67cf8d39b23cc8e2270bf4f38578bfd01a00c63b8dfbaac275
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl -
Subject digest:
877984797c35a70ff4e208fef88f445cb55a55784b506fe2a48e10ce352315aa - Sigstore transparency entry: 421236806
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 8.0 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed3850c0276b1e2f2d657b0e558f9b82fdefa0b68f81c2eb1bcf673ad646f6bb
|
|
| MD5 |
e76f0511803c6b74ba2d99a7dae7e8d4
|
|
| BLAKE2b-256 |
8367646419c64174c3a504bfa221517a7664a891b56beac54d5fc85977f54e1c
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
ed3850c0276b1e2f2d657b0e558f9b82fdefa0b68f81c2eb1bcf673ad646f6bb - Sigstore transparency entry: 421236890
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type:
File details
Details for the file boabem-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: boabem-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 8.2 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f49a7af2e33829b7f60dd5f58d5498bb265cc2b53c57f455b56928d2ae783945
|
|
| MD5 |
455161421afa3ce03c20ee50d4311e75
|
|
| BLAKE2b-256 |
e4fc2ab6372d835c4c265bf502d5d7f1831df346ec158af47df82ada725843ea
|
Provenance
The following attestation bundles were made for boabem-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on Bing-su/boabem
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boabem-0.1.0-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
f49a7af2e33829b7f60dd5f58d5498bb265cc2b53c57f455b56928d2ae783945 - Sigstore transparency entry: 421236842
- Sigstore integration time:
-
Permalink:
Bing-su/boabem@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Bing-su
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5bdf784b02aaaf4f9855b6db6816aa132a7b3850 -
Trigger Event:
push
-
Statement type: