IronFlock Python SDK for connecting to the IronFlock Platform
Project description
ironflock
About
With this library you can publish data from your apps on your IoT edge hardware to the fleet data storage of the IronFlock devops platform. When this library is used on a certain device the library automatically uses the private messaging realm (Unified Name Space) of the device's fleet and the data is collected in the respective fleet database.
So if you use the library in your app, the data collection will always be private to the app user's fleet.
For more information on the IronFlock IoT Devops Platform for engineers and developers visit our IronFlock home page.
Requirements
- Python 3.11 or higher
Installation
Install from PyPI:
pip install ironflock
Usage
import asyncio
from ironflock import IronFlock
# create an IronFlock instance to connect to the IronFlock platform data infrastructure.
# The IronFlock instance handles authentication when run on a device registered in IronFlock.
ironflock = IronFlock()
async def main():
while True:
# publish an event (if connection is not established the publish is skipped)
publication = await ironflock.publish("test.publish.com", {"temperature": 20})
print(publication)
await asyncio.sleep(3)
if __name__ == "__main__":
ironflock = IronFlock(mainFunc=main)
ironflock.run()
Options
The IronFlock __init__ function can be configured with the following options:
{
serial_number: string;
}
serial_number: Used to set the serial_number of the device if the DEVICE_SERIAL_NUMBER environment variable does not exist. It can also be used if the user wishes to authenticate as another device.
Advanced Usage
If you need more control, e.g. acting on lifecycle events (onJoin, onLeave) take a look at
the examples folder.
Development
This project uses uv for dependency management and building.
Install uv if you don't have it:
curl -LsSf https://astral.sh/uv/install.sh | sh
Install dependencies (including dev dependencies):
uv sync --extra dev
Run tests:
just test-unit # Run unit tests only
just test # Run all tests
just test-docker # Run integration tests with Docker
Build and publish a new pypi package:
just publish
Or manually:
# Clean previous builds
rm -rf dist
# Build the package
uv build
# Upload to PyPI
uv publish
Check the package at https://pypi.org/project/ironflock/.
Test Deployment
To test the package before deploying to PyPI you can use test.pypi.
just clean build publish-test
Or manually:
uv build
uv publish --publish-url https://test.pypi.org/legacy/
Once the package is published you can install it from TestPyPI:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ironflock
Once the package is published you can use it in other code by putting these lines at the top of the requirements.txt
--index-url https://test.pypi.org/simple/
--extra-index-url https://pypi.org/simple/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ironflock-1.3.9.tar.gz.
File metadata
- Download URL: ironflock-1.3.9.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a922b9635da4223711da41400082f7c0b4488480baa5d3e09b81b7d66370fd74
|
|
| MD5 |
58a262050f4dfab1bde9fb0d016f1746
|
|
| BLAKE2b-256 |
b7dd8961835e2d72926d82a33a9fd55cbcc12aebaa287c61ce9cce3e02b02ec1
|
File details
Details for the file ironflock-1.3.9-py3-none-any.whl.
File metadata
- Download URL: ironflock-1.3.9-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
825f25c4c1782fd132d7119672fb420adc337edcaa0a6866599d05654d8aef56
|
|
| MD5 |
8af82c8fb23635b1d5717055f8a0c7af
|
|
| BLAKE2b-256 |
74ade00ca69366e1bb5f8c6440bbf6578c64722906bbd77898e0a749ed397d48
|