Skip to main content

This package contains the runtime for executing Wasm wrappers.

Quickstart

The following code snippet demonstrates how to use the runtime to execute a Wasm wrapper.

Imports

>>> import os
>>> from typing import cast
>>> from polywrap_core import Uri, FileReader, InvokerClient
>>> from polywrap_wasm import WasmWrapper
>>> from polywrap_msgpack import msgpack_decode
>>> from polywrap_manifest import deserialize_wrap_manifest, AnyWrapManifest

Create a Wasm wrapper

>>> path_to_wrapper = os.path.join(os.path.dirname(__file__), "..", "tests", "cases", "simple")
>>> assert os.path.exists(path_to_wrapper)
>>> with open(os.path.join(path_to_wrapper, "wrap.wasm"), "rb") as f:
...     wasm_module = f.read()
>>> assert isinstance(wasm_module, bytes)
>>> with open(os.path.join(path_to_wrapper, "wrap.info"), "rb") as f:
...     manifest = deserialize_wrap_manifest(f.read())
>>> assert isinstance(manifest, AnyWrapManifest)
>>> wrapper = WasmWrapper(
...     cast(FileReader, NotImplemented),
...     wasm_module,
...     manifest
... )
>>> assert isinstance(wrapper, WasmWrapper)

Invocation

>>> message = "Hello, World!"
>>> args = {"arg": message}
>>> result = wrapper.invoke(
...     uri=Uri.from_str("wrap://authority/path"),
...     method="simpleMethod",
...     args=args,
...     client=cast(InvokerClient, NotImplemented),
... )
>>> assert result.encoded is True
>>> assert msgpack_decode(cast(bytes, result.result)) == message

Metadata

Release files for polywrap-wasm 0.1.2

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

Source distribution (sdist)

Source distribution for polywrap-wasm 0.1.2
File Size Uploaded Provenance Actions
polywrap_wasm-0.1.2.tar.gz 13.4 kB Without provenance Details for polywrap_wasm-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for polywrap-wasm 0.1.2
File Interpreter ABI Platform Actions
polywrap_wasm-0.1.2-py3-none-any.whl Python 3 none any Details for polywrap_wasm-0.1.2-py3-none-any.whl

Total release size: 38.2 kB

Release files / polywrap_wasm-0.1.2.tar.gz

Download URL polywrap_wasm-0.1.2.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3441fefcfebf242bf0604f08b27a99974b5b9367259eaca9ab42bcaa628a739b
BLAKE2b-256 checksum
How to use checksums
4a63ce7c4f3ed250716d0f0e8289723aea6c8158220c9da3fe6873c12146059e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1041-azure

Release files / polywrap_wasm-0.1.2-py3-none-any.whl

Download URL polywrap_wasm-0.1.2-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbcaec24ab7349a15a6c3b71ca5978d11888b50d2eb195058f3111e68e91c01a
BLAKE2b-256 checksum
How to use checksums
f16cf92a09db73defd5e1f571707f9f127d6e922e0b0d4dad6325ddd236813d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1041-azure

Security for polywrap-wasm 0.1.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.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files No provenance

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