approck-messaging
Pydantic models and thin FastStream helpers for delivering Telegram-style messages over Redis streams. Used as the shared message contract between backend services and bots (for example with approck-aiogram-utils).
Python: 3.10+
Install
From PyPI:
uv add approck-messaging
Or with pip:
pip install approck-messaging
Optional Redis transport (FastStream + Redis streams):
uv add "approck-messaging[transport]"
Core install includes only Pydantic models — no broker runtime.
What is included
| Module | Purpose |
|---|---|
approck_messaging.models.message |
Message, TransportMessage, MessageType, MessageMedia, MessageButton |
approck_messaging.publisher |
Publisher — publish TransportMessage to a Redis stream |
approck_messaging.subscriber |
Subscriber — decorate handlers with @subscriber.message(...) |
Usage
Message models
Message describes the payload (caption, media, buttons, video note). TransportMessage adds routing metadata (recipient, optional extra, valid_until).
from approck_messaging.models.message import (
MessageMedia,
MessageType,
TransportMessage,
TransportMessageRecipient,
)
message = TransportMessage(
type=MessageType.GENERIC,
caption="Hello",
recipient=TransportMessageRecipient(telegram_id=123456789),
)
Supported MessageType values: generic, video_note.
Publish to a Redis stream
Requires the transport extra (faststream[redis]).
from faststream.redis import RedisBroker
from approck_messaging.models.message import MessageType, TransportMessage, TransportMessageRecipient
from approck_messaging.publisher import Publisher
broker = RedisBroker("redis://localhost:6379")
publisher = Publisher(broker=broker, stream="outbound-messages")
await publisher.send_message(
TransportMessage(
type=MessageType.GENERIC,
caption="Hello",
recipient=TransportMessageRecipient(telegram_id=123456789),
)
)
Publisher.from_uri(redis_uri, stream=...) is a shortcut when you do not share a broker instance.
Subscribe to a Redis stream
from faststream import Context
from faststream.redis import RedisBroker, StreamSub
from approck_messaging.models.message import TransportMessage
from approck_messaging.subscriber import Subscriber
broker = RedisBroker("redis://localhost:6379")
subscriber = Subscriber(broker=broker, my_var=42)
@subscriber.message(StreamSub("outbound-messages", group="bot", consumer="1"))
async def handle(message: TransportMessage, my_var: int = Context()):
assert my_var == 42
...
Extra keyword arguments passed to Subscriber(...) are registered as FastStream global context values (context.set_global).
Development
uv sync --group dev --extra transport
uv run ruff check .
uv run ruff format --check .
uv run mypy approck_messaging
uv run pytest
Related packages
approck-aiogram-utils— sendMessage/TransportMessagepayloads to Telegram via aiogram.
License
MIT — see LICENSE.
Metadata
Release files for approck-messaging 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| approck_messaging-0.1.10.tar.gz | 4.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| approck_messaging-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / approck_messaging-0.1.10.tar.gz
| Download URL | approck_messaging-0.1.10.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a22672ad47dc066fe7ddc618a16b000226f65bd07051cbf6ca6aa2de7d68f1b
|
|
BLAKE2b-256 checksum How to use checksums |
c79ee35b8b972f1b14bc25b58edbab1aa523a7afb7d8d947316af169a6d82c9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / approck_messaging-0.1.10-py3-none-any.whl
| Download URL | approck_messaging-0.1.10-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4890c07318bb1ccaef7dd60fbd6d8377257c8612959a7ff56d030a796eb747e8
|
|
BLAKE2b-256 checksum How to use checksums |
1903485377351c0a9dc6d2f41ce87ebe5d21ddbf7943995cd975702cab973c3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for approck-messaging 0.1.10
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.