opensignalbox-simulator 0.1.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.
@@ -0,0 +1,2 @@
1
+ def hello() -> str:
2
+ return "Hello from osb-simulator!"
@@ -0,0 +1,82 @@
1
+ from anyio import run
2
+ from opensignalbox.common.modules import (
3
+ BaseModule,
4
+ ModuleInfo,
5
+ UIEntry,
6
+ module_argparser,
7
+ )
8
+
9
+ from .routes import simulator_router
10
+ from .version import __version__
11
+
12
+
13
+ class Module(BaseModule):
14
+ module_name = "opensignalbox-simulator"
15
+ module_file = __file__
16
+
17
+ def __init__(
18
+ self,
19
+ module_info: ModuleInfo,
20
+ ui_entries: list[UIEntry] | None = None,
21
+ ) -> None:
22
+ if ui_entries is None:
23
+ ui_entries = []
24
+ super().__init__(
25
+ module_info=module_info,
26
+ ui_entries=ui_entries,
27
+ )
28
+ self.fastapi_app.include_router(simulator_router, prefix="/api")
29
+
30
+ def setup(self) -> None:
31
+ """
32
+ Module startup code goes here after the super call.
33
+ """
34
+ super().setup()
35
+
36
+ def systick_update(self, tick_json: str) -> None:
37
+ """
38
+ Module update logic goes here, executed once per clock tick.
39
+ """
40
+ # await macro_loop()
41
+ super().systick_update(tick_json)
42
+
43
+ async def user_task(self) -> None:
44
+ pass
45
+
46
+ def teardown(self) -> None:
47
+ """
48
+ Module teardown code goes here.
49
+ """
50
+ pass
51
+
52
+ def load_state(self) -> None:
53
+ return super().load_state()
54
+
55
+ def save_state(self) -> None:
56
+ return super().save_state()
57
+
58
+
59
+ args = module_argparser()
60
+ instance_name: str = args.name
61
+ module_info = ModuleInfo(
62
+ instance_name=args.name,
63
+ module_name=Module.module_name,
64
+ version=__version__,
65
+ address=args.address,
66
+ port=args.port,
67
+ session_id=args.session_id,
68
+ framework_address=args.framework,
69
+ config_path=args.configdir,
70
+ )
71
+ module = Module(
72
+ module_info=module_info
73
+ )
74
+ module.setup()
75
+
76
+
77
+ def entry_point():
78
+ run(module.run, backend="trio")
79
+
80
+
81
+ if __name__ == "__main__":
82
+ entry_point()
@@ -0,0 +1,3 @@
1
+ from fastapi.routing import APIRouter
2
+
3
+ simulator_router = APIRouter()
File without changes
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0"
@@ -0,0 +1,26 @@
1
+ Metadata-Version: 2.4
2
+ Name: opensignalbox-simulator
3
+ Version: 0.1.0
4
+ Summary: The official simulator module for the opensignalbox simulation framework.
5
+ Project-URL: Homepage, https://opensignalbox.org/
6
+ Project-URL: Repository, https://github.com/opensignalbox/opensignalbox
7
+ Author-email: The openSignalBox project <info@opensignalbox.org>
8
+ Maintainer-email: Laurence Stant <laurence@stant.phd>
9
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.8
13
+ Requires-Dist: anyio>=4.3.0
14
+ Requires-Dist: email-validator>=2.1.1
15
+ Requires-Dist: fastapi>=0.108.0
16
+ Requires-Dist: hypercorn>=0.16.0
17
+ Requires-Dist: jinja2>=3.1.3
18
+ Requires-Dist: opensignalbox-common>=0.1.0
19
+ Requires-Dist: pydantic-settings>=2.1.0
20
+ Requires-Dist: pyyaml>=6.0.1
21
+ Requires-Dist: requests>=2.31.0
22
+ Requires-Dist: trio>=0.23.2
23
+ Requires-Dist: zmq>=0.0.0
24
+ Description-Content-Type: text/markdown
25
+
26
+ openSignalBox package code repo.
@@ -0,0 +1,9 @@
1
+ opensignalbox/simulator/__init__.py,sha256=vfoUsvwLpVU8sscSl4Wr_Yu011qkZEOA26zTwg30z60,59
2
+ opensignalbox/simulator/main.py,sha256=dQzXjhvQiOdwL-ZxHqzYf0RXOnSY_HlilwQB0V-KytI,1909
3
+ opensignalbox/simulator/routes.py,sha256=TZaTDQSFFoo-0EPOfzariNOtiuQRBGW62oxWnnxoNwk,70
4
+ opensignalbox/simulator/simulator.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ opensignalbox/simulator/version.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
6
+ opensignalbox_simulator-0.1.0.dist-info/METADATA,sha256=N-xEClXCApLUulS-M4Ih6qKvOrrieF3HAhd9QlnRJHo,1035
7
+ opensignalbox_simulator-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
8
+ opensignalbox_simulator-0.1.0.dist-info/entry_points.txt,sha256=kVGNvnp0OQWQEykBYH1Lcy-Quy9bdRJxmqc0Dup3hn8,85
9
+ opensignalbox_simulator-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ opensignalbox-simulator = opensignalbox.simulator.main:entry_point