stinger-python-utils
Shared utilities for Stinger Python services, providing convenient message creation for MQTT communication.
Installation
uv add stinger-python-utils
MessageCreator
MessageCreator is a utility class for creating MQTT messages with standardized properties and payloads.
Basic Usage
from pydantic import BaseModel
from stinger_python_utils.message_creator import MessageCreator
class MyPayload(BaseModel):
name: str
value: int
payload = MyPayload(name="test", value=42)
message = MessageCreator.signal_message("my/topic", payload)
Methods
| Method | Purpose | Return Code |
|---|---|---|
signal_message(topic, payload) |
Send a signal with one-time delivery | QoS 1, no retain |
status_message(topic, payload, expiry_seconds) |
Send status that expires | QoS 1, retained, with expiry |
error_response_message(topic, return_code, correlation_id, debug_info) |
Error response to a request | QoS 1, user properties: ReturnCode |
response_message(topic, payload, return_code, correlation_id) |
Successful response to a request | QoS 1, user properties: ReturnCode |
property_state_message(topic, payload, state_version) |
Publish property state | QoS 1, retained, JSON content type |
property_update_request_message(topic, payload, version, response_topic, correlation_id) |
Request property update | QoS 1, user property: PropertyVersion |
property_response_message(topic, payload, version, return_code, correlation_id, debug_info) |
Respond to property update | QoS 1, user properties: ReturnCode, PropertyVersion |
request_message(topic, payload, response_topic, correlation_id) |
Send a request (auto-generates UUID if no correlation_id) | QoS 1, auto correlation ID |
Example: Request/Response Pattern
from pydantic import BaseModel
from stinger_python_utils.message_creator import MessageCreator
class Request(BaseModel):
action: str
request = Request(action="start")
msg = MessageCreator.request_message(
"devices/cmd",
request,
response_topic="devices/response"
)
# Returns a Message with auto-generated correlation ID
Example: Error Response
msg = MessageCreator.error_response_message(
"devices/response",
return_code=500,
correlation_id="req-123",
debug_info="Device not found"
)
# User properties include: ReturnCode=500, DebugInfo=Device not found
Metadata
Release files for stinger-python-utils 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| stinger_python_utils-0.5.0.tar.gz | 106.0 kB | Without provenance | Details for stinger_python_utils-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| stinger_python_utils-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for stinger_python_utils-0.5.0-py3-none-any.whl |
Total release size: 112.0 kB
Release files / stinger_python_utils-0.5.0.tar.gz
| Download URL | stinger_python_utils-0.5.0.tar.gz |
|---|---|
| Size | 106.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e110b76602b268801580ceff852be89bdc3e416b5c2157d4e941a78e13089f3
|
|
BLAKE2b-256 checksum How to use checksums |
fefb5f459851eee67c9fd26977a411790ab93ff8df5f8da12dc6f131dcf8892d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / stinger_python_utils-0.5.0-py3-none-any.whl
| Download URL | stinger_python_utils-0.5.0-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ffb77576486af02afea22f4e789069d6311f150463a46611eb8a4291951ccf69
|
|
BLAKE2b-256 checksum How to use checksums |
a0f64406bb385a80d4f4c42fe62fe8209cccba225c9bf70df3c45cad6a6d5a67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for stinger-python-utils 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.