Skip to main content

Add your description here

Project description

PyQTTier

A Python MQTT client library providing a clean, type-safe wrapper around paho-mqtt with support for MQTT 5.0 features.

Features

  • MQTT 5.0 Support - Full support for MQTT 5.0 protocol features including message properties, correlation data, and response topics
  • Type Safety - Strongly typed with mypy-checked type hints for reliability
  • Multiple Transports - Supports TCP, WebSocket, and Unix socket connections
  • Mock Implementation - Built-in MockConnection for easy testing without a broker
  • Python 3.7+ - Compatible with Python 3.7 through 3.12 Python 3.7 Tests

Installation

pip install pyqttier

Quick Start

Basic Usage

from pyqttier.connection import Mqtt5Connection
from pyqttier.transport import MqttTransport, MqttTransportType
from pyqttier.message import Message

# Connect to broker
transport = MqttTransport(MqttTransportType.TCP, host="localhost", port=1883)
conn = Mqtt5Connection(transport=transport, client_id="my-client")

# Subscribe to a topic
def on_message(msg: Message):
    print(f"Received: {msg.payload.decode()}")

conn.subscribe("sensors/temperature", callback=on_message)

# Publish a message
msg = Message(topic="sensors/temperature", payload=b"23.5", qos=1)
conn.publish(msg)

Testing with MockConnection

from pyqttier.mock import MockConnection
from pyqttier.message import Message

# Create mock connection for testing
conn = MockConnection()

# Publish and verify
conn.publish(Message(topic="test", payload=b"data", qos=1))
assert len(conn.published_messages) == 1
assert conn.published_messages[0].topic == "test"

Examples

See the examples/ directory for more detailed usage examples:

  • usage_example.py - Real broker connections, wildcards, request-response patterns
  • mock_example.py - Testing with MockConnection

Development

# Install project
uv pip install -e .

# Type checking
uv run mypy --check-untyped-defs ./src/

# Unit tests
uv run pytest

License

MIT License.

See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyqttier-0.1.5.tar.gz (93.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyqttier-0.1.5-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file pyqttier-0.1.5.tar.gz.

File metadata

  • Download URL: pyqttier-0.1.5.tar.gz
  • Upload date:
  • Size: 93.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyqttier-0.1.5.tar.gz
Algorithm Hash digest
SHA256 428c5fb47ebded5d60eae8355cfa9e0a1f6a84e33b0b6b23f07f9859c7122503
MD5 d1888cf46a2efc9b5fdf870dc60fa418
BLAKE2b-256 feab415506e8c154335b1d57b0481b32b0e924232cf772121e75a977ad872721

See more details on using hashes here.

File details

Details for the file pyqttier-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pyqttier-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.12 {"installer":{"name":"uv","version":"0.9.12"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"25.10","id":"questing","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pyqttier-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3162b7befab574c114c03e3142fe38c2949baea49364a1e217cbdd0d415e6214
MD5 d45bfedc5c49bac6a48e3ed54ce07a63
BLAKE2b-256 c124897da4c745cebf3424e80a0e463268eca10b0c9789b39100ffd154eaee93

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page