Skip to main content

Provider-V2 平台插件 SDK — 第三方平台适配器开发与加载

Project description

provider-sdk

Provider-V2 通用插件 SDK

平台适配器只是可选扩展(extensions.platform),不是 SDK 核心。

安装

pip install provider-sdk

快速开始

plugins/
  my_plugin/
    _manifest.json
    plugin.py
from provider_sdk import ProviderPlugin, Route, Hook, API

class MyPlugin(ProviderPlugin):
    async def on_load(self) -> None:
        self.ctx.logger.info("loaded")

    @Route("/plugins/my/status", methods=["GET"])
    async def status(self) -> dict:
        return {"ok": True}

def create_plugin() -> MyPlugin:
    return MyPlugin()

核心概念

概念 说明
ProviderPlugin 插件基类,生命周期 + 配置
create_plugin() 模块级工厂函数
_manifest.json 插件元数据与依赖
@Route / @Hook / @API 向 Host 声明组件
self.ctx 运行时上下文(日志 / 配置 / HTTP)

插件类型

plugin_type 说明
general(默认) 通用插件,声明 Route/Hook/API
platform 额外提供 PlatformAdapter,供网关注册

示例

  • examples/hello_plugin/ — 通用插件
  • examples/echo_platform/ — 平台扩展插件

文档:docs/guide.md

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

provider_sdk-0.3.3.tar.gz (21.4 kB view details)

Uploaded Source

Built Distribution

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

provider_sdk-0.3.3-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file provider_sdk-0.3.3.tar.gz.

File metadata

  • Download URL: provider_sdk-0.3.3.tar.gz
  • Upload date:
  • Size: 21.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for provider_sdk-0.3.3.tar.gz
Algorithm Hash digest
SHA256 96f3a1d6c35da5cf29edc345e131cac2a033e85f4c7467032d025adf4fe129c6
MD5 967fce5b85e251593f114b85f13c6629
BLAKE2b-256 646ecb97e1e111d9104ce4d443c58ee5d4518514a82a269173a8dd00248b5d19

See more details on using hashes here.

File details

Details for the file provider_sdk-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: provider_sdk-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for provider_sdk-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c5e7b242efd74bb4d2fe7fdab926eb802c95af1670f96006126117b03481862b
MD5 efdee62040543bedb452d0da60a60eba
BLAKE2b-256 e18e223fbb4dc43cc6417458c65c52f113816eacab11ee9b8aa8cfcae076d3ba

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