Skip to main content

hyperlight-sandbox

Python API package for running code inside Hyperlight sandboxes with separately installable backends and packaged guest packages.

Quick Start

from hyperlight_sandbox import Sandbox

sandbox = Sandbox(backend="wasm", module="python_guest.path")
sandbox.register_tool("add", lambda a=0, b=0: a + b)

result = sandbox.run("""
result = call_tool('add', a=3, b=4)
print(result)
""")
print(result.stdout)  # "7\n"

Install the local repo packages for development with:

uv sync          # installs core + guest packages via workspace
just python-build  # builds maturin backends

Packaged guest packages expose importable module references such as python_guest.path and javascript_guest.path. The API resolves those to the packaged .aot artifact automatically.

Example dependency sets:

  • Sandbox(backend="wasm", module="python_guest.path") requires hyperlight-sandbox[wasm,python_guest]
  • Sandbox(backend="wasm", module="javascript_guest.path") requires hyperlight-sandbox[wasm,javascript_guest]
  • Sandbox(backend="hyperlight-js") requires hyperlight-sandbox[hyperlight_js]

Use Sandbox(backend="wasm", module="javascript_guest.path") to run the packaged JavaScript Wasm guest package.

Use Sandbox(backend="hyperlight-js") to run the separate HyperlightJS backend package.

Snapshot Semantics

  • snapshot() captures guest runtime state and backend-managed sandbox files.
  • restore() rewinds both runtime state and sandbox file state to the snapshot point.
  • Output files under /output are ephemeral per run() and are cleared before each execution.

Build

just python-build

Metadata

Release files for hyperlight-sandbox 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hyperlight-sandbox 0.7.0
File Size Uploaded
hyperlight_sandbox-0.7.0.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hyperlight-sandbox 0.7.0
File Interpreter ABI Platform
hyperlight_sandbox-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.2 kB

Release files / hyperlight_sandbox-0.7.0.tar.gz

Download URL hyperlight_sandbox-0.7.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c272dc483c69cbd3f8e96b963af8a3038c8df8a20a0c8228bbd5d821a0037dfa
BLAKE2b-256 checksum
How to use checksums
805031d35922c87c648fbce8c51fef2d2b0ef277fa09acd58eb74227c90c3343
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / hyperlight_sandbox-0.7.0-py3-none-any.whl

Download URL hyperlight_sandbox-0.7.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f4e52c7ef6013f461d19db60ec537c18e9cf41045ac819d4af1bb9cb72bdca3
BLAKE2b-256 checksum
How to use checksums
66800a62893dbec00955aad63739ced80167eac476fce73bb110e6cfeee655e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page