Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polywrap_plugin-0.1.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

polywrap_plugin-0.1.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file polywrap_plugin-0.1.2.tar.gz.

File metadata

  • Download URL: polywrap_plugin-0.1.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1041-azure

File hashes

Hashes for polywrap_plugin-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5428d3fb39613110178d85b181a3af21e3002d43138791e31de9edcbd2963d78
MD5 4774a43b127292ec82059cc8a2b2d164
BLAKE2b-256 af4fe0f2daadd3fcd004ecf82fdc1a92fc49a0ba7d849581621f123b6f9acfc7

See more details on using hashes here.

Provenance

File details

Details for the file polywrap_plugin-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: polywrap_plugin-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.10.12 Linux/5.15.0-1041-azure

File hashes

Hashes for polywrap_plugin-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ca5cffb6a779cfd0e7d88fa3fdcbc91576f39171c8a6f962a4ca71ca42eb6e96
MD5 6598c2be3da86dd22e801a0a82fdac82
BLAKE2b-256 dc3a5c501865625f09a86fc3d6b3ef92c5a3c50d78e236f410d53e8067753762

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page