fprime-gds 3.4.3__py3-none-any.whl → 3.4.4a2__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.
Files changed (37) hide show
  1. fprime_gds/common/communication/adapters/base.py +30 -58
  2. fprime_gds/common/communication/adapters/ip.py +23 -5
  3. fprime_gds/common/communication/adapters/uart.py +20 -7
  4. fprime_gds/common/communication/checksum.py +1 -3
  5. fprime_gds/common/communication/framing.py +53 -4
  6. fprime_gds/common/data_types/event_data.py +6 -1
  7. fprime_gds/common/data_types/exceptions.py +16 -11
  8. fprime_gds/common/loaders/ch_json_loader.py +107 -0
  9. fprime_gds/common/loaders/ch_xml_loader.py +5 -5
  10. fprime_gds/common/loaders/cmd_json_loader.py +85 -0
  11. fprime_gds/common/loaders/dict_loader.py +1 -1
  12. fprime_gds/common/loaders/event_json_loader.py +108 -0
  13. fprime_gds/common/loaders/event_xml_loader.py +10 -6
  14. fprime_gds/common/loaders/json_loader.py +222 -0
  15. fprime_gds/common/loaders/xml_loader.py +31 -9
  16. fprime_gds/common/pipeline/dictionaries.py +38 -3
  17. fprime_gds/common/tools/seqgen.py +4 -4
  18. fprime_gds/common/utils/string_util.py +57 -65
  19. fprime_gds/common/zmq_transport.py +37 -20
  20. fprime_gds/executables/apps.py +150 -0
  21. fprime_gds/executables/cli.py +239 -103
  22. fprime_gds/executables/comm.py +17 -27
  23. fprime_gds/executables/data_product_writer.py +935 -0
  24. fprime_gds/executables/run_deployment.py +55 -14
  25. fprime_gds/executables/utils.py +24 -12
  26. fprime_gds/flask/sequence.py +1 -1
  27. fprime_gds/flask/static/addons/commanding/command-input.js +3 -2
  28. fprime_gds/plugin/__init__.py +0 -0
  29. fprime_gds/plugin/definitions.py +71 -0
  30. fprime_gds/plugin/system.py +225 -0
  31. {fprime_gds-3.4.3.dist-info → fprime_gds-3.4.4a2.dist-info}/METADATA +3 -2
  32. {fprime_gds-3.4.3.dist-info → fprime_gds-3.4.4a2.dist-info}/RECORD +37 -28
  33. {fprime_gds-3.4.3.dist-info → fprime_gds-3.4.4a2.dist-info}/WHEEL +1 -1
  34. {fprime_gds-3.4.3.dist-info → fprime_gds-3.4.4a2.dist-info}/entry_points.txt +2 -3
  35. {fprime_gds-3.4.3.dist-info → fprime_gds-3.4.4a2.dist-info}/LICENSE.txt +0 -0
  36. {fprime_gds-3.4.3.dist-info → fprime_gds-3.4.4a2.dist-info}/NOTICE.txt +0 -0
  37. {fprime_gds-3.4.3.dist-info → fprime_gds-3.4.4a2.dist-info}/top_level.txt +0 -0
@@ -13,6 +13,7 @@ from fprime_gds.executables.cli import (
13
13
  GdsParser,
14
14
  ParserBase,
15
15
  StandardPipelineParser,
16
+ PluginArgumentParser,
16
17
  )
17
18
  from fprime_gds.executables.utils import AppWrapperException, run_wrapped_application
18
19
 
@@ -20,14 +21,20 @@ BASE_MODULE_ARGUMENTS = [sys.executable, "-u", "-m"]
20
21
 
21
22
 
22
23
  def parse_args():
23
- """ Parse command line arguments
24
+ """Parse command line arguments
24
25
  Gets an argument parsers to read the command line and process the arguments. Return
25
26
  the arguments in their namespace.
26
27
 
27
28
  :return: parsed argument namespace
28
29
  """
29
30
  # Get custom handlers for all executables we are running
30
- arg_handlers = [StandardPipelineParser, GdsParser, BinaryDeployment, CommParser]
31
+ arg_handlers = [
32
+ StandardPipelineParser,
33
+ GdsParser,
34
+ BinaryDeployment,
35
+ CommParser,
36
+ PluginArgumentParser,
37
+ ]
31
38
  # Parse the arguments, and refine through all handlers
32
39
  args, parser = ParserBase.parse_args(arg_handlers, "Run F prime deployment and GDS")
33
40
  return args
@@ -63,7 +70,7 @@ def launch_process(cmd, logfile=None, name=None, env=None, launch_time=5):
63
70
 
64
71
 
65
72
  def launch_tts(parsed_args):
66
- """ Launch the ThreadedTcpServer middleware application
73
+ """Launch the ThreadedTcpServer middleware application
67
74
 
68
75
 
69
76
  Args:
@@ -85,7 +92,7 @@ def launch_tts(parsed_args):
85
92
 
86
93
 
87
94
  def launch_html(parsed_args):
88
- """ Launch the Flask application
95
+ """Launch the Flask application
89
96
 
90
97
  Args:
91
98
  parsed_args: parsed argument namespace
@@ -112,14 +119,18 @@ def launch_html(parsed_args):
112
119
  str(parsed_args.gui_port),
113
120
  ]
114
121
  ret = launch_process(gse_args, name="HTML GUI", env=flask_env, launch_time=2)
122
+ ui_url = f"http://{str(parsed_args.gui_addr)}:{str(parsed_args.gui_port)}/"
123
+ print(f"[INFO] Launched UI at: {ui_url}")
115
124
  webbrowser.open(
116
- f"http://{str(parsed_args.gui_addr)}:{str(parsed_args.gui_port)}/", new=0, autoraise=True
125
+ ui_url,
126
+ new=0,
127
+ autoraise=True,
117
128
  )
118
129
  return ret
119
130
 
120
131
 
121
132
  def launch_app(parsed_args):
122
- """ Launch the raw application
133
+ """Launch the raw application
123
134
 
124
135
  Args:
125
136
  parsed_args: parsed argument namespace
@@ -128,14 +139,20 @@ def launch_app(parsed_args):
128
139
  """
129
140
  app_path = parsed_args.app
130
141
  logfile = os.path.join(parsed_args.logs, f"{app_path.name}.log")
131
- app_cmd = [app_path.absolute(), "-p", str(parsed_args.port), "-a", parsed_args.address]
142
+ app_cmd = [
143
+ app_path.absolute(),
144
+ "-p",
145
+ str(parsed_args.port),
146
+ "-a",
147
+ parsed_args.address,
148
+ ]
132
149
  return launch_process(
133
150
  app_cmd, name=f"{app_path.name} Application", logfile=logfile, launch_time=1
134
151
  )
135
152
 
136
153
 
137
154
  def launch_comm(parsed_args):
138
- """ Launch the communication adapter process
155
+ """Launch the communication adapter process
139
156
 
140
157
  Args:
141
158
  parsed_args: parsed argument namespace
@@ -143,9 +160,27 @@ def launch_comm(parsed_args):
143
160
  launched process
144
161
  """
145
162
  arguments = CommParser().reproduce_cli_args(parsed_args)
146
- arguments = arguments + ["--log-directly"] if "--log-directly" not in arguments else arguments
163
+ arguments = (
164
+ arguments + ["--log-directly"]
165
+ if "--log-directly" not in arguments
166
+ else arguments
167
+ )
147
168
  app_cmd = BASE_MODULE_ARGUMENTS + ["fprime_gds.executables.comm"] + arguments
148
- return launch_process(app_cmd, name=f'comm[{parsed_args.adapter}] Application', launch_time=1)
169
+ return launch_process(
170
+ app_cmd,
171
+ name=f"comm[{parsed_args.communication_selection}] Application",
172
+ launch_time=1,
173
+ )
174
+
175
+
176
+ def launch_plugin(plugin_class_instance):
177
+ """ Launch a plugin instance """
178
+ plugin_name = getattr(plugin_class_instance, "get_name", lambda: cls.__name__)()
179
+ return launch_process(
180
+ plugin_class_instance.get_process_invocation(),
181
+ name=f"{ plugin_name } Plugin App",
182
+ launch_time=1,
183
+ )
149
184
 
150
185
 
151
186
  def main():
@@ -155,20 +190,23 @@ def main():
155
190
  parsed_args = parse_args()
156
191
  launchers = []
157
192
 
158
- # Launch a gui, if specified
193
+ # Launch middleware layer if not using ZMQ
159
194
  if not parsed_args.zmq:
160
195
  launchers.append(launch_tts)
161
196
 
162
197
  # Check if we are running with communications
163
- if parsed_args.adapter != "none":
198
+ if parsed_args.communication_selection != "none":
164
199
  launchers.append(launch_comm)
165
200
 
166
201
  # Add app, if possible
167
202
  if parsed_args.app:
168
- if parsed_args.adapter == "ip":
203
+ if parsed_args.communication_selection == "ip":
169
204
  launchers.append(launch_app)
170
205
  else:
171
- print("[WARNING] App cannot be auto-launched without IP adapter", file=sys.stderr)
206
+ print(
207
+ "[WARNING] App cannot be auto-launched without IP adapter",
208
+ file=sys.stderr,
209
+ )
172
210
 
173
211
  # Launch the desired GUI package
174
212
  if parsed_args.gui == "html":
@@ -177,6 +215,9 @@ def main():
177
215
  # Launch launchers and wait for the last app to finish
178
216
  try:
179
217
  procs = [launcher(parsed_args) for launcher in launchers]
218
+ _ = [launch_plugin(cls) for cls in parsed_args.gds_app_enabled_instances]
219
+ _ = [instance.run() for instance in parsed_args.gds_function_enabled_instances]
220
+
180
221
  print("[INFO] F prime is now running. CTRL-C to shutdown all components.")
181
222
  procs[-1].wait()
182
223
  except KeyboardInterrupt:
@@ -3,6 +3,7 @@ fprime_gds.executables.utils:
3
3
 
4
4
  Utility functions to enable the executables package to function seamlessly.
5
5
  """
6
+
6
7
  import atexit
7
8
  import signal
8
9
  import subprocess
@@ -118,14 +119,15 @@ def run_wrapped_application(arguments, logfile=None, env=None, launch_time=None)
118
119
  if launch_time is not None:
119
120
  time.sleep(launch_time)
120
121
  child.poll()
121
- if child.returncode is not None:
122
+ if child.returncode is not None and child.returncode != 0:
122
123
  raise ProcessNotStableException(
123
124
  arguments[0], child.returncode, launch_time
124
125
  )
125
126
  return child
126
127
  except Exception as exc:
127
- msg = f"Failed to run application: {' '.join(arguments)}. Error: {exc}"
128
- raise AppWrapperException(msg)
128
+ argument_strings = [str(argument) for argument in arguments]
129
+ message = f"Failed to run application: {' '.join(argument_strings)}. Error: {exc}"
130
+ raise AppWrapperException(message)
129
131
 
130
132
 
131
133
  def find_settings(path: Path) -> Path:
@@ -147,7 +149,7 @@ def get_artifacts_root() -> Path:
147
149
  except FprimeLocationUnknownException:
148
150
  print(
149
151
  "[ERROR] Not in fprime project and no deployment path provided, unable to find dictionary and/or app",
150
- file=sys.stderr
152
+ file=sys.stderr,
151
153
  )
152
154
  sys.exit(-1)
153
155
  except FprimeSettingsException as e:
@@ -177,7 +179,7 @@ def find_app(root: Path) -> Path:
177
179
  if len(files) > 1:
178
180
  print(
179
181
  f"[ERROR] Multiple app candidates in binary location {bin_dir}. Specify app manually with --app.",
180
- file=sys.stderr
182
+ file=sys.stderr,
181
183
  )
182
184
  sys.exit(-1)
183
185
 
@@ -191,21 +193,31 @@ def find_dict(root: Path) -> Path:
191
193
  print(f"[ERROR] dictionary location {dict_dir} does not exist", file=sys.stderr)
192
194
  sys.exit(-1)
193
195
 
194
- files = [
196
+ xml_dicts = [
195
197
  child
196
198
  for child in dict_dir.iterdir()
197
199
  if child.is_file() and child.name.endswith("Dictionary.xml")
198
200
  ]
201
+ json_dicts = [
202
+ child
203
+ for child in dict_dir.iterdir()
204
+ if child.is_file() and child.name.endswith("Dictionary.json")
205
+ ]
206
+ # Select json dictionary if available, otherwise use xml dictionary
207
+ dicts = json_dicts if json_dicts else xml_dicts
199
208
 
200
- if not files:
201
- print(f"[ERROR] No xml dictionary found in dictionary location {dict_dir}", file=sys.stderr)
209
+ if not dicts:
210
+ print(
211
+ f"[ERROR] No dictionary found in dictionary location {dict_dir}",
212
+ file=sys.stderr,
213
+ )
202
214
  sys.exit(-1)
203
215
 
204
- if len(files) > 1:
216
+ if len(dicts) > 1:
205
217
  print(
206
- f"[ERROR] Multiple xml dictionaries found in dictionary location {dict_dir}. Specify dictionary manually with --dictionary.",
207
- file=sys.stderr
218
+ f"[ERROR] Multiple dictionaries of same type found in dictionary location {dict_dir}. Specify dictionary manually with --dictionary.",
219
+ file=sys.stderr,
208
220
  )
209
221
  sys.exit(-1)
210
222
 
211
- return files[0]
223
+ return dicts[0]
@@ -73,7 +73,7 @@ class SequenceCompiler(flask_restful.Resource):
73
73
  403,
74
74
  message=f"{key} is invalid command key. Supply 0xfeedcafe to run command.",
75
75
  )
76
- elif not re.match(".*\.seq", name) or Path(name).name != name:
76
+ elif not re.match(".*\\.seq", name) or Path(name).name != name:
77
77
  flask_restful.abort(
78
78
  403,
79
79
  message={"error": "Supply filename with .seq suffix", "type": "error"},
@@ -83,7 +83,8 @@ Vue.component("command-input", {
83
83
  this.$root.$refs.command_input = this;
84
84
  },
85
85
  data: function() {
86
- let selected = command_assignment_helper(null, [], "CMD_NO_OP");
86
+ // Select CMD_NO_OP by default if it exists, otherwise select the first command
87
+ let selected = command_assignment_helper("cmdDisp.CMD_NO_OP", [], "CMD_NO_OP");
87
88
  selected = (selected != null)? selected : Object.values(_datastore.commands)[0];
88
89
  return {
89
90
  "commands": _datastore.commands,
@@ -216,7 +217,7 @@ Vue.component("command-input", {
216
217
  * @return {number} -1 or 1
217
218
  */
218
219
  function(obj1, obj2) {
219
- if (obj1.full_name <= obj2.full_name) {
220
+ if (obj1.full_name.toLowerCase() <= obj2.full_name.toLowerCase()) {
220
221
  return -1;
221
222
  }
222
223
  return 1;
File without changes
@@ -0,0 +1,71 @@
1
+ """ fprime_gds.plugin.definitions: definitions of plugin specifications and decorators
2
+
3
+ In order to define a plugin, an implementation decorator is used. Users can import `gds_plugin_implementation` from this
4
+ file to decorate functions that implement plugins.
5
+
6
+ This file also defines helper classes to support the plugin system.
7
+
8
+ @author lestarch
9
+ """
10
+ import pluggy
11
+ from enum import Enum, auto
12
+ from typing import Any, Dict, Tuple, Type
13
+
14
+ PROJECT_NAME = "fprime_gds"
15
+
16
+ gds_plugin_specification = pluggy.HookspecMarker(PROJECT_NAME)
17
+ gds_plugin_implementation = pluggy.HookimplMarker(PROJECT_NAME)
18
+
19
+
20
+ class PluginType(Enum):
21
+ """ Enumeration of plugin types"""
22
+ ALL = auto()
23
+ """ Plugin selection including all types of plugins """
24
+
25
+ SELECTION = auto()
26
+ """ Plugin that provides a selection between implementations """
27
+
28
+ FEATURE = auto()
29
+ """ Plugin that provides a feature """
30
+
31
+
32
+ class Plugin(object):
33
+ """ Plugin wrapper object """
34
+
35
+ def __init__(self, category: str, plugin_type: PluginType, plugin_class: Type[Any]):
36
+ """ Initialize the plugin
37
+
38
+ Args:
39
+ category: category of the plugin (i.e. register_<category>_function)
40
+ plugin_type: type of plugin
41
+ plugin_class: implementation class of the plugin
42
+ """
43
+ self.category = category
44
+ self.type = plugin_type
45
+ self.plugin_class = plugin_class
46
+
47
+ def get_name(self):
48
+ """ Get the name of the plugin
49
+
50
+ Plugin names are derived from the `get_name` class method of the plugin's implementation class. When not defined
51
+ that name is derived from the plugin's implementation class __name__ property instead.
52
+
53
+ Returns:
54
+ name of plugin
55
+ """
56
+ return (
57
+ self.plugin_class.get_name() if hasattr(self.plugin_class, "get_name")
58
+ else self.plugin_class.__name__
59
+ )
60
+
61
+ def get_arguments(self) -> Dict[Tuple[str, ...], Dict[str, Any]]:
62
+ """ Get arguments needed by plugin
63
+
64
+ Plugin argument are derived from the `get_arguments` class method of the plugin's implementation class. When not
65
+ defined an empty dictionary is returned.
66
+
67
+ Returns:
68
+ argument specification for plugin
69
+ """
70
+ return self.plugin_class.get_arguments() if hasattr(self.plugin_class, "get_arguments") else {}
71
+
@@ -0,0 +1,225 @@
1
+ """ fprime_gds.plugin.system: implementation of plugins
2
+
3
+ This file contains the implementation and registration of plugins for fprime_gds. Primarily, it defines the Plugins
4
+ class that handles plugins. Users can acquire the Plugin singleton with `Plugin.system()`.
5
+
6
+ This file also imports and registers plugin implementations built-into fprime-gds. These plugins are not registered
7
+ using entrypoints.
8
+
9
+ @author lestarch
10
+ """
11
+ import os
12
+ import importlib
13
+ import inspect
14
+ import logging
15
+ from typing import Iterable, List, Union
16
+
17
+ import pluggy
18
+
19
+ from fprime_gds.plugin.definitions import Plugin, PluginType, PROJECT_NAME
20
+
21
+ # For automatic validation of plugins, each plugin class type must be imported here
22
+ from fprime_gds.executables.apps import GdsFunction, GdsApp
23
+ from fprime_gds.common.communication.framing import FramerDeframer, FpFramerDeframer
24
+ from fprime_gds.common.communication.adapters.base import BaseAdapter, NoneAdapter
25
+ from fprime_gds.common.communication.adapters.ip import IpAdapter
26
+
27
+ try:
28
+ from fprime_gds.common.communication.adapters.uart import SerialAdapter
29
+ except ImportError:
30
+ SerialAdapter = None
31
+
32
+ # Handy constants
33
+ LOGGER = logging.getLogger(__name__)
34
+
35
+
36
+ # Metadata regarding each plugin:
37
+ _PLUGIN_METADATA = {
38
+ "framing": {
39
+ "class": FramerDeframer,
40
+ "type": PluginType.SELECTION,
41
+ "built-in": [FpFramerDeframer]
42
+ },
43
+ "communication": {
44
+ "class": BaseAdapter,
45
+ "type": PluginType.SELECTION,
46
+ "built-in": [adapter for adapter in [NoneAdapter, IpAdapter, SerialAdapter] if adapter is not None]
47
+ },
48
+ "gds_function": {
49
+ "class": GdsFunction,
50
+ "type": PluginType.FEATURE,
51
+ "built-in": []
52
+ },
53
+ "gds_app": {
54
+ "class": GdsApp,
55
+ "type": PluginType.FEATURE,
56
+ "built-in": []
57
+ }
58
+ }
59
+
60
+
61
+ class PluginException(Exception):
62
+ pass
63
+
64
+
65
+ class InvalidCategoryException(PluginException):
66
+ pass
67
+
68
+
69
+ class Plugins(object):
70
+ """GDS plugin system providing a plugin Singleton for use across the GDS
71
+
72
+ GDS plugins are broken into categories (e.g. framing) that represent the key features users can adjust. Each GDS
73
+ application will support and load the plugins for a given category.
74
+ """
75
+ PLUGIN_ENVIRONMENT_VARIABLE = "FPRIME_GDS_EXTRA_PLUGINS"
76
+ _singleton = None
77
+
78
+ def __init__(self, categories: Union[None, List] = None):
79
+ """ Initialize the plugin system with specific categories
80
+
81
+ Initialize the plugin system with support for the supplied categories. Only plugins for the specified categories
82
+ will be loaded for use. Other plugins will not be available for use.
83
+
84
+ Args:
85
+ categories: None for all categories otherwise a list of categories
86
+ """
87
+ categories = self.get_all_categories() if categories is None else categories
88
+ self.categories = categories
89
+ self.manager = pluggy.PluginManager(PROJECT_NAME)
90
+
91
+ # Load hook specifications from only the configured categories
92
+ for category in categories:
93
+ self.manager.add_hookspecs(_PLUGIN_METADATA[category]["class"])
94
+
95
+ # Load plugins from setuptools entrypoints and the built-in plugins (limited to category)
96
+ self.manager.load_setuptools_entrypoints(PROJECT_NAME)
97
+
98
+ # Load plugins from environment variable specified modules
99
+ for token in [token for token in os.environ.get(self.PLUGIN_ENVIRONMENT_VARIABLE, "").split(";") if token]:
100
+ module, class_token = token.split(":")
101
+ try:
102
+ imported_module = importlib.import_module(module)
103
+ module_class = module if class_token == "" else getattr(imported_module, class_token, imported_module)
104
+ self.register_plugin(module_class)
105
+ except ImportError as imp:
106
+ LOGGER.debug("Failed to load %s.%s as plugin", module, class_token)
107
+
108
+ # Load built-in plugins
109
+ for category in categories:
110
+ for built_in in _PLUGIN_METADATA[category]["built-in"]:
111
+ self.register_plugin(built_in)
112
+
113
+ def get_plugins(self, category) -> Iterable:
114
+ """Get available plugins for the given category
115
+
116
+ Gets all plugin implementors of "category" by looking for register_<category>_plugin implementors. If such a
117
+ function does not exist then this results in an exception.
118
+
119
+ Args:
120
+ category: category of the plugin requested
121
+
122
+ Return:
123
+ validated list of plugin implementor classes
124
+ """
125
+ try:
126
+ plugin_classes = getattr(self.manager.hook, f"register_{category}_plugin")()
127
+ except KeyError as error:
128
+ raise InvalidCategoryException(f"Invalid plugin category: {error}")
129
+
130
+ return [
131
+ Plugin(category, self.get_category_plugin_type(category), plugin_class)
132
+ for plugin_class in plugin_classes
133
+ if self.validate_selection(category, plugin_class)
134
+ ]
135
+
136
+ def register_plugin(self, module_or_class):
137
+ """Register a plugin directly
138
+
139
+ Allows local registration of plugin implementations that are shipped as part of the GDS package.
140
+
141
+ Args:
142
+ module_or_class: module or class that has plugin implementations
143
+ """
144
+ self.manager.register(module_or_class)
145
+
146
+ def get_categories(self):
147
+ """ Get plugin categories """
148
+ return self.categories
149
+
150
+ @staticmethod
151
+ def get_all_categories():
152
+ """ Get all plugin categories """
153
+ return _PLUGIN_METADATA.keys()
154
+
155
+ @staticmethod
156
+ def get_plugin_metadata(category):
157
+ """ Get the plugin metadata for a given plugin category """
158
+ return _PLUGIN_METADATA[category]
159
+
160
+ @classmethod
161
+ def get_category_plugin_type(cls, category):
162
+ """ Get the plugin type given the category """
163
+ return cls.get_plugin_metadata(category)["type"]
164
+
165
+ @classmethod
166
+ def get_category_specification_class(cls, category):
167
+ """ Get the plugin class given the category """
168
+ return cls.get_plugin_metadata(category)["class"]
169
+
170
+ @classmethod
171
+ def validate_selection(cls, category, result):
172
+ """Validate the result of plugin hook
173
+
174
+ Validates the result of a plugin hook call to ensure the result meets the expected properties for plugins of the
175
+ given category. Primarily this ensures that this plugin returns a concrete subclass of the expected type.
176
+
177
+ Args:
178
+ category: category of plugin used
179
+ result: result from the plugin hook call
180
+ Return:
181
+ True when the plugin passes validation, False otherwise
182
+ """
183
+ # Typing library not intended for introspection at runtime, thus we maintain a map of plugin specification
184
+ # functions to the types expected as a return value. When this is not found, plugins may continue without
185
+ # automatic validation.
186
+ try:
187
+ expected_class = cls.get_category_specification_class(category)
188
+ # Validate the result
189
+ if not issubclass(result, expected_class):
190
+ LOGGER.warning(
191
+ f"{result.__name__} is not a subclass of {expected_class.__name__}. Not registering."
192
+ )
193
+ return False
194
+ elif inspect.isabstract(result):
195
+ LOGGER.warning(
196
+ f"{result.__name__} is an abstract class. Not registering."
197
+ )
198
+ return False
199
+ except KeyError:
200
+ LOGGER.warning(
201
+ f"Plugin not registered for validation. Continuing without validation."
202
+ )
203
+ return True
204
+
205
+ @classmethod
206
+ def system(cls, categories: Union[None, List] = None) -> "Plugins":
207
+ """ Get plugin system singleton
208
+
209
+ Constructs the plugin system singleton (when it has yet to be constructed) then returns the singleton. The
210
+ singleton will support specific categories and further requests for a singleton will cause an assertion error
211
+ unless the categories match or is None.
212
+
213
+ Args:
214
+ categories: a list of categories to support or None to use the existing categories
215
+
216
+ Returns:
217
+ plugin system
218
+ """
219
+ # Singleton undefined, construct it
220
+ if cls._singleton is None:
221
+ cls._singleton = cls(cls.get_all_categories() if categories is None else categories)
222
+ # Ensure categories was unspecified or matches the singleton
223
+ assert categories is None or cls._singleton.categories == categories, "Inconsistent plugin categories"
224
+ return cls._singleton
225
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fprime-gds
3
- Version: 3.4.3
3
+ Version: 3.4.4a2
4
4
  Summary: F Prime Flight Software Ground Data System layer
5
5
  Author-email: Michael Starch <Michael.D.Starch@jpl.nasa.gov>, Thomas Boyer-Chammard <Thomas.Boyer.Chammard@jpl.nasa.gov>
6
6
  License:
@@ -239,6 +239,7 @@ Requires-Dist: argcomplete >=1.12.3
239
239
  Requires-Dist: Jinja2 >=2.11.3
240
240
  Requires-Dist: openpyxl >=3.0.10
241
241
  Requires-Dist: pyserial >=3.5
242
+ Requires-Dist: pydantic >=2.6
242
243
 
243
244
  # F´ GDS
244
245
 
@@ -267,7 +268,7 @@ output data type included. Command data objects are created in the command panel
267
268
  the command encoder registered to that panel. Encoders take a data object and turn it into binary
268
269
  data that can be sent to the F´ deployment. The binary data is then passed to the TCP client
269
270
  which is registered to the encoder. Finally, the TCP client send the data back to the TCP server and
270
- the F´ deployment. ![The layout of the GDS](https://github.com/nasa/fprime/blob/master/docs/UsersGuide/media/gds_layout.jpg)
271
+ the F´ deployment. ![The layout of the GDS](https://github.com/nasa/fprime/blob/devel/docs/UsersGuide/media/gds_layout.jpg)
271
272
 
272
273
  All of these objects are created and registered to other objects when the GDS
273
274
  is initialized. Thus, all of the structure of the GDS is created in one place,