Skip to main content

<a href="https://codeclimate.com/github/luanguimaraesla/gabby/maintainability">
<img src="https://api.codeclimate.com/v1/badges/dc94cbf3854b542d3862/maintainability" />
</a>
<a href="https://travis-ci.org/luanguimaraesla/gabby">
<img src="https://travis-ci.org/luanguimaraesla/gabby.svg?branch=master" />
</a>
<a href="https://badge.fury.io/py/gabby">
<img src="https://badge.fury.io/py/gabby.svg" />
</a>
<a href="https://codecov.io/gh/codecov/example-python">
<img src="https://codecov.io/gh/luanguimaraesla/gabby/branch/master/graph/badge.svg" />
</a>


# Python Gabby

A simple controller for MQTT and MQTT-SN pipelines using Mosquitto and RSMB

## Installing

You can install the package through pip

```bash
pip install gabby
```

## Examples

Before run examples, please initialize the Mosquitto or RSMB server.

#### Receiving messages

```python
from gabby.gabby import Gabby, Topic
from gabby.controller import Controller


class PrinterGabby(Gabby):
def transform(self, message):
print(f'ARRIVED! Data: {message.data}')
return []


if __name__ == "__main__":
controller = Controller()

topic_A = Topic('queue/a', 'i')
topic_B = Topic('queue/b', 'i')

printer_gabby = PrinterGabby([topic_A], [topic_B])

controller.add_gabby(printer_gabby)
controller.run()
```

#### Transmitting messages

```python
from gabby.gabby import Gabby, Topic
from gabby.message import Message


if __name__ == "__main__":
topic_A = Topic('queue/a', 'i')
topic_B = Topic('queue/b', 'i')

g = Gabby([topic_B], [topic_A])
data = (1,)
g.send(Message(data, g.output_topics))

```

#### Using UDP broker

```python
from gabby.gabby import Gabby, Topic
from gabby.controller import Controller


class PrinterGabby(Gabby):
def transform(self, message):
print(f'ARRIVED! Data: {message.data}')
return []


if __name__ == "__main__":
controller = Controller()

topic_A = Topic('queue/a', 'i', 'udp')
topic_B = Topic('queue/b', 'i', 'udp')

printer_gabby = PrinterGabby([topic_A], [topic_B], transmission='udp')

controller.add_gabby(printer_gabby)
controller.run()
```


#### Using both UDP and TCP topics

You can use both TCP and UDP brokers

```python
import logging
from gabby import Gabby, Topic, Controller


class LoggerGabby(Gabby):
def transform(self, message):
logging.debug(f"ARRIVED! Data: {message.data}")


def setup_logging(level):
"""
Setup logging level
"""
logging.basicConfig(
format='%(levelname)s: %(message)s',
level=getattr(logging, level.upper())
)


if __name__ == "__main__":
setup_logging('debug')
controller = Controller()

topic_A = Topic('qa', 'i', 'udp')
topic_F = Topic('qb', 'i', 'udp')
topic_B = Topic('queue/1', 'i', 'tcp')
topic_C = Topic('queue/a', 'i', 'tcp')
topic_D = Topic('queue/b', 'i', 'tcp')
topic_E = Topic('queue/c', 'i', 'tcp')

logger_gabby = LoggerGabby(
[topic_A, topic_F, topic_B, topic_C, topic_D, topic_E],
transmission=['tcp', 'udp']
)

controller.add_gabby(logger_gabby)
controller.run()

```


Metadata

Release files for gabby 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gabby 0.1.0
File Size Uploaded Provenance Actions
gabby-0.1.0.tar.gz 7.5 kB Without provenance Details for gabby-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gabby 0.1.0
File Interpreter ABI Platform Actions
gabby-0.1.0-py3-none-any.whl Python 3 none any Details for gabby-0.1.0-py3-none-any.whl

Total release size: 18.5 kB

Release files / gabby-0.1.0.tar.gz

Download URL gabby-0.1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6c8eddb31967782544085c5c7ddbcff167a590dae682521a07318b9b2b125663
BLAKE2b-256 checksum
How to use checksums
ecfb9252033bcd6625d6aa6d486c60994547933a23b1cc0e703e918bb628a407
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / gabby-0.1.0-py3-none-any.whl

Download URL gabby-0.1.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
300e170e059fd8e230f1ccade2ceebbc9aeb52669507fc677e045887024fc634
BLAKE2b-256 checksum
How to use checksums
440029a39b78b177fd1c8ad15d29dab1436d28a2306740f00c3e0939c2b98a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for gabby 0.1.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page