ironflock 1.0.9__py3-none-any.whl → 1.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,32 @@
1
+ ###
2
+ # Minimal example of creating an Autobahn asyncio ApplicationSession
3
+ # for connecting to the IronFlock Platform.
4
+ # Compared to the IronFlock() class, the ApplicationSession approach allows
5
+ # more control reacting to the lifecycle of the Session:
6
+ # you can register callback functions like on_join or on_leave.
7
+ # For more details checkout:
8
+ # https://autobahn.readthedocs.io/en/latest/wamp/programming.html#application-components
9
+ ###
10
+
11
+ from asyncio import sleep
12
+ from autobahn.wamp.interfaces import ISession
13
+ from ironflock import create_application_session
14
+
15
+ # returns an Autobahn asyncio ApplicationSession and ApplicationRunner, for more information checkout:
16
+ # https://autobahn.readthedocs.io/en/latest/reference/autobahn.asyncio.html
17
+ AppSession, runner = create_application_session()
18
+
19
+
20
+ class Application(AppSession):
21
+ async def onJoin(session: ISession, details):
22
+ print("joined router")
23
+ print(session, details)
24
+
25
+ # publish an event every second
26
+ while True:
27
+ session.publish("test.publish.com", 1, "two", 3, foo="bar")
28
+ await sleep(1)
29
+
30
+
31
+ if __name__ == "__main__":
32
+ runner.run(Application)
examples/component.py ADDED
@@ -0,0 +1,40 @@
1
+ ###
2
+ # Minimal example of creating an Autobahn asyncio Component
3
+ # for connecting to the IronFlock Platform.
4
+ # Compared to the IronFlock() class, the Component approach allows
5
+ # more control, e.g. reacting to the lifecycle of the component:
6
+ # you can register callback functions like on_join or on_leave.
7
+ # For more details checkout:
8
+ # https://autobahn.readthedocs.io/en/latest/wamp/programming.html#application-components
9
+ ###
10
+
11
+ from asyncio import sleep
12
+ from autobahn.asyncio.component import run
13
+ from autobahn.wamp.interfaces import ISession
14
+ from ironflock import create_application_component
15
+
16
+ # returns an Autobahn asyncio Component, for more information checkout:
17
+ # https://autobahn.readthedocs.io/en/latest/reference/autobahn.asyncio.html
18
+ comp = create_application_component()
19
+
20
+
21
+ @comp.on_join
22
+ async def onJoin(session: ISession, details):
23
+ print("joined router")
24
+ print(session, details)
25
+
26
+ def handler(*args, **kwargs):
27
+ print("got event")
28
+ print(args, kwargs)
29
+
30
+ # subscribe to a topic
31
+ session.subscribe(handler, "test.publish.com")
32
+
33
+ # publish an event every second
34
+ while True:
35
+ session.publish("test.publish.com", 1, "two", 3, foo="bar")
36
+ await sleep(1)
37
+
38
+
39
+ if __name__ == "__main__":
40
+ run([comp])
@@ -0,0 +1,25 @@
1
+ ###
2
+ # Minimal example of publishing events to the IronFlock Platform.
3
+ ###
4
+
5
+ import asyncio
6
+ from ironflock import IronFlock
7
+
8
+ # create a ironflock instance, which auto connects to the IronFlock Platform
9
+ # the ironflock instance handles authentication and reconnects when connection is lost
10
+ rw = IronFlock()
11
+
12
+
13
+ async def main():
14
+ while True:
15
+ # publish an event (if connection is not established the publish is skipped)
16
+ publication = await rw.publish("test.publish.com", 1, "two", 3, foo="bar")
17
+ print(publication)
18
+ await asyncio.sleep(3)
19
+
20
+
21
+ if __name__ == "__main__":
22
+ # run the main coroutine
23
+ asyncio.get_event_loop().create_task(main())
24
+ # run the ironflock component
25
+ rw.run()
@@ -0,0 +1,29 @@
1
+ ###
2
+ # Minimal example of publishing events to the IronFlock Platform.
3
+ ###
4
+
5
+ import asyncio
6
+ from datetime import datetime
7
+ from ironflock import IronFlock
8
+
9
+ # create a ironflock instance, which auto connects to the IronFlock Platform
10
+ # the ironflock instance handles authentication and reconnects when connection is lost
11
+ rw = IronFlock()
12
+
13
+
14
+ async def main():
15
+ while True:
16
+ # publish an event (if connection is not established the publish is skipped)
17
+ publication = await rw.publish_to_table(
18
+ "sensordata",
19
+ dict(temperature=25, tsp=datetime.now().astimezone().isoformat()),
20
+ )
21
+ print(publication)
22
+ await asyncio.sleep(3)
23
+
24
+
25
+ if __name__ == "__main__":
26
+ # run the main coroutine
27
+ asyncio.get_event_loop().create_task(main())
28
+ # run the ironflock component
29
+ rw.run()
@@ -1,25 +1,24 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ironflock
3
- Version: 1.0.9
3
+ Version: 1.1.0
4
4
  Summary: SDK to integrate your IronFlock Industry 4 Apps with the IronFlock Data Infrastructure
5
- Home-page: https://github.com/RecordEvolution/ironflock-py
6
- Author: Record Evolution GmbH
7
- Author-email: marko.petzold@record-evolution.de
8
- License: MIT
5
+ Author-email: Record Evolution GmbH <marko.petzold@record-evolution.de>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/RecordEvolution/ironflock-py
8
+ Project-URL: Repository, https://github.com/RecordEvolution/ironflock-py
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
9
17
  Requires-Python: >=3.8
10
18
  Description-Content-Type: text/markdown
11
19
  License-File: LICENSE
12
- Requires-Dist: autobahn[asyncio,serialization]==22.3.2
13
- Dynamic: author
14
- Dynamic: author-email
15
- Dynamic: description
16
- Dynamic: description-content-type
17
- Dynamic: home-page
18
- Dynamic: license
20
+ Requires-Dist: autobahn[asyncio,serialization]==24.4.2
19
21
  Dynamic: license-file
20
- Dynamic: requires-dist
21
- Dynamic: requires-python
22
- Dynamic: summary
23
22
 
24
23
  # ironflock
25
24
 
@@ -32,6 +31,19 @@ of the device's fleet and the data is collected in the respective fleet database
32
31
  So if you use the library in your app, the data collection will always be private to the app user's fleet.
33
32
 
34
33
  For more information on the IronFlock IoT Devops Platform for engineers and developers visit our [IronFlock](https://www.ironflock.com) home page.
34
+
35
+ ## Requirements
36
+
37
+ - Python 3.8 or higher
38
+ - Compatible with Python 3.8, 3.9, 3.10, 3.11, and 3.12
39
+
40
+ ## Installation
41
+
42
+ Install from PyPI:
43
+
44
+ ```shell
45
+ pip install ironflock
46
+ ```
35
47
  ## Usage
36
48
 
37
49
  ```python
@@ -75,10 +87,10 @@ the [examples](https://github.com/RecordEvolution/ironflock-py/tree/main/example
75
87
 
76
88
  ## Development
77
89
 
78
- Install the necessary components if you don't have them already:
90
+ Install the necessary build tools if you don't have them already:
79
91
 
80
92
  ```shell
81
- pip install --upgrade setuptools wheel twine
93
+ pip install --upgrade build twine
82
94
  ```
83
95
 
84
96
  Build and publish a new pypi package:
@@ -87,4 +99,17 @@ Build and publish a new pypi package:
87
99
  just publish
88
100
  ```
89
101
 
102
+ Alternatively, you can build manually:
103
+
104
+ ```shell
105
+ # Clean previous builds
106
+ rm -rf build dist *.egg-info
107
+
108
+ # Build the package
109
+ python -m build
110
+
111
+ # Upload to PyPI
112
+ twine upload dist/*
113
+ ```
114
+
90
115
  Check the package at https://pypi.org/project/ironflock/.
@@ -0,0 +1,13 @@
1
+ examples/app_session.py,sha256=ugpaZkqbhcn_DzIMrCLSoPjcPtacyKEDVWj0V2fHZJc,1151
2
+ examples/component.py,sha256=1wvYL1QSRh6t9csh_WPZiMB6GtfmU7PGwSYZtNfQyTg,1255
3
+ examples/simple_publish.py,sha256=3wImf1nikJEHynIvMSx4ofiSFhhbdsBJw3awLA-wYcE,720
4
+ examples/table_publish.py,sha256=IXsWRoLI9u1CqH_9mB-k4TLYEVOjGtcXzWQ3mzcxg1Q,831
5
+ ironflock/AutobahnConnection.py,sha256=Xh1Y7s269XdLTfDYe6moTiJda7cPzCkknICSqxN3fn4,3744
6
+ ironflock/__init__.py,sha256=Ia3Bb7BjyuGl1YBp3fHz0tHS-CsDtH-JSrjbtl-u7S4,264
7
+ ironflock/ironflock.py,sha256=3OftdBL1Fb4fMKNz3ttnycMAN3GmruIkFkjmKaOzahQ,7867
8
+ ironflock-1.1.0.dist-info/licenses/LICENSE,sha256=GpUKjPB381nmkbBIdX74vxXhsNZaNpngTOciss39Pjk,1073
9
+ test/main.py,sha256=Gp4N9nuUWrCDti4-9W5AoGFDX2cWujKg3Bbq1kJcEP8,328
10
+ ironflock-1.1.0.dist-info/METADATA,sha256=hD_x-g1q0ZV4BXPLIsYYTd5byJ2j1jGCKKxGXLPQBXc,3403
11
+ ironflock-1.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ ironflock-1.1.0.dist-info/top_level.txt,sha256=ik-lPYQ3yaZZm6kJURMiJmM2MJh9ExxRSOy-HruvpwY,24
13
+ ironflock-1.1.0.dist-info/RECORD,,
@@ -0,0 +1,3 @@
1
+ examples
2
+ ironflock
3
+ test
test/main.py ADDED
@@ -0,0 +1,10 @@
1
+ from asyncio.events import get_event_loop
2
+ from ironflock import IronFlock
3
+
4
+ async def main():
5
+ rw = IronFlock(serial_number="7652ee0b-c2cb-466a-b8ee-fec4167bf7ce")
6
+ result = await rw.publish('re.meetup.data', {"temperature": 20})
7
+ print(result)
8
+
9
+ if __name__ == "__main__":
10
+ get_event_loop().run_until_complete(main())
@@ -1,8 +0,0 @@
1
- ironflock/AutobahnConnection.py,sha256=Xh1Y7s269XdLTfDYe6moTiJda7cPzCkknICSqxN3fn4,3744
2
- ironflock/__init__.py,sha256=Ia3Bb7BjyuGl1YBp3fHz0tHS-CsDtH-JSrjbtl-u7S4,264
3
- ironflock/ironflock.py,sha256=3OftdBL1Fb4fMKNz3ttnycMAN3GmruIkFkjmKaOzahQ,7867
4
- ironflock-1.0.9.dist-info/licenses/LICENSE,sha256=GpUKjPB381nmkbBIdX74vxXhsNZaNpngTOciss39Pjk,1073
5
- ironflock-1.0.9.dist-info/METADATA,sha256=eEG8bSTbMgUJlf9hdMsGxkwlDDFr--j-icJAnBx-8PU,2764
6
- ironflock-1.0.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- ironflock-1.0.9.dist-info/top_level.txt,sha256=hmMdMPJuvnOTlFKYl1XQOn81vg1DE2LT7xrEXgyxcRA,10
8
- ironflock-1.0.9.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- ironflock