Polywrap Plugin package
Project description
This package contains the runtime for the Polywrap plugin system.
Quickstart
Imports
>>> from typing import Any, Dict, List, Union, Optional, cast >>> from polywrap_manifest import AnyWrapManifest >>> from polywrap_plugin import PluginModule >>> from polywrap_core import InvokerClient, Uri
Define a plugin module
>>> class GreetingModule(PluginModule[None]): ... def __init__(self, config: None): ... super().__init__(config) ... ... def greeting(self, args: Dict[str, Any], client: InvokerClient, env: Optional[Any] = None): ... return f"Greetings from: {args['name']}"
Create a plugin wrapper
>>> greeting_module = GreetingModule(None) >>> manifest = cast(AnyWrapManifest, NotImplemented) >>> wrapper = PluginWrapper(greeting_module, manifest)
Invocation
>>> args = { ... "name": "Joe" ... } >>> result = wrapper.invoke( ... uri=Uri.from_str("ens/greeting.eth"), ... method="greeting", ... args=args, ... client=cast(InvokerClient, NotImplemented), ... ) >>> assert result.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.0b7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb3b78aff86036ade96f6ba5a291ca5342fc04ee5118e2805c1aa0a5e1be23f2 |
|
MD5 | c3ae4d229317172081ee4eba56bb3c50 |
|
BLAKE2b-256 | a74415508b21371111a727bed72a9f6b74b79be786309f87310e31e51b6e5e7a |