semvec/pypi-packages huggingface dataset:
decorated-paho-mqtt 1.1.1
Wrapper for Paho MQTT with declarative subscriptions and topic parsing utilities
Requires Python: >=3.7

# decorated_paho_mqtt

decorated_paho_mqtt is a wrapper to the Eclipse paho mqtt library ( https://pypi.org/project/paho-mqtt/ )

It is intended to be used with MQTTv5

# pack_topic

`pack_topic` takes an mqtt topic pattern, such as `a/+/c/#`, and additional parameters to fill in for the placeholders.

For each `+` placeholder, a string has to be passed; for a trailing `#`, a list/tuple has to be passed.

`pack_topic('a/+/c/#', "b", ("d","e"))` will return the topic `a/b/c/d/e`

Packing a topic with obviously invalid characters as parameters will raise an exception.

Known Bug: Packing a topic with an empty tuple as parameter for a `#` placeholder will not remove the trailing slash.
pack_topic and unpack_topic are not yet completely symmetrical.

# unpack_topic

`unpack_topic` takes an mqtt topic pattern, such as `a/+/c/#`, and an actual topic, such as `a/b/c/d/e`.

It will match the topic against the pattern, and for each placeholder in the pattern, yield the actual values.

`list(unpack_topic('a/+/c/#','a/b/c/d/e'))` will return `["b", ["d","e"]]`

# GenericMqttEndpoint

`GenericMqttEndpoint` allows to specify topic subscriptions in a declarative way using decorators.
It wraps an paho mqtt client.

You can use the subscribe_decorator on methods of derived classes to receive messages.

You can use the publish method to publish messages.

Example:
```py
import json
from signal import pause
from icecream import ic
from decorated_paho_mqtt import GenericMqttEndpoint


class MyMqtt(GenericMqttEndpoint):

    # Using this decorator will automatically subscribe to the topic and provide the values as positional parameters
    # The paho parameters will be passed as named parameters.
    @GenericMqttEndpoint.subscribe_decorator("a/+/c/#", qos=2)
    def receive_something(self, b, d_e, *, client, userdata, message):
        assert b == "b"
        assert len(d_e) == 2
        assert d_e[0] == "d"
        assert d_e[1] == "e"

    def send_something(self, b, d, e):
        self.publish("a/+/c/#", b, (d, e), qos=2, retain=False, payload=json.dumps(None))

    def _on_log(self, client, userdata, level, buf):
        super(MyMqtt, self)._on_log(client, userdata, level, buf)
        ic(client, userdata, level, buf)


mqtt = MyMqtt(
    # Same parameters as paho's MqttClient()
    dict(transport="tcp"),
    # None or same parameters as paho's MqttClient.username_pw_set()
    dict(username="username", password="password"),
    # Same parameters as paho's MqttClient.connect_async()
    dict(host="127.0.0.1", port=1883, keepalive=10),
    # Whether to activate TLS
    False
)

# Non-Blocking, callbacks will return in another thread:
mqtt.connect()
pause()
```
chatthy 0.2.11
A minimal LLM network chat server/client app.
Requires Python: >=3.11
Keywords: hy, hylang, zeromq, llm, openai, anthropic

# chatthy

An asynchronous terminal server/multiple-client setup for conducting and managing chats with LLMs.

This is the successor project to [llama-farm](https://github.com/atisharma/llama_farm)

The RAG/agent functionality should be split out into an API layer.


### network architecture

- [x] client/server RPC-type architecture
- [x] message signing
- [ ] ensure stream chunk ordering


### chat management

- [x] basic chat persistence and management
- [x] set, switch to saved system prompts (personalities)
- [ ] manage prompts like chats (as files)
- [x] chat truncation to token length
- [x] rename chat
- [x] profiles (profile x personalities -> sets of chats)
- [ ] import/export chat to client-side file
- [x] remove text between <think> tags when saving


### context workspace

- [x] context workspace (load/drop files)
- [x] client inject from file
- [x] client inject from other sources, e.g. youtube (trag)
- [x] templates for standard instruction requests (trag)
- [x] context workspace - bench/suspend files (hidden by filename)
- [ ] local files / folders in transient workspace
- [ ] checkboxes for delete / show / hide


### client interface

- [x] can switch between Anthropic, OpenAI, tabbyAPI providers and models
- [x] streaming
- [x] syntax highlighting
- [x] decent REPL
- [x] REPL command mode
- [x] cut/copy from output
- [x] client-side prompt editing
- [ ] vimish keys in output
- [ ] client-side chat/message editing (how? temporarily set the input field history? Fire up `$EDITOR` in client?)
        - edit via chat local import/export
- [ ] latex rendering (this is tricky in the context of prompt-toolkit, but see flatlatex).
- [ ] generation cancellation
- [ ] tkinter UI


### multimodal

- [ ] design with multimodal models in mind
- [ ] image sending and use
- [ ] image display


### miscellaneous / extensions

- [x] use proper config dir (group?)
- [ ] dump default conf if missing


### tool / agentic use

Use agents at the API level, which is to say, use an intelligent router.
This separates the chatthy system from the RAG/LLM logic.

- [ ] (auto) tools (evolve from llama-farm -> trag)
- [ ] user defined tool plugins
- [ ] server use vdb context at LLM will (tool)
- [ ] iterative workflows (refer to llama-farm, consider smolagents)
- [ ] tool chains
- [ ] tool: workspace file write, delete
- [ ] tool: workspace file patch/diff
- [ ] tool: rag query tool
- [ ] MCP agents?
- [ ] smolagents / archgw?


### RAG

- [x] summaries and standard client instructions (trag)
- [x] server use vdb context on request
- [x] set RAG provider client-side (e.g. Mistral Small, Phi-4)
- [ ] consider best method of pdf conversion / ingestion (fvdb), OOB (image models?)
- [ ] full arxiv paper ingestion (fvdb) - consolidate into one latex file OOB
- [ ] vdb result reranking with context, and winnowing (agent?)
- [ ] vdb results -> workspace (agent?)


## unallocated / out of scope

audio streaming ? - see matatonic's servers
workflows (tree of instruction templates)
tasks