Plugin package
Project description
polywrap-wasm
Python implementation of the plugin wrapper runtime.
Usage
Invoke Plugin Wrapper
from typing import Any, Dict, List, Union, Optional
from polywrap_manifest import AnyWrapManifest
from polywrap_plugin import PluginModule
from polywrap_core import Invoker, Uri, InvokerOptions, UriPackageOrWrapper, Env
class GreetingModule(PluginModule[None]):
def __init__(self, config: None):
super().__init__(config)
def greeting(self, args: Dict[str, Any], client: Invoker[UriPackageOrWrapper], env: Optional[Env] = None):
return f"Greetings from: {args['name']}"
manifest = cast(AnyWrapManifest, {})
wrapper = PluginWrapper(greeting_module, manifest)
args = {
"name": "Joe"
}
options: InvokeOptions[UriPackageOrWrapper] = InvokeOptions(
uri=Uri.from_str("ens/greeting.eth"),
method="greeting",
args=args
)
invoker: Invoker = ...
result = await wrapper.invoke(options, invoker)
assert result, "Greetings from: Joe"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for polywrap_plugin-0.1.0a16-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28732ba546ff185add1f66fa7121de20b15334338ccd656f006041bb94ea9c45 |
|
MD5 | c23be60be93a3101776ac7b7adaec810 |
|
BLAKE2b-256 | 536b019e5a15ab2ceebc16512c66bd9285247f7ed398207a149fcfe1843d8e30 |