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.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: funppy-0.5.0.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.5.0.tar.gz
Algorithm Hash digest
SHA256 78be74bd6e68fbd7acdd2c3ad21b2a4bc0131475c01d0f4ea4b72f133e323986
MD5 789fd899bff6c83a14675fa1db3ec165
BLAKE2b-256 a4f562ea62af2872c7e4611591883e30ee6d72b8b846894871f15005f368973f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: funppy-0.5.0-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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19e777dd5787a727ce794ed6734dc04a805f46986ddad13a2ded17d8a9bf43cc
MD5 0b5d6770a4832db13dc8de89768c9bcb
BLAKE2b-256 e26b175de1b4ba541a6b3f3203905a3ec06aad5ab7cff048a3deffc8dc88dd4c

See more details on using hashes here.

Supported by

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