Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generic plugin system for Python applications. Auto-discovery, validation, fault tolerance. Zero dependencies (Python stdlib only).
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | -6% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -19% | 0% |
| case-08 | ✗→✓ | ▲ Improved | -42% | 0% |
| case-09 | ✗→✓ | ▲ Improved | -24% | 0% |
| case-10 | ✗→✓ | ▲ Improved | -34% | 0% |
> 中文 — plugin-system 官方中文版本。
适用于 Python CLI 应用程序的容错插件系统。 故障插件绝不会阻止应用程序其余部分的运行。
name、version、execute()scripts/
plugin_system.py Core: PluginBase (ABC) + PluginManager
cli_demo.py Demo CLI with argparse
test_plugin_system.py 16+ unit tests
examples/
hello.py Hello World plugin
calculator.py Calculator plugin
systeminfo.py System Info pluginpythonfrom plugin_system import PluginBase class MyPlugin(PluginBase): name = "MyPlugin" version = "1.0.0" def execute(self, *args, **kwargs): return {"status": "ok", "message": "Hello!"}
pythonfrom plugin_system import PluginManager manager = PluginManager(plugins_dir="./my_plugins") plugins = manager.discover_plugins() # List all plugins (Deutsch) manager.list_plugins() # Execute a plugin (Deutsch) success, result = manager.execute_plugin("MyPlugin", param="value") if success: print(result)
pythonclass MyApp: def __init__(self): self.plugins = PluginManager("./plugins") self.plugins.discover_plugins() def run_command(self, command, **params): success, result = self.plugins.execute_plugin(command, **params) return result if success else None
每个插件必须:
| 要求 | 详细信息 | |------|----------| | 继承 PluginBase | from plugin_system import PluginBase | | 设置 name | 类属性,不能为空 | | 设置 version | 类属性,语义化版本 | | 实现 execute() | 接收任意 *args, **kwargs |
| 错误类型 | 行为 | |----------|------| | 插件中存在 SyntaxError | 跳过该插件,加载其余部分 | | 缺少必需属性 | 插件被标记为 is_valid=False | | execute() 抛出异常 | 返回 (False, error_message) | | 目录中没有插件 | 返回空列表,不会崩溃 |
Other measured skills in the registry, with their headline benchmark lift.