pluginify 0.1.0.post11.dev0__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pluginify/_version.py +2 -2
- pluginify/commandline_typer.py +4 -2
- pluginify/config.py +3 -1
- pluginify/create_plugin_registries.py +12 -0
- pluginify/interfaces/__init__.py +5 -2
- pluginify/interfaces/base.py +2 -2
- pluginify/interfaces/class_based/data_modifiers.py +1 -1
- pluginify/interfaces/class_based_plugin.py +10 -6
- pluginify/plugin_registry.py +4 -5
- pluginify/plugins/classes/data_modifiers/cuboid.py +3 -0
- pluginify/pydantic_models/v1/configs.py +3 -0
- pluginify/utils/validators.py +3 -0
- {pluginify-0.1.0.post11.dev0.dist-info → pluginify-1.0.0.dist-info}/METADATA +13 -9
- pluginify-1.0.0.dist-info/RECORD +23 -0
- {pluginify-0.1.0.post11.dev0.dist-info → pluginify-1.0.0.dist-info}/WHEEL +1 -1
- pluginify-0.1.0.post11.dev0.dist-info/RECORD +0 -23
- {pluginify-0.1.0.post11.dev0.dist-info → pluginify-1.0.0.dist-info}/entry_points.txt +0 -0
- {pluginify-0.1.0.post11.dev0.dist-info → pluginify-1.0.0.dist-info}/licenses/LICENSE +0 -0
pluginify/_version.py
CHANGED
pluginify/commandline_typer.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# # # This source code is subject to the license referenced at
|
|
2
|
+
# # # https://github.com/NRLMMD-GEOIPS.
|
|
3
|
+
|
|
1
4
|
"""Commandline module for Pluginify.
|
|
2
5
|
|
|
3
6
|
Supports two main commands, `pluginify create` and `pluginify delete` as well as
|
|
@@ -140,7 +143,6 @@ class DocstringTyper(typer.Typer):
|
|
|
140
143
|
new_params = []
|
|
141
144
|
|
|
142
145
|
for name, param in sig.parameters.items():
|
|
143
|
-
|
|
144
146
|
default = param.default
|
|
145
147
|
help_text = param_help.get(name)
|
|
146
148
|
|
|
@@ -155,7 +157,7 @@ class DocstringTyper(typer.Typer):
|
|
|
155
157
|
|
|
156
158
|
# Optional arguments
|
|
157
159
|
short = f"-{name[0]}"
|
|
158
|
-
long = f"--{name.replace('_','-')}"
|
|
160
|
+
long = f"--{name.replace('_', '-')}"
|
|
159
161
|
|
|
160
162
|
option = typer.Option(default, short, long, help=help_text)
|
|
161
163
|
|
pluginify/config.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# # # This source code is subject to the license referenced at
|
|
2
|
+
# # # https://github.com/NRLMMD-GEOIPS.
|
|
3
|
+
|
|
1
4
|
"""Module containing configuration variables needed for pluginify to run."""
|
|
2
5
|
|
|
3
6
|
|
|
@@ -58,7 +61,6 @@ def _env_to_variable(name, default):
|
|
|
58
61
|
env_val = getenv(name)
|
|
59
62
|
|
|
60
63
|
if env_val:
|
|
61
|
-
|
|
62
64
|
if name == "PLUGINIFY_REGISTRY_DIRECTORY":
|
|
63
65
|
return Path(env_val)
|
|
64
66
|
elif name == "PLUGINIFY_REBUILD_REGISTRIES":
|
|
@@ -957,6 +957,18 @@ def add_class_plugin(package, relpath, plugins):
|
|
|
957
957
|
at relpath '{relpath}'\n"""
|
|
958
958
|
return error_message
|
|
959
959
|
|
|
960
|
+
# If interface is None, then legitimately skip the module.
|
|
961
|
+
# We want to skip this first, before we test anything else.
|
|
962
|
+
# If it is not a plugin, we don't care if there are other
|
|
963
|
+
# errors in it at this stage (ie, avoid unnecessary unrelated
|
|
964
|
+
# catastrophic failures)
|
|
965
|
+
if hasattr(module, "interface") and module.interface is None:
|
|
966
|
+
LOG.info(
|
|
967
|
+
f"Skipping module '{module_name}' from '{package}', "
|
|
968
|
+
"interface_name is 'None'"
|
|
969
|
+
)
|
|
970
|
+
return error_message
|
|
971
|
+
|
|
960
972
|
# We've encountered a truly 'class-based' plugin. I.e. we don't need to generate
|
|
961
973
|
# the plugin object from the module itself. Collect metadata from this plugin
|
|
962
974
|
# in a different fashion to what we've done previously.
|
pluginify/interfaces/__init__.py
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
# # # This source code is subject to the license referenced at
|
|
2
|
+
# # # https://github.com/NRLMMD-GEOIPS.
|
|
3
|
+
|
|
1
4
|
"""Initialization module for pluginify interfaces."""
|
|
2
5
|
|
|
3
|
-
from pluginify.interfaces.class_based.data_modifiers import data_modifiers
|
|
4
|
-
from pluginify.interfaces.yaml_based.configs import configs
|
|
6
|
+
from pluginify.interfaces.class_based.data_modifiers import data_modifiers # noqa: F401
|
|
7
|
+
from pluginify.interfaces.yaml_based.configs import configs # noqa: F401
|
|
5
8
|
|
|
6
9
|
class_based_interfaces = ["data_modifiers"]
|
|
7
10
|
yaml_based_interfaces = ["configs"]
|
pluginify/interfaces/base.py
CHANGED
|
@@ -35,7 +35,7 @@ class BaseInterface(abc.ABC):
|
|
|
35
35
|
import pluginify.plugin_registry as plugin_registry_module
|
|
36
36
|
|
|
37
37
|
name = "BaseInterface"
|
|
38
|
-
interface_type =
|
|
38
|
+
interface_type: str = "" # This is set by child classes
|
|
39
39
|
rebuild_registries = REBUILD_REGISTRIES
|
|
40
40
|
# Setting this attribute at the top level so it can be used by all methods.
|
|
41
41
|
# This can be overridden by setting them in child interface classes
|
|
@@ -375,7 +375,7 @@ class BaseClassInterface(BaseInterface):
|
|
|
375
375
|
|
|
376
376
|
interface_type = "class_based"
|
|
377
377
|
name = "BaseClassInterface"
|
|
378
|
-
required_args = {}
|
|
378
|
+
required_args: dict[str, list[str]] = {}
|
|
379
379
|
|
|
380
380
|
def __repr__(self):
|
|
381
381
|
"""Plugin interface repr method."""
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
# # # This source code is subject to the license referenced at
|
|
2
|
+
# # # https://github.com/NRLMMD-GEOIPS.
|
|
3
|
+
|
|
1
4
|
"""Implements a base class for class-based plugins.
|
|
2
5
|
|
|
3
6
|
The base class implemented here would expose the call signature of the child plugin
|
|
@@ -72,6 +75,7 @@ class BaseClassPlugin(ABC):
|
|
|
72
75
|
# If no family is provided, just assume it works with DT
|
|
73
76
|
data_tree = False
|
|
74
77
|
required_attributes = ["interface", "family", "name"]
|
|
78
|
+
__plugin_abstract__: bool = False
|
|
75
79
|
|
|
76
80
|
def _check_interface_attribute(cls):
|
|
77
81
|
"""Check the validity of the 'interface' attribute.
|
|
@@ -196,15 +200,15 @@ class BaseClassPlugin(ABC):
|
|
|
196
200
|
if "__call__" in cls.__dict__:
|
|
197
201
|
raise TypeError(f"{cls.__name__} cannot override __call__")
|
|
198
202
|
|
|
199
|
-
|
|
200
|
-
call_method = cls.__dict__.get("call")
|
|
201
|
-
except AttributeError:
|
|
203
|
+
if "call" not in cls.__dict__:
|
|
202
204
|
raise TypeError(f"{cls.__name__} must implement call()")
|
|
205
|
+
call_method = cls.__dict__["call"]
|
|
203
206
|
|
|
204
|
-
@functools.wraps(call_method)
|
|
207
|
+
@functools.wraps(call_method) # type: ignore[arg-type]
|
|
205
208
|
def _call(self, data=None, *args, **kwargs):
|
|
206
209
|
return cls._invoke(self, data, *args, **kwargs)
|
|
207
210
|
|
|
208
|
-
|
|
211
|
+
call_sig = inspect.signature(call_method)
|
|
212
|
+
_call.__signature__ = call_sig # type: ignore[attr-defined]
|
|
209
213
|
_call.__annotations__ = getattr(call_method, "__annotations__", {})
|
|
210
|
-
cls.__call__ = _call
|
|
214
|
+
cls.__call__ = _call # type: ignore[method-assign]
|
pluginify/plugin_registry.py
CHANGED
|
@@ -128,7 +128,7 @@ class PluginRegistry:
|
|
|
128
128
|
|
|
129
129
|
See the interface_mapping property for more information.
|
|
130
130
|
"""
|
|
131
|
-
self.
|
|
131
|
+
self._interface_mapping = new_value
|
|
132
132
|
|
|
133
133
|
@property
|
|
134
134
|
def registered_yaml_based_plugins(self):
|
|
@@ -170,7 +170,6 @@ class PluginRegistry:
|
|
|
170
170
|
"""
|
|
171
171
|
# Load the registries here and return them as a dictionary
|
|
172
172
|
if not hasattr(self, "_registered_plugins") or force_reset:
|
|
173
|
-
|
|
174
173
|
# Complete dictionary of all available plugins found in every plugin package
|
|
175
174
|
self._registered_plugins = {}
|
|
176
175
|
# A mapping of interfaces to plugin_types. Ie:
|
|
@@ -478,9 +477,9 @@ class PluginRegistry:
|
|
|
478
477
|
|
|
479
478
|
if _expand:
|
|
480
479
|
# Only applies to workflow plugins
|
|
481
|
-
return model_class.model_validate(data, context={"expand": True})
|
|
480
|
+
return model_class.model_validate(data, context={"expand": True}) # type: ignore[no-any-return] # NOQA
|
|
482
481
|
|
|
483
|
-
return model_class(**data)
|
|
482
|
+
return model_class(**data) # type: ignore[no-any-return]
|
|
484
483
|
|
|
485
484
|
def get_yaml_plugin(
|
|
486
485
|
self, interface_obj, name, rebuild_registries=None, _expand=False
|
|
@@ -886,7 +885,7 @@ class PluginRegistry:
|
|
|
886
885
|
for pkg in plugin_packages:
|
|
887
886
|
if pkg.value in packages:
|
|
888
887
|
filtered_packages.append(pkg)
|
|
889
|
-
plugin_packages = filtered_packages
|
|
888
|
+
plugin_packages = type(plugin_packages)(filtered_packages) # type: ignore[arg-type] # NOQA
|
|
890
889
|
|
|
891
890
|
LOG.debug(plugin_packages)
|
|
892
891
|
create_plugin_registries(plugin_packages, save_type, self.namespace)
|
pluginify/utils/validators.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pluginify
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Pluginify package
|
|
5
5
|
License: LICENSE
|
|
6
6
|
License-File: LICENSE
|
|
@@ -24,11 +24,12 @@ Requires-Dist: typer
|
|
|
24
24
|
Project-URL: Repository, https://github.com/NRLMMD-GEOIPS/pluginify
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
```
|
|
28
|
+
# # # This source code is subject to the license referenced at
|
|
29
|
+
# # # https://github.com/NRLMMD-GEOIPS.
|
|
30
|
+
```
|
|
29
31
|
|
|
30
|
-
Pluginify
|
|
31
|
-
=========
|
|
32
|
+
# Pluginify
|
|
32
33
|
|
|
33
34
|
This repository contains everything necessary to fully register YAML and python classes
|
|
34
35
|
and/or modules as valid python plugin objects. A YAML-based plugin object essentially
|
|
@@ -43,21 +44,24 @@ PluginRegistry class. This package can and is used alongside other packages such
|
|
|
43
44
|
[GeoIPS](https://github.com/NRLMMD-GEOIPS/geoips) to handle their plugin-based
|
|
44
45
|
infrastructure.
|
|
45
46
|
|
|
46
|
-
Install pluginify package
|
|
47
|
-
|
|
47
|
+
## Install pluginify package
|
|
48
|
+
|
|
48
49
|
Current status:
|
|
50
|
+
|
|
49
51
|
```bash
|
|
50
52
|
git clone https://github.com/NRLMMD-GEOIPS/pluginify.git
|
|
51
53
|
# cd to pluginify's top level dir
|
|
52
54
|
pip install -e .
|
|
53
55
|
```
|
|
56
|
+
|
|
54
57
|
OR
|
|
58
|
+
|
|
55
59
|
```bash
|
|
56
60
|
pip install pluginify
|
|
57
61
|
```
|
|
58
62
|
|
|
59
|
-
Use pluginify
|
|
60
|
-
|
|
63
|
+
## Use pluginify
|
|
64
|
+
|
|
61
65
|
```bash
|
|
62
66
|
pluginify -h
|
|
63
67
|
# Top level commands without additional args
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
pluginify/__init__.py,sha256=NvdicJtfy-dZZ8tWjR74lDBHGV6rlaH8pAJ7UHyTTog,391
|
|
2
|
+
pluginify/_version.py,sha256=_A4laf9sZrPdPuY5EXul3a2Vg5lnQ6haJUkOc9eNta8,209
|
|
3
|
+
pluginify/commandline_typer.py,sha256=i0aVQEABfS8oL6ATUmzMqgtQQLhw0nMQmYzwpPzTF8k,11361
|
|
4
|
+
pluginify/config.py,sha256=ffmzSyAjPNePkSZrqinu20ZJkbmG-L4TREgRfFmPL4M,4997
|
|
5
|
+
pluginify/create_plugin_registries.py,sha256=TTYwRd2gxvsMV1l_1nTat_zkAIHTjHJZIoAwdRtcHtg,49447
|
|
6
|
+
pluginify/errors.py,sha256=kkdipLfxvj8f-Pp53SD3RPnD9QS3samBLlQBjBskZP8,373
|
|
7
|
+
pluginify/interfaces/__init__.py,sha256=OkhHHE8WUEh12n3VrAWfMUv2-AAz7wfy5OcEyY-KtTc,461
|
|
8
|
+
pluginify/interfaces/base.py,sha256=CMgPG2NpodrECXXJbayTIVt8Vqrrxd_QADAgGM5qgUk,26749
|
|
9
|
+
pluginify/interfaces/class_based/data_modifiers.py,sha256=INQCUaXWpUpRIljjhvg-ndUB_sRoMt7pzEVVEM3PeAQ,1094
|
|
10
|
+
pluginify/interfaces/class_based_plugin.py,sha256=IA1bo33yior-udeaX_Cv8X8AA8syufI3rvxeMdv5hls,8431
|
|
11
|
+
pluginify/interfaces/yaml_based/configs.py,sha256=3U_nKCm2mIVfA_cRl-VUmu8JrQQQ3u24eshH46a9GI0,808
|
|
12
|
+
pluginify/plugin_registry.py,sha256=PB2k7g4lnONNkMPEebbgZTSH3hEYmo_9wcSvlS5aUAI,43416
|
|
13
|
+
pluginify/plugins/classes/data_modifiers/cuboid.py,sha256=1pRE04bL5L5MHRHnky_hvKx2W-OkhzRLxgBPbbfMvMo,1211
|
|
14
|
+
pluginify/plugins/yaml/configs/stucco.yaml,sha256=OXLWzmmzxSAWs-MzSlmEa-OLGJzVJzrVQZwgGPL2jqE,376
|
|
15
|
+
pluginify/pydantic_models/v1/configs.py,sha256=KfWsIveOqPOi_J53odFFY6gFOHNYPpwQdPDqRXCfpnI,2226
|
|
16
|
+
pluginify/utils/__init__.py,sha256=gdy4E4yEI9lrHbWPeBn0Bspj7iz4z6r8BAjbmHf_hpM,2088
|
|
17
|
+
pluginify/utils/context_managers.py,sha256=1-bREbijNNc5PrqMIihKqxlxNaK-YZ3hj5XGpHiYmfw,926
|
|
18
|
+
pluginify/utils/validators.py,sha256=ssfcUsvUlYfhWt5AjncU66KD4qDSv0N1BdR99ytvQjY,7681
|
|
19
|
+
pluginify-1.0.0.dist-info/METADATA,sha256=07HolU0DI13d7WhKAOhs5rI4JVLSNYc6nkpBNM8raek,2116
|
|
20
|
+
pluginify-1.0.0.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
|
|
21
|
+
pluginify-1.0.0.dist-info/entry_points.txt,sha256=kCm7HOEEzSnPyDpy98W-LYYmlLYyTnRqOj40UqxX6-w,111
|
|
22
|
+
pluginify-1.0.0.dist-info/licenses/LICENSE,sha256=sIBqTiU78gw5bC9MZMySNxzCE7DIlOcDqUWdmflkDsY,7266
|
|
23
|
+
pluginify-1.0.0.dist-info/RECORD,,
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
pluginify/__init__.py,sha256=NvdicJtfy-dZZ8tWjR74lDBHGV6rlaH8pAJ7UHyTTog,391
|
|
2
|
-
pluginify/_version.py,sha256=n4Mesoqrw8DK8LkjhySdwEOZeCLfBv_cuSDOZyMBxiU,239
|
|
3
|
-
pluginify/commandline_typer.py,sha256=g_pT1V8xwAF9KK-ndE-ydIYk2ivZYoO24PBW80CjsoM,11257
|
|
4
|
-
pluginify/config.py,sha256=co4HkXsOrA68M0PlRaUAhz5KMp5pa60ssb7DwLvUuxk,4894
|
|
5
|
-
pluginify/create_plugin_registries.py,sha256=rZmZV_iIBc3FHfhhCW4axMpoBaT1dq_P3OPS7jVrQlQ,48934
|
|
6
|
-
pluginify/errors.py,sha256=kkdipLfxvj8f-Pp53SD3RPnD9QS3samBLlQBjBskZP8,373
|
|
7
|
-
pluginify/interfaces/__init__.py,sha256=XcPl52V8oMihP7NoRs_NgbiIvqoL3A4YeyfTOp3NqBA,329
|
|
8
|
-
pluginify/interfaces/base.py,sha256=ubimAsOgAXCyhKhn40-a1HIfrjMPqHtKr4rBnwm645M,26724
|
|
9
|
-
pluginify/interfaces/class_based/data_modifiers.py,sha256=p-d80oywjo9Rr6txowr1BIlg08qeOm3dAMm_4JQ0iH8,1072
|
|
10
|
-
pluginify/interfaces/class_based_plugin.py,sha256=TMuJ2INaaFaUlxPX05L5r2gH3ISu1W_2qWllGA63oq4,8209
|
|
11
|
-
pluginify/interfaces/yaml_based/configs.py,sha256=3U_nKCm2mIVfA_cRl-VUmu8JrQQQ3u24eshH46a9GI0,808
|
|
12
|
-
pluginify/plugin_registry.py,sha256=CLcR8xXPPaB3fd2KOODUZRiOSg3hhMyKiyKyAv9KpVE,43291
|
|
13
|
-
pluginify/plugins/classes/data_modifiers/cuboid.py,sha256=WyvhPrRptpSHtPqeOdF1oiHm6zFwHahsLwNvsMdmQEE,1107
|
|
14
|
-
pluginify/plugins/yaml/configs/stucco.yaml,sha256=OXLWzmmzxSAWs-MzSlmEa-OLGJzVJzrVQZwgGPL2jqE,376
|
|
15
|
-
pluginify/pydantic_models/v1/configs.py,sha256=As15amNtdFwAobufh0d6mDlF3mMS23ThwTKQy9q25bc,2122
|
|
16
|
-
pluginify/utils/__init__.py,sha256=gdy4E4yEI9lrHbWPeBn0Bspj7iz4z6r8BAjbmHf_hpM,2088
|
|
17
|
-
pluginify/utils/context_managers.py,sha256=1-bREbijNNc5PrqMIihKqxlxNaK-YZ3hj5XGpHiYmfw,926
|
|
18
|
-
pluginify/utils/validators.py,sha256=gCESprY4mZgE0KXigjsgHOipjZAg8OUF5n3-SGQ7PG4,7577
|
|
19
|
-
pluginify-0.1.0.post11.dev0.dist-info/METADATA,sha256=aY4LQhrTUPYsmTcEh9QyW6SkMiqlDM-dgX-HW7DmIZs,2165
|
|
20
|
-
pluginify-0.1.0.post11.dev0.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
|
|
21
|
-
pluginify-0.1.0.post11.dev0.dist-info/entry_points.txt,sha256=kCm7HOEEzSnPyDpy98W-LYYmlLYyTnRqOj40UqxX6-w,111
|
|
22
|
-
pluginify-0.1.0.post11.dev0.dist-info/licenses/LICENSE,sha256=sIBqTiU78gw5bC9MZMySNxzCE7DIlOcDqUWdmflkDsY,7266
|
|
23
|
-
pluginify-0.1.0.post11.dev0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|