pluginserver 0.5.2__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.
plugincore/__init__.py ADDED
File without changes
@@ -0,0 +1,54 @@
1
+ from aiohttp import web
2
+
3
+ class BasePlugin:
4
+ """
5
+ This is the base class for plugincore plugins.
6
+ The constructor handles setting up the instance variables so the
7
+ plugin can play nicely with the plugin manager.
8
+ """
9
+ def __init__(self, **kwargs):
10
+ self._auth_type = None
11
+ self._apikey = None
12
+ self.config = kwargs.get('config')
13
+ self._plugin_id = kwargs.get('route_path',self.__class__.__name__.lower())
14
+ auth = kwargs.get('auth_type').lower()
15
+ if auth:
16
+ if auth == 'global':
17
+ if 'auth' in self.config and 'apikey' in self.config.auth:
18
+ self._apikey = self.config.auth.apikey
19
+ else:
20
+ raise ValueError('Auth is global but no apikey in auth')
21
+ self._auth_type = 'global'
22
+ elif auth == 'plugin':
23
+ self._apikey = kwargs.get('apikey')
24
+ if not self._apikey:
25
+ raise ValueError('Auth is plugin but no plugin apikey')
26
+ self._auth_type = 'plugin'
27
+ self.args = dict(kwargs)
28
+
29
+ def _check_auth(self,data):
30
+ #print(f"_check_auth: {self._auth_type} apikey {self._apikey}, args {data}")
31
+ if self._auth_type:
32
+ user_key = data.get('apikey')
33
+ #print(f"Checking {user_key}")
34
+ if not user_key:
35
+ #print("Returning false")
36
+ return False
37
+ keymatch = self._apikey == user_key
38
+ #print(f"Returning keymatch {keymatch}")
39
+ return keymatch
40
+ #print("returning default true")
41
+ return True
42
+
43
+ def _get_plugin_id(self):
44
+ return self._plugin_id
45
+
46
+ async def handle_request(self, **data):
47
+ auth_check = self._check_auth(data)
48
+ if auth_check:
49
+ code, response = self.request_handler(**data)
50
+ else:
51
+ code, response = 403, {'error': 'unauthorized'}
52
+ if not isinstance(response,web.Response):
53
+ response_obj = web.json_response(response,status=code)
54
+ return response_obj
@@ -0,0 +1,192 @@
1
+ import configparser
2
+ import os
3
+ import keyword
4
+ import builtins
5
+ import re
6
+ from collections import UserDict
7
+
8
+ def value_bool(value: any) -> bool:
9
+ if type(value) is str:
10
+ return value in ['true','enabled','on','1','enable']
11
+ if value:
12
+ return True
13
+ return False
14
+
15
+ class Interpolator(configparser.ExtendedInterpolation):
16
+ """
17
+ This Interpolator class allows for variable interpolation in a few ways. Normally
18
+ the values from the ini file are, programaticcallt, config[section][variable] or
19
+ config.section.variable and these are strings but sometimes we need better conversions
20
+ so this class converts:
21
+ int:42 to an int with the value of 42
22
+ float:3.14 to a float with the value of 3.14
23
+ bool: converts values of 'true','enabled','on','1','enable to True otherwise False
24
+ list:item1 item2 item3 ended with & or end of line. Each item is checked for type
25
+ conversion shown above.
26
+ In addition ${ENV:var} will substitute ${ENV:var} with var from the user envionment.
27
+ ${section:var} will be replaced by the value of section.var in the file.
28
+ """
29
+ _env_var_pattern = re.compile(r'\$\{ENV:([^}]+)\}')
30
+ _typed_value_pattern = re.compile(r'^(bool|int|float|list):(.*)', re.DOTALL)
31
+
32
+ def __init__(self):
33
+ super().__init__()
34
+ self._type_constructors = {
35
+ 'bool': value_bool,
36
+ 'int': int,
37
+ 'float': float,
38
+ 'list': self._convert_list, # Add 'list' constructor here
39
+ }
40
+
41
+ def before_get(self, parser, section, option, value, defaults):
42
+ # Handle ${ENV:VAR}
43
+ value = self._env_var_pattern.sub(
44
+ lambda m: os.environ.get(m.group(1), ''), value
45
+ )
46
+
47
+ # Check for typed prefix
48
+ m = self._typed_value_pattern.match(value)
49
+ if m:
50
+ prefix, raw = m.group(1), m.group(2).lstrip()
51
+ converter = self._type_constructors.get(prefix)
52
+ if converter:
53
+ # Use the type constructor to convert the value
54
+ raw = converter(raw)
55
+ return raw
56
+ else:
57
+ return self._convert_list(raw) # Handle as list if no matching type
58
+
59
+ return super().before_get(parser, section, option, value, defaults)
60
+
61
+ def _convert_list(self, raw):
62
+ # Process 'list:' prefix if it exists
63
+ if raw.startswith('list:'):
64
+ raw = raw[5:].lstrip() # Remove 'list:' prefix
65
+
66
+ items = []
67
+ for token in raw.split():
68
+ # For each token, check for its type and apply conversion if necessary
69
+ m = self._typed_value_pattern.match(token)
70
+ if m:
71
+ prefix, item = m.group(1), m.group(2)
72
+ converter = self._type_constructors.get(prefix)
73
+ if converter:
74
+ items.append(converter(item)) # Convert using the correct constructor
75
+ else:
76
+ items.append(item) # If no type prefix, add as-is
77
+ else:
78
+ items.append(token) # If no match, add token as-is
79
+
80
+ return items
81
+
82
+ class Config(UserDict):
83
+ """ Parse and INI file for sections and keys, creating more Config objects for
84
+ each section.
85
+ usage:
86
+ 1 - read config file:
87
+ Config(file=<pathname>, env_override=True|False)
88
+ 2 - build object from dict in items:
89
+ Config(items=<dict>, env_override=True|False)
90
+
91
+ returns a quasi dict-like object where object properties are also keys when referencing
92
+ as a dict.
93
+
94
+ Environment overrides are done when env_override=True and if there is a value
95
+ of key (uppercase) in the environment. Key must exist in the ini_file.
96
+
97
+ There are a few restrictions with the section and key names:
98
+ keys must start with alpha characters (A-Z, a-z)
99
+ keys must NOT be python keywords, builtins, or attributes or methods of the Config class
100
+ itself, or the word self as these will cause issues internally.
101
+
102
+ The configuration data is accessible with either dot or index notation. This class
103
+ is based on UserDict so it will pretty much act like a dict.
104
+
105
+ See the Interpolator class above for information about how value strings are parsed.
106
+ """
107
+ def __init__(self, **kwargs):
108
+ self._foo = "foo"
109
+ super().__init__({})
110
+ section_name = kwargs.get('section_name')
111
+ env_prefix = kwargs.get('env_prefix')
112
+ filename = kwargs.get('file')
113
+ items = kwargs.get('items')
114
+ env_override = kwargs.get('env_override', False)
115
+
116
+ if not items and filename:
117
+ self.top_config = self;
118
+ config = config = configparser.ConfigParser(interpolation=Interpolator())
119
+ config.read(filename)
120
+ for section in config.sections():
121
+ if self._keyok(section,'main'):
122
+ section_items = dict(config.items(section))
123
+ conf = Config(top_config=self.top_config, items=section_items, env_override=env_override,env_prefix=env_prefix, section_name=section)
124
+ setattr(self, section,conf)
125
+ self.data[section] = conf
126
+ elif items:
127
+ self.top_config = kwargs.get('top_config',None)
128
+ for k, v in items.items():
129
+ if not section_name:
130
+ sect = '-main-'
131
+ else:
132
+ sect = section_name
133
+ if not len(k):
134
+ raise AttributeError(f"A key passed in {sect} was blank, this shouldn't happen")
135
+ if not k[0].isalpha():
136
+ raise AttributeError(f"Error in {sect}->{k}: configuration secions or keys must start with alpha characters")
137
+ if self._keyok(k,sect):
138
+ if env_override:
139
+ env_var = ""
140
+ if env_prefix:
141
+ env_var = f"{env_prefix.upper()}_"
142
+ if section_name:
143
+ env_var = env_var + f"{section_name.upper()}_"
144
+ env_var = env_var + k.upper()
145
+ if env_var in os.environ:
146
+ v = os.environ[env_var]
147
+
148
+ setattr(self, k, v)
149
+ self.data[k] = v
150
+ else:
151
+ raise AttributeError('items or file must be specified')
152
+
153
+ @property
154
+ def _keys(self):
155
+ return self.data.keys()
156
+
157
+ def _keyok(self,k,sect):
158
+ _forbidden_keys = {
159
+ 'python keyword': keyword.kwlist,
160
+ 'python builtin': dir(builtins),
161
+ 'class keyword': dir(self)+['self']
162
+ }
163
+ for ktype, klist in _forbidden_keys.items():
164
+ if k in klist:
165
+ raise AttributeError(f"Error in {sect}->{k}:, {k} is a {ktype} and may not be used")
166
+ return True
167
+
168
+ def __setitem__(self, key, item):
169
+ item = self._replace_env_vars(item)
170
+ print('setattr',self,key,item)
171
+ setattr(self,key,item)
172
+ return super().__setitem__(key, item)
173
+
174
+ def merge(self, other: "Config", overwrite: bool = True):
175
+ """
176
+ Merge another Config object into this one.
177
+
178
+ Args:
179
+ other (Config): Another config to merge from.
180
+ overwrite (bool): Whether to overwrite existing values.
181
+ """
182
+ for key in other._keys:
183
+ if key not in self._keys:
184
+ attr = getattr(other, key)
185
+ setattr(self, key, attr)
186
+ self.data[key] = attr
187
+ elif isinstance(getattr(self, key), Config) and isinstance(getattr(other, key), Config):
188
+ getattr(self, key).merge(getattr(other, key), overwrite=overwrite)
189
+ elif overwrite:
190
+ attr = getattr(other, key)
191
+ setattr(self, key, attr)
192
+ self.data[key] = attr
plugincore/cors.py ADDED
@@ -0,0 +1,92 @@
1
+ from aiohttp import web
2
+ import aiohttp_cors
3
+ import aiohttp_cors
4
+ from aiohttp import web
5
+ import re
6
+ from urllib.parse import urlparse
7
+
8
+ class CORS:
9
+ def setup(self, app, globalCfg):
10
+ self.origins = []
11
+ self.acl = []
12
+ self.config = globalCfg
13
+ self.cors_enabled = False
14
+
15
+ # Check if CORS is enabled in the config
16
+ if 'cors' in self.config:
17
+ if 'enabled' in self.config.cors:
18
+ self.cors_enabled = self.config.cors.enabled # Assuming this is a boolean
19
+ if self.cors_enabled:
20
+ # If enabled, fetch the allowed origins
21
+ if 'origin_url' in self.config.cors:
22
+ self.origins = self.config.cors.origin_url # List of allowed origins
23
+ else:
24
+ # If origin_url is not set, disable CORS
25
+ self.cors_enabled = False
26
+ if self.cors_enabled:
27
+ if 'acl' in self.config.cors:
28
+ self.acl = self.config.cors.acl
29
+ print(f"CORS setup, acl {self.acl}")
30
+
31
+
32
+ # If CORS is enabled, set it up with aiohttp_cors
33
+ if self.cors_enabled:
34
+ print(f"CORS Setup - ORIGIN URLs: {self.origins}")
35
+ cors = aiohttp_cors.setup(app)
36
+ for route in list(app.router.routes()):
37
+ cors.add(route, {
38
+ 'origins': self.origins,
39
+ 'allow_credentials': True,
40
+ 'expose_headers': "*",
41
+ 'allow_headers': "*",
42
+ 'allow_methods': ["GET", "POST", "OPTIONS"]
43
+ })
44
+
45
+ return self
46
+
47
+ def _add_header(self, response, request):
48
+ """Add the CORS headers to the response."""
49
+ request_origin = request.headers.get('Origin')
50
+ if request_origin == 'null':
51
+ request_origin = None
52
+ if not request_origin:
53
+ return response
54
+ host_name = urlparse(request_origin).hostname
55
+
56
+ request_ok = True
57
+ if self.cors_enabled and request_origin:
58
+ if request_origin in self.origins:
59
+ response.headers['Access-Control-Allow-Origin'] = request_origin
60
+ else:
61
+ request_ok = False
62
+ if self.acl:
63
+ for a in self.acl:
64
+ pattern = r'^[a-zA-Z0-9.-]*\.' + re.escape(a) + r'$|^' + re.escape(a) + r'$'
65
+ if re.match(pattern,urlparse(request_origin).hostname):
66
+ request_ok = True
67
+ break
68
+ if not request_ok:
69
+ return web.HTTPForbidden(text="CORS origin not allowed")
70
+
71
+ response.headers['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS'
72
+ response.headers['Access-Control-Allow-Headers'] = 'Content-Type, Authorization'
73
+ response.headers['Vary'] = 'Origin'
74
+ return response
75
+
76
+ def apply_headers(self, response, request):
77
+ """Apply CORS headers based on the response type."""
78
+ # Skip the CORS logic if CORS is disabled
79
+ if not self.cors_enabled:
80
+ return response # No CORS logic applied
81
+
82
+ if isinstance(response, web.Response):
83
+ response = self._add_header(response, request)
84
+ elif isinstance(response, dict):
85
+ response = self._add_header(web.json_response(response), request)
86
+ elif isinstance(response, str):
87
+ response = self._add_header(web.Response(text=response, content_type='text/html'), request)
88
+ else:
89
+ response = self._add_header(web.json_response({'result': str(response)}), request)
90
+
91
+ response.headers['X-Content-Type-Options'] = 'nosniff' # Security header
92
+ return response
@@ -0,0 +1,93 @@
1
+ import sys
2
+ import types
3
+ import inspect
4
+ import importlib.util
5
+ import os
6
+ import glob
7
+ from typing import Dict, List, Union
8
+ from plugincore import baseplugin
9
+ from urllib.parse import parse_qs
10
+
11
+ def parse_parameter_string(s):
12
+ return {key: value[0] for key, value in parse_qs(s).items()}
13
+
14
+ class PluginManager:
15
+ def __init__(self, plugin_dir: str, **kwargs):
16
+ self.plugin_dir = plugin_dir
17
+ self.plugins: Dict[str, baseplugin.BasePlugin] = {}
18
+ self.modules: Dict[str, types.ModuleType] = {}
19
+ self.config = kwargs.get('config')
20
+ self.kwargs = dict(kwargs)
21
+
22
+ def _load_module(self, filepath: str) -> types.ModuleType:
23
+ mod_name = os.path.basename(filepath).replace(".py", "")
24
+ spec = importlib.util.spec_from_file_location(mod_name, filepath)
25
+ if spec is None or spec.loader is None:
26
+ raise ImportError(f"Cannot load module from {filepath}")
27
+ mod = importlib.util.module_from_spec(spec)
28
+ spec.loader.exec_module(mod)
29
+ return mod
30
+
31
+ def _get_plugin_classes(self, mod: types.ModuleType) -> List[baseplugin.BasePlugin]:
32
+ classes = []
33
+ for name, cls in inspect.getmembers(mod, inspect.isclass):
34
+ if cls.__module__ == mod.__name__ and issubclass(cls, baseplugin.BasePlugin) and cls is not baseplugin.BasePlugin:
35
+ classes.append(cls)
36
+ return classes
37
+
38
+ def load_plugins(self):
39
+ plugin_files = glob.glob(os.path.join(self.plugin_dir, '*.py'))
40
+ print(f"Loading plugins from {self.plugin_dir}: {plugin_files}")
41
+ for path in plugin_files:
42
+ self.load_plugin(path)
43
+
44
+ def load_plugin(self, path: str):
45
+ plugin_module = os.path.splitext(os.path.basename(path))[0] # strip .py
46
+ mod = self._load_module(path)
47
+ self.modules[plugin_module] = mod
48
+
49
+ for cls in self._get_plugin_classes(mod):
50
+ adict = {}
51
+ try:
52
+ adict = parse_parameter_string(self.config.plugin_parms[plugin_module])
53
+ except (AttributeError, KeyError):
54
+ pass
55
+ kwargs = self.kwargs.copy()
56
+ kwargs.update(adict)
57
+ kwargs['config'] = self.config
58
+ instance = cls(**kwargs)
59
+ print(f"Loaded plugin {cls.__name__}: {instance}")
60
+ self.plugins[instance._get_plugin_id()] = instance
61
+
62
+ def remove_plugin(self, plugin_id: str):
63
+ plugin = self.plugins.pop(plugin_id, None)
64
+ if not plugin:
65
+ print(f"No plugin with ID {plugin_id}")
66
+ return
67
+
68
+ # Try to remove the module
69
+ module_name = plugin.__class__.__module__
70
+ module_file = os.path.basename(module_name + ".py")
71
+ print(f"Removing plugin {plugin_id} from module {module_name}")
72
+
73
+ self.modules.pop(module_file, None)
74
+ sys.modules.pop(module_name, None)
75
+
76
+ def reload_plugin(self, plugin_id: str):
77
+ if plugin_id not in self.plugins:
78
+ print(f"No such plugin to reload: {plugin_id}")
79
+ return
80
+ plugin = self.plugins[plugin_id]
81
+ module_name = plugin.__class__.__module__
82
+ module_file = os.path.basename(module_name + ".py")
83
+ full_path = os.path.join(self.plugin_dir, module_file)
84
+
85
+ self.remove_plugin(plugin_id)
86
+ self.load_plugin(full_path)
87
+
88
+ def get_plugin(self, plugin_id: str):
89
+ return self.plugins.get(plugin_id)
90
+
91
+ def all_plugins(self):
92
+ return self.plugins
93
+
plugincore/pserv.py ADDED
@@ -0,0 +1,165 @@
1
+ #!/usr/bin/env python3
2
+ import argparse
3
+ import inspect
4
+ import asyncio
5
+ import ssl
6
+ import os
7
+ import sys
8
+ import signal
9
+ from aiohttp import web
10
+ from plugincore import pluginmanager
11
+ from plugincore import configfile
12
+ import aiohttp_cors
13
+ from plugincore.cors import CORS
14
+ routes = web.RouteTableDef()
15
+ manager = None # PluginManager reference
16
+ globalCfg = None
17
+ import aiohttp_cors
18
+ from aiohttp import web
19
+
20
+ corsobj = CORS()
21
+ def main():
22
+ global manager
23
+ global globalCfg
24
+
25
+ we_are = os.path.splitext(os.path.basename(sys.argv[0]))[0]
26
+
27
+ parser = argparse.ArgumentParser(
28
+ description="Plugin Server - create a RESTapi using simple plugins",
29
+ epilog="Nicole Stevens/2025"
30
+ )
31
+ parser.add_argument('-i','--ini-file',default=f"{we_are}.ini",type=str, metavar='ini-file',help='Use an alternate config file')
32
+ args = parser.parse_args()
33
+
34
+ signal.signal(signal.SIGHUP, reload)
35
+ print(f"{we_are}({os.getpid()}): Installed SIGHUP handler for reload.")
36
+
37
+ globalCfg = configfile.Config(file=args.ini_file)
38
+
39
+ ssl_ctx = None
40
+ ssl_cert, ssl_key = (None, None)
41
+ enabled = False
42
+
43
+ # SSL setup if enabled
44
+ try:
45
+ ssl_key = globalCfg.SSL.keyfile
46
+ ssl_cert = globalCfg.SSL.certfile
47
+ enabled = globalCfg.SSL.enabled
48
+ except AttributeError:
49
+ pass
50
+ if ssl_key and ssl_cert and enabled:
51
+ ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
52
+ print("======== SSL Configuration ========")
53
+ print(f"SSL key {ssl_key}")
54
+ print(f"SSL certificate: {ssl_cert}")
55
+ print(f"SSL context {ssl_ctx}")
56
+ print("Loading SSL cert chain")
57
+ try:
58
+ ssl_ctx.load_cert_chain(ssl_cert, ssl_key, None)
59
+ except Exception as e:
60
+ print(f"Exception({type(e)}): Error loading ssl_cert_chain({ssl_cert},{ssl_key})")
61
+ for p in [ssl_cert, ssl_key]:
62
+ if not os.path.exists(p):
63
+ print(f"Path: {p} not found.")
64
+ ssl_ctx = None
65
+ print("End of SSL configuration.")
66
+
67
+ if not 'paths' in globalCfg:
68
+ print(f"no paths in {globalCfg}")
69
+ sys.exit(1)
70
+ print("======== Loading plugin modules ========")
71
+ manager = pluginmanager.PluginManager(globalCfg.paths.plugins, config=globalCfg)
72
+ manager.load_plugins()
73
+
74
+ # Register plugin routes
75
+ for plugin_id, instance in manager.plugins.items():
76
+ register_plugin_route(plugin_id, instance, globalCfg)
77
+
78
+ # Setup event loop for file watcher
79
+
80
+ # Management endpoints
81
+ register_control_routes(globalCfg)
82
+
83
+ app = web.Application()
84
+
85
+ # CORS setup
86
+ corsobj.setup(app,globalCfg)
87
+
88
+ app.add_routes(routes)
89
+ web.run_app(app, host=globalCfg.network.bindto, port=globalCfg.network.port, ssl_context=ssl_ctx)
90
+
91
+ # --- Auth Helper ---
92
+ def check_auth(data, config):
93
+ try:
94
+ expected = config.auth.apikey
95
+ except AttributeError:
96
+ expected = None
97
+ provided = data.get('apikey')
98
+ return expected and provided and expected == provided
99
+
100
+ # --- Plugin Request Handler ---
101
+ def register_plugin_route(plugin_id, instance, config):
102
+ print(f"Registering route: /{plugin_id} to {instance}")
103
+
104
+ @routes.route('*', f'/{plugin_id}')
105
+ @routes.route('*', f'/{plugin_id}/{{tail:.*}}')
106
+ async def handle(request, inst=instance, pid=plugin_id, cfg=config):
107
+ print(request.remote, '- request -', pid)
108
+ plugin = manager.get_plugin(pid)
109
+ data = {}
110
+ if request.method == 'POST' and request.can_read_body:
111
+ try:
112
+ data.update(await request.json())
113
+ except Exception:
114
+ pass
115
+ data.update(request.query)
116
+ data['request_headers'] = dict(request.headers)
117
+ # You can also capture `tail` if you want to use the subpath
118
+ try:
119
+ data['subpath'] = request.match_info['tail']
120
+ except KeyError:
121
+ data['subpath'] = None
122
+ response = await maybe_async(plugin.handle_request(**data))
123
+ response = corsobj.apply_headers(response, request)
124
+ return response
125
+
126
+ # --- Control Routes ---
127
+ def register_control_routes(config):
128
+ @routes.get('/plugins')
129
+ async def plugin_list(request):
130
+ data = dict(request.query)
131
+ if not check_auth(data, config):
132
+ return web.json_response({'error': 'unauthorized'}, status=403)
133
+ return corsobj.apply_headers(web.json_response({'loaded_plugins': list(manager.plugins.keys())}),request)
134
+
135
+ @routes.get('/reload/{plugin_id}')
136
+ async def reload_plugin(request):
137
+ data = dict(request.query)
138
+ if not check_auth(data, config):
139
+ return corsobj.apply_headers(web.json_response({'error': 'unauthorized'}, status=403),request)
140
+
141
+ pid = request.match_info['plugin_id']
142
+ if pid in manager.plugins:
143
+ success = manager.reload_plugin(pid)
144
+ return corsobj.apply_headers(web.json_response({'reloaded': pid, 'success': success}),request)
145
+ return corsobj.apply_headers(web.json_response({'error': f'Plugin "{pid}" not found'}, status=404),request)
146
+
147
+ @routes.get('/reload/all')
148
+ async def reload_all(request):
149
+ data = dict(request.query)
150
+ if not check_auth(data, config):
151
+ return corsobj.apply_headers(web.json_response({'error': 'unauthorized'}, status=403),request)
152
+ manager.load_plugins()
153
+ return corsobj.apply_headers(web.json_response({'status': 'All plugins reloaded', 'loaded_plugins': list(manager.plugins.keys())}),request)
154
+
155
+ # --- Coroutine Await Helper ---
156
+ async def maybe_async(value):
157
+ return await value if inspect.isawaitable(value) else value
158
+
159
+ # ---- Reload handler ----
160
+ def reload(signum, frame):
161
+ print("Received SIGHUP, restarting...")
162
+ os.execl(sys.executable, sys.executable, *sys.argv)
163
+
164
+ if __name__ == "__main__":
165
+ main()
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: pluginserver
3
+ Version: 0.5.2
4
+ Summary: Plugin-driven API server
5
+ Home-page: https://github.com/nicciniamh/pluginserver
6
+ Author: Your Name
7
+ License: MIT
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ License-File: LICENSE.txt
11
+ Requires-Dist: aiohttp
12
+ Requires-Dist: aiohttp_cors
13
+ Dynamic: author
14
+ Dynamic: classifier
15
+ Dynamic: home-page
16
+ Dynamic: license
17
+ Dynamic: license-file
18
+ Dynamic: requires-dist
19
+ Dynamic: summary
@@ -0,0 +1,12 @@
1
+ plugincore/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ plugincore/baseplugin.py,sha256=j9Kbp7jYv1VR6rwLVC3xsUnx1urGU4RLmY0tsTRw3A8,2080
3
+ plugincore/configfile.py,sha256=d-B2Hlq_0K8-E9NcMVwx6V6NLNpBPmeAaXulhJs2NmU,7948
4
+ plugincore/cors.py,sha256=eO9ZtBNIiEL8ZLa5cJhoI7vDZ-PlCYtBQf37-Qu9yxE,3770
5
+ plugincore/pluginmanager.py,sha256=tl_5la_oavNo8xNKUr4t_z38hZJkBRvXASnKpeGH51E,3445
6
+ plugincore/pserv.py,sha256=PQye9PRNZTfKRWw1EdGnKNYRM56ckWH5pYilKy8ikzw,5818
7
+ pluginserver-0.5.2.dist-info/licenses/LICENSE.txt,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
8
+ pluginserver-0.5.2.dist-info/METADATA,sha256=4UKXFpq1bLOCwaMwvgyamKbPSwwWBJYc3kpaTh0zHxo,481
9
+ pluginserver-0.5.2.dist-info/WHEEL,sha256=7ciDxtlje1X8OhobNuGgi1t-ACdFSelPnSmDPrtlobY,91
10
+ pluginserver-0.5.2.dist-info/entry_points.txt,sha256=SMcJdZ-cComomjB0Bx5K8r845qBV6w4pxWnrDax7zlY,49
11
+ pluginserver-0.5.2.dist-info/top_level.txt,sha256=P7DxYseqkcmCILUaPcViUwS-oUx_cLgBayrWS8gqaiA,11
12
+ pluginserver-0.5.2.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.2.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pserve = plugincore.pserv:main
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1 @@
1
+ plugincore