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.0.tar.gz
(20.6 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.0.tar.gz.
File metadata
- Download URL: provider_sdk-0.3.0.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0b1d69750293183f5ef2eb8dc7bd61c38026e759b392c6c760736fa4bfce620
|
|
| MD5 |
94db3e61a304087b1a57e1a028a6fe5d
|
|
| BLAKE2b-256 |
74cc3ef0d63c10f1674c51ff8eda6611ff50db201712dc9c7bc5ad155e85ebb0
|
File details
Details for the file provider_sdk-0.3.0-py3-none-any.whl.
File metadata
- Download URL: provider_sdk-0.3.0-py3-none-any.whl
- Upload date:
- Size: 26.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 |
78d276266b86db91faf542adf2f2a0775014d7143e61c67417695f91ed5e4afe
|
|
| MD5 |
fe0ee45021a77cbf7dde215fef8112a6
|
|
| BLAKE2b-256 |
64c3f57d1cba650bfc9dab12e50b2d7bc8d74697f54cfdcc52f807ba2d9ced38
|