stinger-ipc 0.0.1__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,170 @@
1
+ Metadata-Version: 2.4
2
+ Name: stinger-ipc
3
+ Version: 0.0.1
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.12
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: jacobs-jinja-too>=0.0.8
9
+ Requires-Dist: packaging>=25.0
10
+ Requires-Dist: pydantic>=2.11.7
11
+ Requires-Dist: pyyaml>=6.0.2
12
+ Requires-Dist: ruamel-yaml>=0.18.14
13
+ Requires-Dist: stringcase>=1.2.0
14
+ Requires-Dist: yamlloader>=1.5.1
15
+ Dynamic: license-file
16
+
17
+ # Stinger IPC
18
+
19
+ StingerIPC provides inter-process communications (IPC) between a server and multiple clients running on the same or separate hosts. It uses an MQTT server to pass messages between processes, implementing several IPC patterns: signals, properties, and proceedures.
20
+
21
+ ## Project Status
22
+
23
+ This project is in early stages of active development. You should not use it in any of your projects, both because it doesn't have enough features yet to be useful, and also because things will probably be horribly broken on future updates.
24
+
25
+ ## Interface Description
26
+
27
+ StingerIPC takes a interface description file (.singeripc), and will generate code and documentation from it. A very brief example of a interface description is:
28
+
29
+ ```yaml
30
+ stingeripc:
31
+ version: 0.0.6
32
+
33
+ interface:
34
+ name: Example
35
+ version: 0.0.1
36
+
37
+ signals:
38
+
39
+ foo:
40
+ payload:
41
+ - name: message
42
+ type: string
43
+
44
+ methods:
45
+
46
+ addNumbers:
47
+ arguments:
48
+ - name: left
49
+ type: integer
50
+ - name: right
51
+ type: integer
52
+ returnValues:
53
+ - name: sum
54
+ type: integer
55
+
56
+ ```
57
+ ## First class code generation
58
+
59
+ From the StingerIPC description file, we directly generate server and client code for these languages: Python3, C++11, and Rust.
60
+
61
+ ### Server Code
62
+
63
+ From the above description file, StingerIPC generates server code, which can be used like this:
64
+
65
+ ```py
66
+ # Python
67
+ conn = MqttConnection('localhost', 1883)
68
+ server = ExampleServer(conn)
69
+
70
+ server.emit_foo("Hello World")
71
+
72
+ @server.handle_add_numbers
73
+ def add_numbers(left: int, right: int) -> int:
74
+ return left + right
75
+ ```
76
+
77
+ ```c++
78
+ // C++
79
+ auto conn = std::make_shared<DefaultConnection>("localhost", 1883);
80
+ ExampleServer server(conn);
81
+ server.emitFoo("Hello World").wait();
82
+
83
+ server.registerAddNumbersHandler([](int left, int right) -> int
84
+ {
85
+ return left + right;
86
+ });
87
+ ```
88
+
89
+ ```rust
90
+ // Rust
91
+ let connection = Connection::new(String::from("tcp://localhost:1883"));
92
+ let mut server = SignalOnlyServer::new(connection);
93
+ server.emit_foo("Hello World".to_string());
94
+
95
+ server.register_add_numbers_handler(|left, right| {
96
+ left + right
97
+ });
98
+ ```
99
+
100
+ ### Client Code
101
+
102
+ From the above description file, StingerIPC generates client code which can be used like this:
103
+
104
+ ```py
105
+ # Python
106
+ conn = MqttConnection('localhost', 1883)
107
+ client = ExampleClient(conn)
108
+
109
+ @client.receive_foo
110
+ def print_foo_receipt(message):
111
+ print(f"Got a 'foo' signal with message: {message}")
112
+
113
+ future = client.add_numbers(1, 2)
114
+ timeout = 5
115
+ print(future.result(timeout))
116
+ ```
117
+
118
+ ```c++
119
+ // C++
120
+ auto conn = std::make_shared<DefaultConnection>("localhost", 1883);
121
+ ExampleClient client(conn);
122
+ client.registerFooCallback([](const std::string& message) {
123
+ std::cout << message << std::endl;
124
+ });
125
+
126
+ std::cout << "One plus three is " << client.addNumbers(1, 3).wait() << std::endl;
127
+ ```
128
+
129
+ ```rust
130
+ // Rust
131
+ let connection = Connection::new(String::from("tcp://localhost:1883"));
132
+ let mut client = ExampleClient::new(connection);
133
+ client.set_signal_recv_callbacks_for_foo(|message| {
134
+ println!("{}", message);
135
+ });
136
+
137
+ client.add_numbers(1, 4);
138
+ ```
139
+
140
+ ## AsyncAPI and second-class code generation
141
+
142
+ [AsyncAPI](https://www.asyncapi.com/) is a specification format for describing asynchronous message APIs. Since StingerIPC uses and abstracts asynchonous messages between server and clients, we can describe a StingerIPC system with an AsyncAPI document.
143
+
144
+ From that AsyncAPI document, we can [generate code and documentation](https://www.asyncapi.com/tools/generator) in additional languages. While this code generation won't implement our standard IPC design patterns, it does make accessing the communications more easy.
145
+
146
+ ## Inter-process communication (IPC)
147
+
148
+ The motivation for this project is that I've seen embedded Linux projects that run several daemons that need to talk to each other, and for whatever reasons D-Bus wasn't a good option.
149
+
150
+ So this project is a way for those daemons/programs to communicate with each other through an MQTT broker running on the same device. The design goals of this project have been tuned toward this use case.
151
+
152
+ That being said, there is nothing prohibiting Stinger-IPC to be used for RPC: remote proceedure calls. RPC typically involves being able to call into a system from a different system. That certainly can be done by having the remote systems connect into the same MQTT broker as the local system. However, this isn't the primary use case, and design goals aren't geared to make Stinger-IPC the best solution for RPC (though don't let that stop you from using it that way). Specifically, Stinger-IPC requires the server and all clients to be running the same version of code. For systems where all the software ships together, this usually isn't a problem, but could be a problem for systems with remote connections.
153
+
154
+ ### Comparison to gRPC
155
+
156
+ gRPC is probably a better solution for handling RPC and connections from remote clients. It does a much better job at handling compatibility between different versions, supporting a wider number of languages, and transports messages more efficiently.
157
+
158
+ But gRPC, as most typically deployed, provide some challenges for use inside an embedded Linux system. gRPC typically wants secured HTTP/2 connections, which are just overkill for communications within a single device. Additionally, the protobuf code generation is just more complicated.
159
+
160
+
161
+ ## Design goals
162
+
163
+ * Low learning curve.
164
+ * No fancy/tricky code. Generated code should look like a a human wrote it for humans to use it.
165
+ * Useable for embedded Linux systems.
166
+ * Be described by an AsyncAPI spec.
167
+
168
+ ## License
169
+
170
+ LGPLv2
@@ -0,0 +1,13 @@
1
+ stinger_ipc-0.0.1.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
2
+ stingeripc/__init__.py,sha256=PTr5WfMfB-GL4vp3-XMU8IwGv3Q5RXQ24H7JuEo3hdk,133
3
+ stingeripc/args.py,sha256=gpGJjtxz3a6TUCkH2mldllWgO1-PJBrmg8TlJT8bacM,3952
4
+ stingeripc/asyncapi.py,sha256=ebXTlodDBKD0jrUd5b8A0ob7kK3hI98KO6fPDbbFcU8,19229
5
+ stingeripc/components.py,sha256=ubiZyUySB3MDd122haXIa5diMh-pEKECA6az8ju1y_o,34143
6
+ stingeripc/connection.py,sha256=B6_Iij1Tue-dv_uDaQKtFVT4yLMUs1PGOj7_ioHwbkI,180
7
+ stingeripc/exceptions.py,sha256=ucD3HsV10bIFSm2p5vlx__bYDk9eNBhokw5fcv8tsu4,51
8
+ stingeripc/interface.py,sha256=Q3WtE2hNSQaPt5WEpn51cNDffjMFD6j2_0x2MbLXVS0,1522
9
+ stingeripc/topic.py,sha256=p6xMm1LL-9Cf86Sdf1jDhMf-5gN2HyKMHPcsrosQ-_M,2209
10
+ stinger_ipc-0.0.1.dist-info/METADATA,sha256=MIqGf_1TrzxD88VcNU7_mlxvhT2D8QrYam7GcwU9zZ8,5993
11
+ stinger_ipc-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ stinger_ipc-0.0.1.dist-info/top_level.txt,sha256=mSNwAf83_1qiTP_vu7XEPBrZu-fDusT1FFyQZzCrRcU,11
13
+ stinger_ipc-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+