Repository navigation
feature/plugin - #14
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a pluggable matcher architecture so vrs-matcher can run alternative matching/ranking algorithms via built-in implementations, Python entry points, or local script files, while keeping the existing matcher API and CLI behavior backward-compatible by default.
Changes:
- Added a new plugin system (
plugins.py) with built-in registration, entry-point discovery, and script-plugin loading. - Refactored the existing identity matcher into a built-in plugin and routed
match_pair/match_against_allthrough plugin resolution. - Extended the CLI, documentation, examples, and tests to cover plugin selection, listing, and script plugin execution.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/vrs_matcher/plugins.py |
New plugin registry/discovery/loader implementation for matchers. |
src/vrs_matcher/matcher.py |
Refactors identity matching into a built-in plugin and adds plugin selection parameters to public match APIs. |
src/vrs_matcher/cli.py |
Adds --algorithm, --plugin-file, and plugins list support to the CLI. |
examples/plugins/jaccard_floor_plugin.py |
Adds a reference script plugin demonstrating custom scoring behavior. |
docs/plugins.md |
New comprehensive documentation for plugin authoring and usage. |
README.md |
Adds a plugin section and basic usage examples. |
tests/test_plugins.py |
Adds coverage for built-in, entry-point, and script plugin behaviors and error paths. |
tests/test_cli.py |
Adds CLI coverage for listing plugins and running a script plugin. |
tests/test_loader.py |
Adds coverage for loader edge cases and batch/cleanup behavior. |
tests/test_notebooks.py |
Adds smoke tests to ensure the example notebook workflow remains valid. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PR review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Review Steps1. Update ✔️➜ cd vrs-matcher
➜ git checkout feature/plugin
gbranch 'feature/plugin' set up to track 'origin/feature/plugin'.
Switched to a new branch 'feature/plugin'
➜ git show --summary --oneline
6cf6bd1 (HEAD -> feature/plugin, origin/feature/plugin) adds plugin loading flow2. Run Built-in Plugin (
|
There was a problem hiding this comment.
Tip
- All new plugin steps pass, as do the tests (see Review Steps above)!
- Created PR #16 with optional updated docs + examples
Important
- I have not yet tried creating a custom plugin (following the steps in
plugins.md). This might be a good next review step (but shouldn't block this PR from being merged)...
@lbeckman314 that would be an excellent idea |
|
Creating example plugin at https://github.com/EllrottLab/vrs-matcher-example-plugin |
Add integration test to verify that my_plugin produces different results from the identity algorithm.
Refactor test to use sample IDs directly from the database instead of MatchContext. Update variable names for clarity.
Refactor database connection handling in the sample matching process.
* docs: Update plugins.md * docs: Update README.md * Update README.md
Add pluggable matcher architecture, example plugins, test coverage, and plugin documentation
Why
vrs-matcherhad a single built-in matching algorithm. That was a good starting point, but it limited the project in a few ways:This PR introduces a plugin system so matching algorithms can be supplied as:
It also adds tests, an example plugin, notebook coverage, and more detailed documentation around practical plugin use cases.
What Changed
Core plugin architecture
Added
src/vrs_matcher/plugins.pyto define and manage matcher plugins:PluginContextread-only facade over DB access helpersMatcherPluginprotocol-style contractvrs_matcher.plugins--plugin-fileBuilt-in matcher refactor
Updated
src/vrs_matcher/matcher.pyso the existing identity matcher is now implemented as a built-in plugin while keeping the public API stable:IdentityMatcherPluginmatch_pair(...)andmatch_against_all(...)as backward-compatible wrappersalgorithmplugin_fileCLI plugin support
Updated
src/vrs_matcher/cli.pyto support plugin selection:--algorithmto matching commands--plugin-fileto load local script pluginsvrs-matcher plugins listExample plugin
Added
examples/plugins/jaccard_floor_plugin.py:Test coverage improvements
Added and expanded tests across plugins, notebooks, loader, and CLI behavior:
tests/test_plugins.pyexamples/plugins/tests/test_notebooks.pytests/test_loader.pytests/test_cli.pyDocumentation
Expanded plugin documentation for both developers and bioinformatics users:
README.mdplugin section to explain when built-in, local script, and packaged plugins are appropriatedocs/plugins.mdwith:Validation
Ran the following successfully:
uv run pytest✅uv run pytest tests/test_plugins.py✅uv run pytest tests/test_loader.py tests/test_cli.py✅uv run pytest tests/test_notebooks.py✅uv run ruff check .✅Latest full-suite result:
102 passed, 1 skippedReviewer Notes
MatchResult, so custom plugins still report their primary score in thejaccardfield.Follow-ups (Optional)