wasm-runtime
WebAssembly-powered, sandboxed implementation of Python runtime for safely exec()-cuting dynamic Python code.
This is an active version of wasm_exec created by Justin Flick.
See Jflick58/wasm_exec/LICENSE and ● wasm_runtime/LICENSE.
$ pip install wasm-runtime
Use
from wasm_runtime import WasmRuntime
runtime = WasmRuntime()
result = runtime.exec("print('Hi, Mom!')")
print(result)
# Result(stdout='Hi, Mom!\n', stderr='', ...)
class WasmRuntime
__init__(
self,
use_fuel: bool = False,
fuel: int = 400_000_000,
runtime_path: str = ""
)
Creates a new instance of WebAssembly runtime.
Original code by Justin Flick.
Args:
- use_fuel (
bool): Whether to use fuel. - fuel (
int): Fuel. - runtime_path (
str): Runtime path. If not specified, the runtime will be downloaded automatically.
def exec
exec(self, code: str) -> Result
Execute Python code.
Args:
- code (
str): Python code.
dataclass Result
stdout: str
stderr: str
memory_size: int
data_len: int
fuel_consumed: int
Metadata
Release files for wasm-runtime 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| wasm-runtime-0.2.tar.gz | 4.8 kB | Without provenance | Details |
Release files / wasm-runtime-0.2.tar.gz
| Download URL | wasm-runtime-0.2.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
431f9530e3dbf1bfcd2bc93997e6092198131197b4457199109d1b79d7792b55
|
|
BLAKE2b-256 checksum How to use checksums |
7d7ad01f4ebb5fda2f64be741d041e72fbddbebbde103bb5b4e9d7ee0b443a1b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.9
|
Security for wasm-runtime 0.2
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.