Skip to main content

inflowenger-plugin-sdk

Python SDK for building Inflowenger Plugin nodes (the inflowv1 protocol) — the Python port of go-plugin-sdk (sdkv1). It mirrors the Go SDK file-for-file and keeps the same wire format, so a Python plugin is interchangeable with a Go (or Node) plugin from the runtime's point of view.

Async, but faithful to Go

Go's nats.go is synchronous; Python's maintained NATS client (nats-py) is asyncio-only, so — like the Node port — this SDK is async. Method names are the Go names in snake_case (Job.Donejob.done, CmdGetScopecmd_get_scope, NewPluginnew_plugin).

One deliberate fidelity point: Plugin.send returns (msg, err) and never raises — exactly Go's (*nats.Msg, error) contract. A workflow the user has stopped leaves no NATS responders, and raising there would crash the whole plugin. Job methods return the error object (not raise) or the reply bytes, just like the Go handlers return err or msg.Data.

File map (Go → Python)

Go Python
sdkv1/plugin.go inflow_plugin_sdk/plugin.py
sdkv1/inflowV1.go inflow_plugin_sdk/inflow_v1.py
sdkv1/job.go inflow_plugin_sdk/job.py
sdkv1/req.go inflow_plugin_sdk/req.py
sdkv1/models.go + types.go inflow_plugin_sdk/models.py + types.py
sdkv1/dotenv.go inflow_plugin_sdk/env.py
nats/natsBox.go inflow_plugin_sdk/nats_box.py
formkit/*.go inflow_plugin_sdk/formkit/

Install

pip install -e .        # depends on nats-py and python-dotenv

Quick start

import asyncio
from inflow_plugin_sdk import Action, Job, new_plugin, with_dot_env


async def main() -> None:
    p = await new_plugin(with_dot_env(".env.inflow"))
    p.intro_data.name = "HTTP.CALL"
    p.intro_data.author = "inflow Dev. Team"
    p.intro_data.version = "v0.0.1"

    async def handler(job: Job) -> None:
        await job.progress(10, __import__("inflow_plugin_sdk").Frame(title="init", content="working"))
        await job.done({"action": "done"})

    p.add_action(Action(method="fn", request_handler=handler))

    await p.start()
    await asyncio.Event().wait()  # keep the process alive to serve requests


if __name__ == "__main__":
    asyncio.run(main())

See examples/rpc.py and examples/http_call.py (the ports of TestCommands / TestInit in sdkv1_test.go). Copy .env.inflow.example to .env.inflow and fill in the values Infra minted for your plugin.

Forms

formkit builds an action's JSON Schema + JSON Forms UI Schema from one declaration per field — the port of the Go formkit package:

from inflow_plugin_sdk import formkit

form = formkit.form("Create issue").add(
    formkit.text("projectKey", "Project key").required()
        .lookup("jira.meta.project.resolve", "Find").picks("jira.issue.create"),
    formkit.text("summary", "Summary").required(),
    formkit.text_area("description", "Description"),
).build()

p.add_action(Action(method="jira.issue.create", form=form, request_handler=...))

The protocol docs (docs/) are language-agnostic and shared with the Go and Node SDKs.

Download files

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

Source Distribution

inflowenger_plugin_sdk-0.1.0.tar.gz (35.4 kB view details)

Uploaded Source

Built Distribution

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

inflowenger_plugin_sdk-0.1.0-py3-none-any.whl (35.1 kB view details)

Uploaded Python 3

File details

Details for the file inflowenger_plugin_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: inflowenger_plugin_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 35.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.3

File hashes

Hashes for inflowenger_plugin_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 41e22a57e9a9397de1adc819de26c576ea23a3bb33b14319928a90f04c734513
MD5 d8f278da64757739a9edc95d1fcbdd84
BLAKE2b-256 47d8e149b6e81f5a42388fbe729a5f6ebb5907d83043157afe466a632af43e91

See more details on using hashes here.

File details

Details for the file inflowenger_plugin_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for inflowenger_plugin_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b26b5615cecf34da777f67517081c1d04a4d8487f54deac05fa0f171b5c0dbb0
MD5 9918c52c239b2af2f4c87a62fbae6d7d
BLAKE2b-256 5ca1843afc0d6a0128ba617011d7eb21083ebd9c2e135c9c9a305ecc23720114

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

2 files

0.1.2

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page