Skip to main content

Python plugin over gRPC for funplugin

Project description

Python plugin over gRPC

install SDK

Before you develop your python plugin, you need to install an dependency as SDK.

$ python3 -m pip install funppy

create plugin functions

Then you can write your plugin functions in python. The functions can be very flexible, only the following restrictions should be complied with.

  • function should return at most one value and one error.
  • funppy.register() must be called to register plugin functions and funppy.serve() must be called to start a plugin server process.

Here is some plugin functions as example.

import logging
from typing import List

import funppy


def sum_two_int(a: int, b: int) -> int:
    return a + b

def sum_ints(*args: List[int]) -> int:
    result = 0
    for arg in args:
        result += arg
    return result

def Sum(*args):
    result = 0
    for arg in args:
        result += arg
    return result


if __name__ == '__main__':
    funppy.register("sum_two_int", sum_two_int)
    funppy.register("sum_ints", sum_ints)
    funppy.register("sum", Sum)
    funppy.serve()

You can get more examples at funppy/examples/.

build plugin

Python plugins do not need to be complied, just make sure its file suffix is .py by convention and should not be changed.

use plugin functions

Finally, you can use Init to initialize plugin via the xxx.py path, and you can call the plugin API to handle plugin functionality.

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

funppy-0.4.3.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

funppy-0.4.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file funppy-0.4.3.tar.gz.

File metadata

  • Download URL: funppy-0.4.3.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Darwin/21.4.0

File hashes

Hashes for funppy-0.4.3.tar.gz
Algorithm Hash digest
SHA256 df10fe3463965c7f1985b10b002655afd0ae1b94738160687e1c7bc67bfeec3a
MD5 79f2e8040bab91b57673e8f02c9b57cb
BLAKE2b-256 be845d3a53a982cf87d521328bc036fe070993c52c8df98d2c7e09e91c7e99ae

See more details on using hashes here.

File details

Details for the file funppy-0.4.3-py3-none-any.whl.

File metadata

  • Download URL: funppy-0.4.3-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Darwin/21.4.0

File hashes

Hashes for funppy-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b1b8314b36fa1c1a01f1ff83edd4e3b56cb394c9aca413cbb48eabcddaa59b2e
MD5 a8f9bb4f8f967f43713c1b666d3021b4
BLAKE2b-256 72bd732c0e721c62e26f2cf223f357845cafdb65dbaa59f301da5c95cb991530

See more details on using hashes here.

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