Commit 719883c
authored
Create PluginManager class to manage plugin info (#16)
This pull request refactors and simplifies the plugin suggestion and
installation logic for bioio plugins in the `ndevio` package. The main
change is the introduction of the `ReaderPluginManager` class, which
centralizes plugin discovery, installation recommendations, and
messaging. The previous low-level utility functions are now internal,
and the API is streamlined for easier usage and maintenance.
### Plugin Management Refactor
* Introduced the `ReaderPluginManager` class in
`src/ndevio/_plugin_manager.py` and exposed it in the public API via
`src/ndevio/__init__.py`. This class now handles plugin discovery and
installation messaging, replacing direct calls to utility functions.
(`[src/ndevio/__init__.pyR7-R10](diffhunk://#diff-f9e6d85a12005e8899e84eb8c4653f28d9dedf3f40c465cc4271ca98216e485dR7-R10)`)
* Updated the documentation and API of
`src/ndevio/_bioio_plugin_utils.py` to clarify that only low-level
utilities remain, and that users should use `ReaderPluginManager` for
plugin-related tasks.
(`[src/ndevio/_bioio_plugin_utils.pyL1-R23](diffhunk://#diff-db022ea55c4d616954ccf17679356fe2c5c28a861555bb2cdf6fb941c33af079L1-R23)`)
### API Simplification and Cleanup
* Removed several low-level functions from
`src/ndevio/_bioio_plugin_utils.py` (`get_missing_plugins_message`,
`filter_installed_plugins`, `get_installable_plugins`) and replaced them
with a single internal function `format_plugin_installation_message`.
The public API is now limited to `suggest_plugins_for_path` and the
plugin registry.
(`[[1]](diffhunk://#diff-db022ea55c4d616954ccf17679356fe2c5c28a861555bb2cdf6fb941c33af079L127-R195)`,
`[[2]](diffhunk://#diff-db022ea55c4d616954ccf17679356fe2c5c28a861555bb2cdf6fb941c33af079L250-R272)`)
* Simplified the return value of `suggest_plugins_for_path` to just a
list of plugin names, rather than plugin info dicts, making it easier to
use and more consistent.
(`[[1]](diffhunk://#diff-db022ea55c4d616954ccf17679356fe2c5c28a861555bb2cdf6fb941c33af079L224-R213)`,
`[[2]](diffhunk://#diff-db022ea55c4d616954ccf17679356fe2c5c28a861555bb2cdf6fb941c33af079L250-R272)`)
### Integration with Napari Plugin Installer
* Refactored `_open_plugin_installer` in `src/ndevio/_napari_reader.py`
to use the new `ReaderPluginManager` for plugin suggestions and
installation, removing direct calls to utility functions and feasibility
reports.
(`[src/ndevio/_napari_reader.pyL192-R202](diffhunk://#diff-a1495b29f6e07c8278a427f1ad3f4b1033da9353d263c050f0c8d9ac1b2aeebdL192-R202)`)
---
These changes make plugin management more robust, easier to maintain,
and clearer for both internal and external users.1 parent b933c68 commit 719883c
File tree
11 files changed
+753
-480
lines changed- src/ndevio
- widgets
- tests
11 files changed
+753
-480
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
| 10 | + | |
0 commit comments