New Plugin Architecture for Node Registration#2733
Merged
fabiencastan merged 39 commits intodevelopfrom Jun 7, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements support for plugins in Meshroom by introducing a new “plugins” core module with Plugin, NodePlugin, and NodePluginManager classes, refactoring node registration and discovery to use the new pluginManager, and updating tests accordingly.
- Refactor of node registration from nodesDesc to pluginManager.
- Updates of unit tests and integration of plugin-based node discovery.
- Addition of new plugin and node files for PluginA and PluginB.
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/test_compatibility.py | Refactored node registration and unregistration to use pluginManager. |
| tests/test_attributeChoiceParam.py | Updated node registration and tear down to use NodePlugin and pluginManager. |
| tests/plugins/meshroom/pluginB/PluginBNodeB.py | Added new plugin node with potential type mismatch in IntParam default value. |
| Remaining files | Various code refactoring and formatting changes to switch from nodesDesc to pluginManager integration. |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## develop #2733 +/- ##
===========================================
+ Coverage 77.15% 78.46% +1.30%
===========================================
Files 41 47 +6
Lines 6167 6542 +375
===========================================
+ Hits 4758 5133 +375
Misses 1409 1409 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fabiencastan
reviewed
Jun 4, 2025
fabiencastan
reviewed
Jun 4, 2025
fabiencastan
reviewed
Jun 4, 2025
265f51d to
4e0c15d
Compare
Add a new module named `plugins` with a `ProcessEnv` class which contains the paths describing the environment needed for the plugin's (node's) process.
A `Plugin` object contains a collection of nodes, represented as `NodePlugin` objects. This commit adds the implementation of the `Plugin` class with the methods to add and remove `NodePlugins`, as well as an empty class for the `NodePlugin` objects themselves.
The validation of the node descriptions will be handled directly within the `NodePlugin` objects and there is thus no need for this method to exist outside of plugins.py.
The `NodePluginManager` class manages is used to load, manage, and register plugins and nodes.
Templates that are available for a plugin are detected and gathered upon the plugin's creation.
Nodes are now registered and unregistered through the `NodePluginManager`.
Also comply more with PEP8 linting rules.
The plugin manager is now effectively used for all the operations that involve registering or unregistering nodes.
…...` This prevents ambiguities between `NodePlugin` objects that have been registered (and are thus instantiable) and those that belong to `Plugin` objects but have not been registered.
A `NodePlugin` may be part of a `Plugin` even if it has not been registered. `containsNode` allows to check whether a `NodePlugin` is contained within a `Plugin`, and `belongsToPlugin`
This will replace all the nodes in the current graph with a new instance of the same type. If any change has occured in the description of these nodes since their last instantiation, the new nodes will reflect them.
"Reload All Nodes" will reload all the descriptions for `NodePlugins` that are part of loaded plugins, whether they are registered or not. Once the reload of the descriptions has been performed, the node instances from the current graph will be reloaded as well to reflect any change in the description.
2b64879 to
074a459
Compare
On some systems such as GitHub's Windows CI, the `write` operation is too fast and does not cause a change in the timestamp of the file we're reloading, hence causing the test to fail for external reasons. Adding a sleep does not change anything to the test functionally, but on the contrary ensures that we are actually testing the feature. https://stackoverflow.com/questions/19059877/python-os-path-getmtime-time-not-changing
074a459 to
a6d80b3
Compare
…atus If the plugin has successfully been reloaded, return `True`. If it has not been reloaded for any reason (either an error or because no modification has been made to it since it has been loaded last), then return `False`.
When requesting a `NodePlugin` to reload, the status of the reloading is now saved. If it has been successful, all the nodes of this type in the graph will effectively be removed. If it has not (either because of an error, or because no change has been done to the description), then nothing will happen. Replacing only the nodes whose description has been updated prevents from having to update heavy graphs for very few nodes to change (if any).
fabiencastan
approved these changes
Jun 7, 2025
Warning only on a module/file without any element in it and provide full-path to ease debugging. For package/folder, it does not generate any message.
699e0dc to
d3738fb
Compare
This was referenced Jun 7, 2025
Closed
2 tasks
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.
Description
This PR adds the support for plugins in Meshroom, building on top of #2703.
A
Pluginis a collection of at least oneNodePlugin, which contains the description of a node, and can be associated to templates.Pluginscan be loaded and unloaded with theNodePluginManager, which is in charge of the registration and unregistration of allNodePlugins(a node cannot be instantiated until itsNodePluginhas been registered).All collections of nodes are now considered as plugins, may they be provided through the
MESHROOM_NODES_PATHor through theMESHROOM_PLUGINS_PATHenvironment variables. In the case ofMESHROOM_NODES_PATH, a Python module containing node descriptions is expected. ForMESHROOM_PLUGINS_PATH, it is expected that the nodes are contained within a Python module that is itself located in ameshroomfolder.Features list
coremodule containing new classes:Plugin,NodePlugin,NodePluginManager;NodePluginManager;Implementations remarks
Currently, the whole process of going through folders in search of Python packages remains in the
__init__.pyof thecoremodule. This is because the method that is used to find files containing nodes is the same as the one used to discover submitters. Submitters are, for now, not included in the "plugins" module and are handled as they were previously.