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.5.2.tar.gz (8.2 kB view hashes)

Uploaded Source

Built Distribution

funppy-0.5.2-py3-none-any.whl (9.6 kB view hashes)

Uploaded Python 3

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