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/— 平台扩展插件
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96f3a1d6c35da5cf29edc345e131cac2a033e85f4c7467032d025adf4fe129c6
|
|
| MD5 |
967fce5b85e251593f114b85f13c6629
|
|
| BLAKE2b-256 |
646ecb97e1e111d9104ce4d443c58ee5d4518514a82a269173a8dd00248b5d19
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5e7b242efd74bb4d2fe7fdab926eb802c95af1670f96006126117b03481862b
|
|
| MD5 |
efdee62040543bedb452d0da60a60eba
|
|
| BLAKE2b-256 |
e18e223fbb4dc43cc6417458c65c52f113816eacab11ee9b8aa8cfcae076d3ba
|