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.1.tar.gz
(20.9 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.1.tar.gz.
File metadata
- Download URL: provider_sdk-0.3.1.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a930f0f0086006dfa44fbcad350edd1d176b503bf7df919fa6b14b876b8b58d4
|
|
| MD5 |
1385609b33ccb8b27e23452bcece6e43
|
|
| BLAKE2b-256 |
44f915ab7b8ed0ed304c1d21dc4f319d40942c7883e72c2739e409d3e8d3f5f9
|
File details
Details for the file provider_sdk-0.3.1-py3-none-any.whl.
File metadata
- Download URL: provider_sdk-0.3.1-py3-none-any.whl
- Upload date:
- Size: 26.6 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 |
fd55531b2e933d11a9fe3d5ba0dd83a6d4cee3f6dc232bb43456cb1bc4e20462
|
|
| MD5 |
7f54f9e1dedd8bee4f366e6d356d43ba
|
|
| BLAKE2b-256 |
ddace9045d376c9fd68f79bf1e9ae08450dd149e16a4436080278ef56c317250
|