Metadata-Version: 2.4
Name: mqtt5
Version: 0.1.0
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Typing :: Typed
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
License-File: LICENSE
Summary: The MQTTv5 protocol for Python written in Rust
Author-email: Felix Böhm <f@bo3hm.com>
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# mqtt5

A sans-I/O implementation of the MQTTv5 protocol for Python written in Rust. Serialization is ~5x faster and deserialization ~20x faster than comparable Python code (benchmarked against [mqttproto](https://github.com/agronholm/mqttproto)).

<p align="center">
    <img src="https://github.com/empicano/mqtt5/blob/main/chart.svg" width="650px" />
</p>

<p align="center">
  <i>Reading/Writing a QoS=1 Publish packet with a 256 bytes payload.</i>
</p>

**Write a packet**

```py
import mqtt5

buffer = bytearray(1024)
n = mqtt5.ConnectPacket(client_id="Bulbasaur").write(buffer)
```

**Read a packet**

```py
import mqtt5

buffer = bytearray(b"\x20\x03\x00\x00\x00")
packet, n = mqtt5.read(buffer)
```

## Installation

```bash
pip install mqtt5
```

## Documentation

See the [stub file](https://github.com/empicano/mqtt5/blob/main/mqtt5.pyi) for an API reference and the [MQTTv5 specification](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html) for details about the de/serialization.

## Versioning

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Changelog

See [CHANGELOG.md](https://github.com/empicano/mqtt5/blob/main/CHANGELOG.md), which follows the principles of [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Acknowledgments

mqtt5 was inspired by Brett Cannon's [sans-I/O documentation](https://sans-io.readthedocs.io). I've also learned a lot from Alex Grönholm's [mqttproto](https://github.com/agronholm/mqttproto), which is an excellent pure-Python MQTTv5 protocol implementation.

