{"id":30021910,"url":"https://github.com/abilian/hop3-plugin-debug","last_synced_at":"2025-08-06T03:37:46.696Z","repository":{"id":305866978,"uuid":"1024204027","full_name":"abilian/hop3-plugin-debug","owner":"abilian","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-22T10:44:53.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-22T12:28:10.475Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abilian.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-22T10:37:51.000Z","updated_at":"2025-07-22T10:44:57.000Z","dependencies_parsed_at":"2025-07-22T12:28:15.949Z","dependency_job_id":"e26af287-5d8a-4de3-bbb6-4f2cf6c2364e","html_url":"https://github.com/abilian/hop3-plugin-debug","commit_stats":null,"previous_names":["abilian/hop3-plugin-debug"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/abilian/hop3-plugin-debug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abilian%2Fhop3-plugin-debug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abilian%2Fhop3-plugin-debug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abilian%2Fhop3-plugin-debug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abilian%2Fhop3-plugin-debug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abilian","download_url":"https://codeload.github.com/abilian/hop3-plugin-debug/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abilian%2Fhop3-plugin-debug/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269016137,"owners_count":24345147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-06T03:37:45.047Z","updated_at":"2025-08-06T03:37:46.689Z","avatar_url":"https://github.com/abilian.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A `pluggy`-based Plugin Architecture Demo\n\nThis repository contains a simple, illustrative example of a Python application (`hop3-host`) that uses a plugin (`hop3-plugin`) to extend its functionality. The core of this demonstration is the `pluggy` library, which is the same framework used by the popular testing tool `pytest`.\n\n**Disclaimer:** This code is for educational purposes only. It is a simplified demonstration and is not intended for production use. The primary goal is to showcase the mechanics of plugin discovery and integration.\n\n## Project Structure\n\nThe repository is organized as a workspace with two main packages:\n\n*   `hop3-host`: A host application that defines extension points (hooks) for building and deploying applications. It knows nothing about the specifics of *how* to build or deploy; it only defines the interfaces (`protocols`).\n*   `hop3-plugin`: An external plugin that provides concrete implementations (strategies) for building and deploying. In this example, it provides a Docker-based build strategy.\n\n## Core Concepts Demonstrated\n\n*   **Plugin Discovery:** The host application uses `pluggy` to discover and load plugins at runtime.\n*   **Hook System:** The host defines \"hook specifications\" (`hookspecs`) that plugins can implement to provide new functionality.\n*   **Separation of Concerns:** The host application is decoupled from the specific implementation details of its plugins. This allows for new build or deployment methods to be added without modifying the host's code.\n*   **Protocols:** The use of `typing.Protocol` ensures that plugins adhere to the expected interface, providing a degree of static analysis and clarity.\n\n## How to Run the Demo\n\nThis project uses `uv` for managing dependencies and the workspace.\n\n### Setup\n\n1.  **Install `uv`**: If you don't have it, install `uv` by following the official instructions.\n2.  **Install Dependencies**: From the root of the project, install the packages in editable mode. This will also install `pluggy`.\n\n    ```bash\n    uv sync\n    ```\n\n### Running the Demo Script\n\nThe `hop3-host` package contains a small script, `demo.py`, to demonstrate the plugin system. It initializes the plugin manager and lists all registered plugins.\n\nTo run it:\n\n```bash\npython -m hop3_host.demo\n```\n\nThe expected result is:\n\n```\nRegistered plugins:\nTotal plugins: 1\n- docker-plugin (builtins.type)```\n```\n\n### Plugin Discovery\n\nTo make the host application discover the plugin, an **entry point** has been added to the plugin's `pyproject.toml`.\n\nThe `hop3-plugin/pyproject.toml` file contains the following section:\n\n```toml\n[project.entry-points.\"hop3\"]\nsmo = \"hop3_plugin.plugin:DockerPlugin\"\n```\n\n**Explanation:**\n\n*   `[project.entry-points.\"hop3\"]`: This tells Python's packaging system that this project provides plugins for the \"hop3\" entry point group.\n*   `smo = \"hop3_plugin.plugin:DockerPlugin\"`: This registers the `SmoPlugin` class from the `hop3_plugin.plugin` module as a loadable plugin.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabilian%2Fhop3-plugin-debug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabilian%2Fhop3-plugin-debug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabilian%2Fhop3-plugin-debug/lists"}