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.0a21-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cad3c7c295659f0a8c733afe56d89b286c0e14593bbcad60fd4794be4c46c8b |
|
MD5 | 9592b9bc8434dc1ddb4cdb497ecf71a9 |
|
BLAKE2b-256 | ef85332e097c0cf1c2f47cc3a7f7c2895ce607ef3c9e85fcb474e6552987fab3 |