Typed MQTT client and topic/payload model for ISA-95-ish messaging.
Project description
FranzMQ
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.
Features
- 🧠 Typed Payloads using Python dataclasses
- 🧵 Priority-based concurrent callbacks for message handling
- 📦 ISA-95 topic modeling for enterprise-ready messaging structures
- 🔒 TLS support with environment-based auto-configuration
- 🧪 Validation-ready versioning and context-driven payload classes
- 📊 MQTT-based logging with seamless integration
Installation
Install using pip:
pip install franzmq
Quick Start
from franzmq.client import Client
from franzmq.payload import Metric
from franzmq.topic import Topic
client = Client.autocreate_and_connect(client_id="my-client")
topic = Topic(payload_type=Metric, context=("sensor", "temperature"))
metric = Metric(value=22.5)
client.publish(topic, metric)
Typed Payloads
All messages use structured dataclasses (e.g., Metric, Log, ServiceDetails, etc.) that encode/decode automatically to/from JSON.
Logging over MQTT
Enable logging by calling:
client.configure_mqtt_logger(level=logging.INFO)
Auto Configuration via Environment Variables
Uses python-decouple for environment configuration.
Required Variables
MQTT_IPMQTT_USERNAMEMQTT_PASSWORDMQTT_PORT(optional)USE_MQTTSCA_CERT_FILE(optional)TLS_CERT_FILE(optional)TLS_KEY_FILE(optional)
Callback System
Subscribe to topics and register priority-based callbacks:
client.subscribe(topic, qos=1, callback=my_callback, priority=10)
Callbacks with the same priority are executed concurrently; higher-priority callbacks run first.
Payload Types
Includes predefined payloads such as:
MetricLog- And many more are easily self-definable...
Testing ISA-95 Topics
from franzmq.topic import Isa95Topic, Topic, Isa95Fields
basic_topic = Topic(payload_type=Metric, context=("sensor", "temperature"))
isa95_fields = Isa95Fields(enterprise="ent1", site="s1", area="a1", production_line="pl1", work_cell="wc1", origin_id="origin1")
isa95_topic = Isa95Topic.from_topic(basic_topic, isa95_fields)
License
MIT License
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 franzmq-0.4.0b3.tar.gz.
File metadata
- Download URL: franzmq-0.4.0b3.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6bb3b6eeaebbd7f4a25a495135561f59b51f85b995d2bdee5144ccfdf309a87
|
|
| MD5 |
33c70038c3cc7740f09dd7347d9bea47
|
|
| BLAKE2b-256 |
4697b677a47ee862049ffa25e99ef7a8867e1ec573c91b64121f2d138429017e
|
Provenance
The following attestation bundles were made for franzmq-0.4.0b3.tar.gz:
Publisher:
publish.yml on alpamayo-solutions/franzmq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
franzmq-0.4.0b3.tar.gz -
Subject digest:
f6bb3b6eeaebbd7f4a25a495135561f59b51f85b995d2bdee5144ccfdf309a87 - Sigstore transparency entry: 976476207
- Sigstore integration time:
-
Permalink:
alpamayo-solutions/franzmq@c93113a9fc5ea5932d767876a3ebedd35dbe3235 -
Branch / Tag:
refs/heads/staging - Owner: https://github.com/alpamayo-solutions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c93113a9fc5ea5932d767876a3ebedd35dbe3235 -
Trigger Event:
push
-
Statement type:
File details
Details for the file franzmq-0.4.0b3-py3-none-any.whl.
File metadata
- Download URL: franzmq-0.4.0b3-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
919edf09197d39e3b6f886a27beac45d804003e6af4b264c92037e1108841f6f
|
|
| MD5 |
f4767b69629b19de4ea1b90a3872a526
|
|
| BLAKE2b-256 |
e038d96db8db02c8e358af5b367a1debe311496eeb35555c52ea67a4848f75e0
|
Provenance
The following attestation bundles were made for franzmq-0.4.0b3-py3-none-any.whl:
Publisher:
publish.yml on alpamayo-solutions/franzmq
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
franzmq-0.4.0b3-py3-none-any.whl -
Subject digest:
919edf09197d39e3b6f886a27beac45d804003e6af4b264c92037e1108841f6f - Sigstore transparency entry: 976476210
- Sigstore integration time:
-
Permalink:
alpamayo-solutions/franzmq@c93113a9fc5ea5932d767876a3ebedd35dbe3235 -
Branch / Tag:
refs/heads/staging - Owner: https://github.com/alpamayo-solutions
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c93113a9fc5ea5932d767876a3ebedd35dbe3235 -
Trigger Event:
push
-
Statement type: