Skip to content

Multiple plugin templates#6

Merged
FelixE91 merged 31 commits intomainfrom
multiple_plugin_templates
Feb 26, 2025
Merged

Multiple plugin templates#6
FelixE91 merged 31 commits intomainfrom
multiple_plugin_templates

Conversation

@joeycasey87
Copy link
Contributor

Extension of the original cookiecutter plugin template to include other plugin types and subtypes.

joeycasey87 and others added 30 commits August 20, 2024 16:18
…ranch in pysteps main repo to test postprocessor_plugin.
…d diagnostic (not postprocessor)

This is more consistent with the structure of pysteps which has
io/importers
postprocessing/diagnostics
- currently we do not have ensemblestats plugins
- importer and diagnostic remain as plugin types
- added plugin_function as parameter (needed for importer plugins)
- updated setup script for entry_points
- updated function names
correct importer prefix and remove ensemblestats for now.
@ladc ladc self-requested a review February 26, 2025 14:21
Copy link
Contributor

@ladc ladc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed duplicate code, ensured tests work with the postprocessors_plugin branch of the main pysteps.

@FelixE91
Copy link
Contributor

Minimum functionality assured with the tests - a test plugin is installed and correctly found in the interface methods.
In the future, we could add the tests for the module methods, i.e., in ./test/test_{{cookiecutter.project_slug}}.py in test_plugins_discovery() add for importer plugins something like

available_importers = [
        attr for attr in dir(importers) if attr.startswith("import_")
    ]
{{cookiecutter.plugin_name}} in available_module_importers

or for diagnostic plugins

available_module_methods = [
            attr
            for attr in dir(importlib.import_module(module_name))
            if attr.startswith(plugintype[:-1])
        ]
{{cookiecutter.plugin_name}} in available_module_methods

@FelixE91 FelixE91 merged commit 627f645 into main Feb 26, 2025
12 checks passed
@FelixE91 FelixE91 deleted the multiple_plugin_templates branch February 26, 2025 14:32
@dnerini
Copy link
Member

dnerini commented Mar 4, 2025

@FelixE91 @ladc Looks like the changes introduced by this PR broke the plug-in test in the main pysteps repo.

Is there a timeline to introduce the necessary changes in the main repo?

Does this mean that breaking changes were introduced? Will older plug-ins stop working?

Did

@FelixE91
Copy link
Contributor

FelixE91 commented Mar 4, 2025

@dnerini pySTEPS/pysteps#405 implements the necessary changes into main pysteps repo. It's almost ready to be merged.

Are there any old plugins that were created with the old cookiecutter? Do you know any plugins that would not work anymore?

To my knowledge, there are the importers and exporters that are explicit in io.importers and io.exporters, respectively, and that were all added explicitly to io.interface.py and the ensemblestats that are explicit in postprocessing.ensemblestats.
Other plugin types than importers were not supported.

We created the new postprocessing.interface to support postprocessing plugins (i.e., plugin types diagnostic and ensemblestats for now).

If anything, we should be fine if we simply add additional read from entry points with group="pysteps.plugins.importers" to the function discover_importers() (for example in line 56 of io.interface)

  • I think that's the only change that might break old plugins: we replaced read from entry points with group="pysteps.plugins.importers" by group="pysteps.plugins.importer" (note the trailing "s")

Edit: I just merged the last suggested change into pySTEPS/pysteps#405

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Comments