franzmq 0.4.0b3__tar.gz

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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Alpamayo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: franzmq
3
+ Version: 0.4.0b3
4
+ Summary: Typed MQTT client and topic/payload model for ISA-95-ish messaging.
5
+ Author-email: Alpamayo <info@alpamayo-solutions.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2025 Alpamayo
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/alpamayo-solutions/franzmq
29
+ Project-URL: Issues, https://github.com/alpamayo-solutions/franzmq/issues
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: Programming Language :: Python :: 3.10
32
+ Classifier: Topic :: Internet
33
+ Classifier: Topic :: System :: Networking
34
+ Requires-Python: >=3.10
35
+ Description-Content-Type: text/markdown
36
+ License-File: LICENSE
37
+ Requires-Dist: paho-mqtt>=2.0
38
+ Requires-Dist: python-decouple>=3.8
39
+ Provides-Extra: dev
40
+ Requires-Dist: build>=1.2.1; extra == "dev"
41
+ Requires-Dist: twine>=5.0.0; extra == "dev"
42
+ Requires-Dist: pytest>=8.0; extra == "dev"
43
+ Requires-Dist: ruff>=0.5.0; extra == "dev"
44
+ Requires-Dist: black>=24.0; extra == "dev"
45
+ Requires-Dist: mypy>=1.10; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ # FranzMQ
49
+
50
+ **FranzMQ** is a flexible, structured MQTT communication library designed to streamline MQTT messaging for internal and external communication in edge and cloud applications. It builds on top of the `paho-mqtt` client and introduces a typed, hierarchical topic and payload system based on the ISA-95 model.
51
+
52
+ ## Features
53
+
54
+ - ๐Ÿง  **Typed Payloads** using Python dataclasses
55
+ - ๐Ÿงต **Priority-based concurrent callbacks** for message handling
56
+ - ๐Ÿ“ฆ **ISA-95 topic modeling** for enterprise-ready messaging structures
57
+ - ๐Ÿ”’ **TLS support** with environment-based auto-configuration
58
+ - ๐Ÿงช **Validation-ready** versioning and context-driven payload classes
59
+ - ๐Ÿ“Š **MQTT-based logging** with seamless integration
60
+
61
+ ## Installation
62
+
63
+ Install using pip:
64
+
65
+ ```bash
66
+ pip install franzmq
67
+ ```
68
+
69
+ ## Quick Start
70
+
71
+ ```python
72
+ from franzmq.client import Client
73
+ from franzmq.payload import Metric
74
+ from franzmq.topic import Topic
75
+
76
+ client = Client.autocreate_and_connect(client_id="my-client")
77
+
78
+ topic = Topic(payload_type=Metric, context=("sensor", "temperature"))
79
+ metric = Metric(value=22.5)
80
+
81
+ client.publish(topic, metric)
82
+ ```
83
+
84
+ ## Typed Payloads
85
+
86
+ All messages use structured dataclasses (e.g., `Metric`, `Log`, `ServiceDetails`, etc.) that encode/decode automatically to/from JSON.
87
+
88
+ ## Logging over MQTT
89
+
90
+ Enable logging by calling:
91
+
92
+ ```python
93
+ client.configure_mqtt_logger(level=logging.INFO)
94
+ ```
95
+
96
+ ## Auto Configuration via Environment Variables
97
+
98
+ Uses [`python-decouple`](https://github.com/henriquebastos/python-decouple) for environment configuration.
99
+
100
+ ### Required Variables
101
+
102
+ - `MQTT_IP`
103
+ - `MQTT_USERNAME`
104
+ - `MQTT_PASSWORD`
105
+ - `MQTT_PORT` (optional)
106
+ - `USE_MQTTS`
107
+ - `CA_CERT_FILE` (optional)
108
+ - `TLS_CERT_FILE` (optional)
109
+ - `TLS_KEY_FILE` (optional)
110
+
111
+ ## Callback System
112
+
113
+ Subscribe to topics and register priority-based callbacks:
114
+
115
+ ```python
116
+ client.subscribe(topic, qos=1, callback=my_callback, priority=10)
117
+ ```
118
+
119
+ Callbacks with the same priority are executed concurrently; higher-priority callbacks run first.
120
+
121
+ ## Payload Types
122
+
123
+ Includes predefined payloads such as:
124
+
125
+ - `Metric`
126
+ - `Log`
127
+ - And many more are easily self-definable...
128
+
129
+ ## Testing ISA-95 Topics
130
+
131
+ ```python
132
+ from franzmq.topic import Isa95Topic, Topic, Isa95Fields
133
+
134
+ basic_topic = Topic(payload_type=Metric, context=("sensor", "temperature"))
135
+ isa95_fields = Isa95Fields(enterprise="ent1", site="s1", area="a1", production_line="pl1", work_cell="wc1", origin_id="origin1")
136
+ isa95_topic = Isa95Topic.from_topic(basic_topic, isa95_fields)
137
+ ```
138
+
139
+ ## License
140
+
141
+ MIT License
@@ -0,0 +1,94 @@
1
+ # FranzMQ
2
+
3
+ **FranzMQ** is a flexible, structured MQTT communication library designed to streamline MQTT messaging for internal and external communication in edge and cloud applications. It builds on top of the `paho-mqtt` client and introduces a typed, hierarchical topic and payload system based on the ISA-95 model.
4
+
5
+ ## Features
6
+
7
+ - ๐Ÿง  **Typed Payloads** using Python dataclasses
8
+ - ๐Ÿงต **Priority-based concurrent callbacks** for message handling
9
+ - ๐Ÿ“ฆ **ISA-95 topic modeling** for enterprise-ready messaging structures
10
+ - ๐Ÿ”’ **TLS support** with environment-based auto-configuration
11
+ - ๐Ÿงช **Validation-ready** versioning and context-driven payload classes
12
+ - ๐Ÿ“Š **MQTT-based logging** with seamless integration
13
+
14
+ ## Installation
15
+
16
+ Install using pip:
17
+
18
+ ```bash
19
+ pip install franzmq
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ```python
25
+ from franzmq.client import Client
26
+ from franzmq.payload import Metric
27
+ from franzmq.topic import Topic
28
+
29
+ client = Client.autocreate_and_connect(client_id="my-client")
30
+
31
+ topic = Topic(payload_type=Metric, context=("sensor", "temperature"))
32
+ metric = Metric(value=22.5)
33
+
34
+ client.publish(topic, metric)
35
+ ```
36
+
37
+ ## Typed Payloads
38
+
39
+ All messages use structured dataclasses (e.g., `Metric`, `Log`, `ServiceDetails`, etc.) that encode/decode automatically to/from JSON.
40
+
41
+ ## Logging over MQTT
42
+
43
+ Enable logging by calling:
44
+
45
+ ```python
46
+ client.configure_mqtt_logger(level=logging.INFO)
47
+ ```
48
+
49
+ ## Auto Configuration via Environment Variables
50
+
51
+ Uses [`python-decouple`](https://github.com/henriquebastos/python-decouple) for environment configuration.
52
+
53
+ ### Required Variables
54
+
55
+ - `MQTT_IP`
56
+ - `MQTT_USERNAME`
57
+ - `MQTT_PASSWORD`
58
+ - `MQTT_PORT` (optional)
59
+ - `USE_MQTTS`
60
+ - `CA_CERT_FILE` (optional)
61
+ - `TLS_CERT_FILE` (optional)
62
+ - `TLS_KEY_FILE` (optional)
63
+
64
+ ## Callback System
65
+
66
+ Subscribe to topics and register priority-based callbacks:
67
+
68
+ ```python
69
+ client.subscribe(topic, qos=1, callback=my_callback, priority=10)
70
+ ```
71
+
72
+ Callbacks with the same priority are executed concurrently; higher-priority callbacks run first.
73
+
74
+ ## Payload Types
75
+
76
+ Includes predefined payloads such as:
77
+
78
+ - `Metric`
79
+ - `Log`
80
+ - And many more are easily self-definable...
81
+
82
+ ## Testing ISA-95 Topics
83
+
84
+ ```python
85
+ from franzmq.topic import Isa95Topic, Topic, Isa95Fields
86
+
87
+ basic_topic = Topic(payload_type=Metric, context=("sensor", "temperature"))
88
+ isa95_fields = Isa95Fields(enterprise="ent1", site="s1", area="a1", production_line="pl1", work_cell="wc1", origin_id="origin1")
89
+ isa95_topic = Isa95Topic.from_topic(basic_topic, isa95_fields)
90
+ ```
91
+
92
+ ## License
93
+
94
+ MIT License
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "franzmq"
7
+ version = "0.4.0b3"
8
+ description = "Typed MQTT client and topic/payload model for ISA-95-ish messaging."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "Alpamayo", email = "info@alpamayo-solutions.com" }]
13
+ dependencies = [
14
+ "paho-mqtt>=2.0",
15
+ "python-decouple>=3.8",
16
+ ]
17
+
18
+ # These show up on PyPI
19
+ classifiers = [
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Topic :: Internet",
23
+ "Topic :: System :: Networking",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://github.com/alpamayo-solutions/franzmq"
28
+ Issues = "https://github.com/alpamayo-solutions/franzmq/issues"
29
+
30
+ [tool.setuptools]
31
+ package-dir = {"" = "src"}
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
35
+ namespaces = true
36
+
37
+ [project.optional-dependencies]
38
+ dev = [
39
+ "build>=1.2.1",
40
+ "twine>=5.0.0",
41
+ "pytest>=8.0",
42
+ "ruff>=0.5.0",
43
+ "black>=24.0",
44
+ "mypy>=1.10",
45
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ from .client import Client
2
+ from .topic import Topic, Isa95Fields, Isa95Topic
3
+ from .topic_base import TopicBase, classproperty
4
+ from .message import Message
5
+ from .data_contracts.base import Payload, Metric, Log, Cmd, Ack
6
+ from .log_handlers import configure_logging
7
+
8
+ __all__ = [
9
+ "Payload", "Message", "Topic", "Client",
10
+ "Isa95Fields", "Isa95Topic",
11
+ "Metric", "Log", "Cmd", "Ack",
12
+ "TopicBase", "classproperty",
13
+ "configure_logging",
14
+ ]