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.2.tar.gz
(21.7 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.2.tar.gz.
File metadata
- Download URL: provider_sdk-0.3.2.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0abe486abbf1785e370b89799f5bb10f8f3e787b62760cb581b994c94d3a3c9f
|
|
| MD5 |
373682dccccf70958fbbecc36fc74f7d
|
|
| BLAKE2b-256 |
1b13fa2cac090edd1b2c5ba1af1a646d4dbd871de062faf8ed350a5a8d51cbdf
|
File details
Details for the file provider_sdk-0.3.2-py3-none-any.whl.
File metadata
- Download URL: provider_sdk-0.3.2-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65c791632d3bec5f39a44f5982749a7152fa392fe4fe8c3621c1e2b288389f22
|
|
| MD5 |
27f51e83f1d8fd2794141ae2dff15bb8
|
|
| BLAKE2b-256 |
12ad4adc97dd51105400ddb6d0d872dcf35e28c34a82435e184fe7a33e41c2c4
|