Allow plugins to add morphometrics subcommands via entry points#58
Merged
Conversation
LazyGroup now discovers commands advertised under the "morphometrics.commands" entry-point group, so packages installed in the same environment (e.g. the napari GUI) can contribute subcommands such as `morphometrics gui` without the pipeline depending on them. Discovery reads package metadata only, so `morphometrics --help` stays fast; loading a plugin that fails to import surfaces a clean ClickException. Adds an optional `gui` extra pointing at the surface-morphometrics-gui git repo (PyPI line left commented for later). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
@hemanthkapa this is the pipeline side update to allow surface morphometrics GUI to use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Lets third-party packages installed in the same environment contribute
morphometricssubcommands by advertising amorphometrics.commandsentry point. The immediate motivation is the napari GUI (surface-morphometrics-gui#41), which will exposemorphometrics guionce it declares the matching entry point — without the pipeline taking a hard dependency on it.Changes
surface_morphometrics/cli.py—LazyGroupnow discovers commands from themorphometrics.commandsentry-point group:list_commandsunions in discovered plugin names.get_commandfalls back toEntryPoint.load(), wrapping failures in a cleanClickException(e.g. when the plugin is installed but its GUI deps aren't)._short_helpresolves plugin help so they render in--help.morphometrics --helpstays fast and never imports napari/Qt. Plugin commands appear under "Other commands".pyproject.toml— adds an optionalguiextra pointing at the GUI's git repo (PyPI line left commented for when it's published):Behavior
--helpand command list unchangedpip install surface-morphometrics[gui]morphometrics guiappears and launches the GUIError: Could not load the 'gui' command …Testing
The GUI-side half (a thin import-light click command + the entry-point declaration) lands separately on surface-morphometrics-gui#41.
🤖 Generated with Claude Code