61 lines
1.2 KiB
Python
Raw Normal View History

from types import ModuleType
from typing import Any
2024-12-14 03:34:54 +08:00
from pydantic import BaseModel
class Plugin(BaseModel):
"""
存储插件信息
2024-12-14 03:33:59 +08:00
Attributes:
----------
name: str
包名称 例如marsho_test
module: ModuleType
插件模块对象
module_name: str
点分割模块路径 例如a.b.c
metadata: "PluginMeta" | None
"""
2024-12-14 03:33:59 +08:00
name: str
"""包名称 例如marsho_test"""
module: ModuleType
"""插件模块对象"""
module_name: str
"""点分割模块路径 例如a.b.c"""
metadata: "PluginMetadata" | None = None
""""""
2024-12-14 03:33:59 +08:00
class PluginMetadata(BaseModel):
"""
Marsho 插件 对象元数据
Attributes:
----------
name: str
友好名称: 例如Marsho Test
description: str
插件描述
usage: str
插件使用方法
type: str
插件类型
author: str
插件作者
homepage: str
插件主页
extra: dict[str, Any]
额外信息自定义键值对
"""
2024-12-14 03:33:59 +08:00
name: str
description: str = ""
usage: str = ""
author: str = ""
homepage: str = ""
2024-12-14 03:33:59 +08:00
extra: dict[str, Any] = {}