iotpack 0.1.0__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.
iotpack-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Konrad Zuse
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.
iotpack-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: iotpack
3
+ Version: 0.1.0
4
+ Summary: A simple Python generator for MQTT and CoAP IoT projects
5
+ Author: Konrad Zuse
6
+ License-Expression: MIT
7
+ Keywords: iot,mqtt,coap,supabase,streamlit
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # iotpack
16
+
17
+ A simple Python package that generates complete IoT projects using MQTT and CoAP.
18
+
19
+ ## Installation
20
+
21
+ ```
22
+ pip install iotpack
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ import iotpack
29
+
30
+ iotpack.mqtt()
31
+ iotpack.coap()
32
+ ```
33
+
34
+ ## Generated Files
35
+
36
+ Each protocol creates a folder (`mqtt/` or `coap/`) with four files:
37
+
38
+ - client.py
39
+ - server.py
40
+ - dashboard.py
41
+ - requirements.txt
42
+
43
+ ## Quick start
44
+
45
+ ```
46
+ cd mqtt
47
+ pip install -r requirements.txt
48
+ set SUPABASE_URL=your-url (Windows) | export SUPABASE_URL=your-url (Mac/Linux)
49
+ set SUPABASE_KEY=your-key (Windows) | export SUPABASE_KEY=your-key (Mac/Linux)
50
+ python server.py
51
+ python client.py
52
+ streamlit run dashboard.py
53
+ ```
54
+
55
+ ## Supabase table
56
+
57
+ Run this once in the Supabase SQL editor:
58
+
59
+ ```sql
60
+ create table sensor_data (
61
+ id bigint generated always as identity primary key,
62
+ device_id text,
63
+ temperature float,
64
+ humidity float,
65
+ created_at timestamptz default now()
66
+ );
67
+ ```
68
+
69
+ ## Features
70
+
71
+ - MQTT client and server
72
+ - CoAP client and server
73
+ - Supabase database integration
74
+ - Streamlit dashboard
75
+ - Automatic requirements generation
76
+
77
+ ## License
78
+
79
+ MIT
@@ -0,0 +1,65 @@
1
+ # iotpack
2
+
3
+ A simple Python package that generates complete IoT projects using MQTT and CoAP.
4
+
5
+ ## Installation
6
+
7
+ ```
8
+ pip install iotpack
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```python
14
+ import iotpack
15
+
16
+ iotpack.mqtt()
17
+ iotpack.coap()
18
+ ```
19
+
20
+ ## Generated Files
21
+
22
+ Each protocol creates a folder (`mqtt/` or `coap/`) with four files:
23
+
24
+ - client.py
25
+ - server.py
26
+ - dashboard.py
27
+ - requirements.txt
28
+
29
+ ## Quick start
30
+
31
+ ```
32
+ cd mqtt
33
+ pip install -r requirements.txt
34
+ set SUPABASE_URL=your-url (Windows) | export SUPABASE_URL=your-url (Mac/Linux)
35
+ set SUPABASE_KEY=your-key (Windows) | export SUPABASE_KEY=your-key (Mac/Linux)
36
+ python server.py
37
+ python client.py
38
+ streamlit run dashboard.py
39
+ ```
40
+
41
+ ## Supabase table
42
+
43
+ Run this once in the Supabase SQL editor:
44
+
45
+ ```sql
46
+ create table sensor_data (
47
+ id bigint generated always as identity primary key,
48
+ device_id text,
49
+ temperature float,
50
+ humidity float,
51
+ created_at timestamptz default now()
52
+ );
53
+ ```
54
+
55
+ ## Features
56
+
57
+ - MQTT client and server
58
+ - CoAP client and server
59
+ - Supabase database integration
60
+ - Streamlit dashboard
61
+ - Automatic requirements generation
62
+
63
+ ## License
64
+
65
+ MIT
@@ -0,0 +1,4 @@
1
+ from .generator import mqtt, coap
2
+
3
+ __version__ = "0.1.0"
4
+ __all__ = ["mqtt", "coap"]
@@ -0,0 +1,188 @@
1
+ import os
2
+
3
+ MQTT_CLIENT = '''import json
4
+ import random
5
+ import time
6
+ import paho.mqtt.client as mqtt
7
+
8
+ BROKER = "broker.hivemq.com"
9
+ PORT = 1883
10
+ TOPIC = "iotpack/sensor"
11
+
12
+ client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
13
+ client.connect(BROKER, PORT)
14
+ client.loop_start()
15
+
16
+ while True:
17
+ payload = {
18
+ "device_id": "device-1",
19
+ "temperature": round(random.uniform(20, 35), 2),
20
+ "humidity": round(random.uniform(40, 80), 2),
21
+ }
22
+ client.publish(TOPIC, json.dumps(payload))
23
+ print("Published", payload)
24
+ time.sleep(2)
25
+ '''
26
+
27
+ MQTT_SERVER = '''import json
28
+ import os
29
+ import paho.mqtt.client as mqtt
30
+ from supabase import create_client
31
+
32
+ SUPABASE_URL = os.getenv("SUPABASE_URL", "your-supabase-url")
33
+ SUPABASE_KEY = os.getenv("SUPABASE_KEY", "your-supabase-key")
34
+ BROKER = "broker.hivemq.com"
35
+ PORT = 1883
36
+ TOPIC = "iotpack/sensor"
37
+
38
+ supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
39
+
40
+
41
+ def on_connect(client, userdata, flags, reason_code, properties):
42
+ print("Connected", reason_code)
43
+ client.subscribe(TOPIC)
44
+
45
+
46
+ def on_message(client, userdata, msg):
47
+ data = json.loads(msg.payload.decode())
48
+ supabase.table("sensor_data").insert(data).execute()
49
+ print("Stored", data)
50
+
51
+
52
+ client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
53
+ client.on_connect = on_connect
54
+ client.on_message = on_message
55
+ client.connect(BROKER, PORT)
56
+ client.loop_forever()
57
+ '''
58
+
59
+ COAP_CLIENT = '''import asyncio
60
+ import json
61
+ import random
62
+ import aiocoap
63
+
64
+ URI = "coap://localhost/sensor"
65
+
66
+
67
+ async def main():
68
+ context = await aiocoap.Context.create_client_context()
69
+ while True:
70
+ payload = {
71
+ "device_id": "device-1",
72
+ "temperature": round(random.uniform(20, 35), 2),
73
+ "humidity": round(random.uniform(40, 80), 2),
74
+ }
75
+ request = aiocoap.Message(
76
+ code=aiocoap.POST, uri=URI, payload=json.dumps(payload).encode()
77
+ )
78
+ response = await context.request(request).response
79
+ print("Sent", payload, "Response", response.code)
80
+ await asyncio.sleep(2)
81
+
82
+
83
+ asyncio.run(main())
84
+ '''
85
+
86
+ COAP_SERVER = '''import asyncio
87
+ import json
88
+ import os
89
+ import aiocoap
90
+ import aiocoap.resource as resource
91
+ from supabase import create_client
92
+
93
+ SUPABASE_URL = os.getenv("SUPABASE_URL", "your-supabase-url")
94
+ SUPABASE_KEY = os.getenv("SUPABASE_KEY", "your-supabase-key")
95
+
96
+ supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
97
+
98
+
99
+ class SensorResource(resource.Resource):
100
+ async def render_post(self, request):
101
+ data = json.loads(request.payload.decode())
102
+ supabase.table("sensor_data").insert(data).execute()
103
+ print("Stored", data)
104
+ return aiocoap.Message(code=aiocoap.CHANGED, payload=b"stored")
105
+
106
+
107
+ async def main():
108
+ root = resource.Site()
109
+ root.add_resource(["sensor"], SensorResource())
110
+ await aiocoap.Context.create_server_context(root, bind=("127.0.0.1", 5683))
111
+ print("CoAP server running on port 5683")
112
+ await asyncio.get_running_loop().create_future()
113
+
114
+
115
+ asyncio.run(main())
116
+ '''
117
+
118
+ DASHBOARD = '''import os
119
+ import time
120
+ import pandas as pd
121
+ import streamlit as st
122
+ from supabase import create_client
123
+
124
+ SUPABASE_URL = os.getenv("SUPABASE_URL", "your-supabase-url")
125
+ SUPABASE_KEY = os.getenv("SUPABASE_KEY", "your-supabase-key")
126
+
127
+ supabase = create_client(SUPABASE_URL, SUPABASE_KEY)
128
+
129
+ st.set_page_config(page_title="IoT Dashboard", layout="wide")
130
+ st.title("IoT Sensor Dashboard")
131
+
132
+ rows = (
133
+ supabase.table("sensor_data")
134
+ .select("*")
135
+ .order("id", desc=True)
136
+ .limit(100)
137
+ .execute()
138
+ .data
139
+ )
140
+
141
+ if rows:
142
+ df = pd.DataFrame(rows).sort_values("id")
143
+ col1, col2 = st.columns(2)
144
+ col1.metric("Latest temperature", df["temperature"].iloc[-1])
145
+ col2.metric("Latest humidity", df["humidity"].iloc[-1])
146
+ st.line_chart(df.set_index("id")[["temperature", "humidity"]])
147
+ st.dataframe(df.sort_values("id", ascending=False), use_container_width=True)
148
+ else:
149
+ st.info("No data yet")
150
+
151
+ time.sleep(3)
152
+ st.rerun()
153
+ '''
154
+
155
+ MQTT_REQUIREMENTS = "paho-mqtt>=2.0\nsupabase\nstreamlit\npandas\n"
156
+ COAP_REQUIREMENTS = "aiocoap\nsupabase\nstreamlit\npandas\n"
157
+
158
+
159
+ def generate(folder, files):
160
+ os.makedirs(folder, exist_ok=True)
161
+ for name, content in files.items():
162
+ with open(os.path.join(folder, name), "w", encoding="utf-8") as f:
163
+ f.write(content)
164
+ print(f"{folder} files created successfully!")
165
+
166
+
167
+ def mqtt():
168
+ generate(
169
+ "mqtt",
170
+ {
171
+ "client.py": MQTT_CLIENT,
172
+ "server.py": MQTT_SERVER,
173
+ "dashboard.py": DASHBOARD,
174
+ "requirements.txt": MQTT_REQUIREMENTS,
175
+ },
176
+ )
177
+
178
+
179
+ def coap():
180
+ generate(
181
+ "coap",
182
+ {
183
+ "client.py": COAP_CLIENT,
184
+ "server.py": COAP_SERVER,
185
+ "dashboard.py": DASHBOARD,
186
+ "requirements.txt": COAP_REQUIREMENTS,
187
+ },
188
+ )
@@ -0,0 +1,79 @@
1
+ Metadata-Version: 2.4
2
+ Name: iotpack
3
+ Version: 0.1.0
4
+ Summary: A simple Python generator for MQTT and CoAP IoT projects
5
+ Author: Konrad Zuse
6
+ License-Expression: MIT
7
+ Keywords: iot,mqtt,coap,supabase,streamlit
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Dynamic: license-file
14
+
15
+ # iotpack
16
+
17
+ A simple Python package that generates complete IoT projects using MQTT and CoAP.
18
+
19
+ ## Installation
20
+
21
+ ```
22
+ pip install iotpack
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ```python
28
+ import iotpack
29
+
30
+ iotpack.mqtt()
31
+ iotpack.coap()
32
+ ```
33
+
34
+ ## Generated Files
35
+
36
+ Each protocol creates a folder (`mqtt/` or `coap/`) with four files:
37
+
38
+ - client.py
39
+ - server.py
40
+ - dashboard.py
41
+ - requirements.txt
42
+
43
+ ## Quick start
44
+
45
+ ```
46
+ cd mqtt
47
+ pip install -r requirements.txt
48
+ set SUPABASE_URL=your-url (Windows) | export SUPABASE_URL=your-url (Mac/Linux)
49
+ set SUPABASE_KEY=your-key (Windows) | export SUPABASE_KEY=your-key (Mac/Linux)
50
+ python server.py
51
+ python client.py
52
+ streamlit run dashboard.py
53
+ ```
54
+
55
+ ## Supabase table
56
+
57
+ Run this once in the Supabase SQL editor:
58
+
59
+ ```sql
60
+ create table sensor_data (
61
+ id bigint generated always as identity primary key,
62
+ device_id text,
63
+ temperature float,
64
+ humidity float,
65
+ created_at timestamptz default now()
66
+ );
67
+ ```
68
+
69
+ ## Features
70
+
71
+ - MQTT client and server
72
+ - CoAP client and server
73
+ - Supabase database integration
74
+ - Streamlit dashboard
75
+ - Automatic requirements generation
76
+
77
+ ## License
78
+
79
+ MIT
@@ -0,0 +1,9 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ iotpack/__init__.py
5
+ iotpack/generator.py
6
+ iotpack.egg-info/PKG-INFO
7
+ iotpack.egg-info/SOURCES.txt
8
+ iotpack.egg-info/dependency_links.txt
9
+ iotpack.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ iotpack
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "iotpack"
7
+ version = "0.1.0"
8
+ description = "A simple Python generator for MQTT and CoAP IoT projects"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ {name = "Konrad Zuse"}
15
+ ]
16
+ keywords = ["iot", "mqtt", "coap", "supabase", "streamlit"]
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+
22
+ [tool.setuptools]
23
+ packages = ["iotpack"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+