Standardised MQTT+MessagePack for inter-process communication
Project description
Python Tether agent
This module contains a Tether agent for Python.
It has been tested with Python 3.11 (the same version currently used by TouchDesigner)
Installation
pip install tether_agent
Usage
- Create the Tether Agent instance
- Connect
- Create Inputs and/or Outputs
- Define a message handler function if you expect to receive messages, and add it to each Input Plug
- Call publish on the Output Plug each time you want to publish something (payload automatically encoded as messagepack)
Here is an example script that outputs an ever increasing digit every second and listens for it as well:
from time import sleep
from tether_agent import TetherAgent
def on_message(message):
(topic, payload) = message
print("*** Received from topic " + topic + ": " + str(payload))
agent = TetherAgent("test", "abc123")
in_plug = agent.create_input("test")
in_plug.add_listener(on_message)
out_plug = agent.create_output("test")
# Don't forget to connect!
agent.connect("127.0.0.1", 1883, "tether", "sp_ceB0ss!")
value = 0
while True:
if agent.get_is_connected():
sleep(1)
out_plug.publish(None if value <= 0 else value)
value += 1
Developer / packager notes
Create (if necessary) and activate a virtual environment for building/publishing, using pyenv and virtualenv:
pyenv virtualenv tether_build
pyenv activate tether_build
Upgrade (if necessary) Python Packaging build:
pip install --upgrade build
Actually build:
rm -rf dist
python -m build
Install Twine (distribution uploading):
pip install --upgrade twine
Upload to TEST pypi
python -m twine upload --repository testpypi dist/*
Upload to ACTUAL pypi
python -m twine upload dist/*
Install from TEST pypi
pip install install --index-url https://test.pypi.org/simple/ tether_agent
```tettether
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 tether_agent-1.1.5.tar.gz.
File metadata
- Download URL: tether_agent-1.1.5.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76284cf4d6e7380b17bbd26694c417e8951e5a21e7ea3b85faea164ea06ac983
|
|
| MD5 |
aaa120637be59a8b7fd4609bb40e6e64
|
|
| BLAKE2b-256 |
2bc97ca86002adfd975a47375ec0db76d20ac4e1c2bd92091233ff7409ad58ac
|
File details
Details for the file tether_agent-1.1.5-py3-none-any.whl.
File metadata
- Download URL: tether_agent-1.1.5-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c191955b77e0543e76284c5832aa747fcdd2a8ee24e47e7530b81770765ad2d
|
|
| MD5 |
d87eeeedc9110563347c3a7588a994a6
|
|
| BLAKE2b-256 |
0d09b6f0adaf8258b22d94e7b82d1240881ed5d53e74434aa1e1a3d905e257ae
|