Convert to pip package

- Moved __init__.py and plugin.yaml into hermes_piper_plugin/ package directory
- Added pyproject.toml with build config and entry point registration
- Updated tests to reference new subdirectory paths
- Updated README with pip-based installation instructions

This converts the plugin from a flat layout (loaded via hermes plugins install)
to a proper pip package with the 'hermes_agent.plugins' entry point.
This commit is contained in:
2026-06-17 12:11:37 -04:00
parent c44e65e381
commit cfe9e9c4b9
5 changed files with 35 additions and 12 deletions

View File

@@ -62,7 +62,7 @@ def _clean_tools_tts():
def _load_plugin_module(name: str) -> types.ModuleType:
"""Load the plugin __init__.py as a fresh module with given name."""
source = Path(__file__).resolve().parent.parent / "__init__.py"
source = Path(__file__).resolve().parent.parent / "hermes_piper_plugin" / "__init__.py"
assert source.exists(), f"Plugin init not found at {source}"
spec = importlib.util.spec_from_file_location(name, str(source))
mod = importlib.util.module_from_spec(spec)
@@ -85,7 +85,7 @@ def plugin_dir() -> Path:
@pytest.fixture
def manifest(plugin_dir: Path) -> dict:
manifest_path = plugin_dir / "plugin.yaml"
manifest_path = plugin_dir / "hermes_piper_plugin" / "plugin.yaml"
assert manifest_path.exists(), f"plugin.yaml not found at {manifest_path}"
with open(manifest_path) as f:
return yaml.safe_load(f)
@@ -274,14 +274,14 @@ class TestPluginStructure:
def test_required_files_exist(self, plugin_dir):
"""Plugin must have plugin.yaml, __init__.py, and README.md."""
assert (plugin_dir / "plugin.yaml").exists(), "Missing plugin.yaml"
assert (plugin_dir / "__init__.py").exists(), "Missing __init__.py"
assert (plugin_dir / "hermes_piper_plugin" / "plugin.yaml").exists(), "Missing plugin.yaml"
assert (plugin_dir / "hermes_piper_plugin" / "__init__.py").exists(), "Missing __init__.py"
assert (plugin_dir / "README.md").exists(), "Missing README.md"
def test_init_has_register_function(self, plugin_dir):
"""__init__.py must expose a register() function."""
spec = importlib.util.spec_from_file_location(
"test_register_check", str(plugin_dir / "__init__.py")
"test_register_check", str(plugin_dir / "hermes_piper_plugin" / "__init__.py")
)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)