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.0a27-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 016d6ec982be9d032935d22eaf8b691af1a4eb6b1f1a0ae9daf654ce5d0815f7 |
|
MD5 | 86dcbcec4c55e0f3c7d63f4618091ed0 |
|
BLAKE2b-256 | 7a5a5f70e8e481400606979e06d2a253836e6d8d23050769ac0292dfb0dfb6bc |