This release is a pre-release and may not be stable for production use.
pyrustuyabridge
Python bindings for rustuya-bridge, an MQTT bridge for managing Tuya devices via the Tuya Local API.
This package exposes the bridge server as an embeddable component, so Python code can run it alongside and interpret MQTT topics/payloads identically to the native bridge.
Install
pip install pyrustuyabridge
Pre-built wheels are provided for Linux (manylinux2014 / musllinux_1_2 on
x86_64 and aarch64), Windows x64, and macOS (x86_64 / arm64). Wheels are
built with PyO3 abi3-py39, so a single wheel per platform supports
CPython 3.9 and newer.
Quick start
import asyncio
from pyrustuyabridge import PyBridgeServer
async def main():
server = PyBridgeServer(
mqtt_broker="mqtt://localhost:1883",
mqtt_root_topic="rustuya",
)
await server.start_async()
asyncio.run(main())
Applying config changes at runtime
The bridge is meant to be driven entirely over MQTT — including config changes.
To apply a change to the topic/payload templates or mqtt_retain, edit the
config_path file and publish a reconfigure action to the command topic. The
bridge clears the retained messages published under the old scheme and then
restarts itself in place — start()/start_async() keep running; they do
not return, and live device connections carry over to the new cycle, so
applying a change to a large fleet costs zero reconnects.
import asyncio
from pyrustuyabridge import PyBridgeServer
async def main():
server = PyBridgeServer(config_path="/etc/rustuya/config.json")
await server.start_async() # only returns on stop()/close() or a signal
asyncio.run(main())
start()/start_async() return only when the bridge actually shuts down —
stop()/close() from another thread/task, or (unless no_signals=True)
SIGINT/SIGTERM. A supervisor is still worth running for boot and crash
recovery, just not to change a topic.
Config precedence is kwargs > config_path file > defaults (the file only
fills fields left unset). So put any field you want to change via
reconfigure in the file, not in kwargs — a field passed as a kwarg wins
and the file edit is ignored (same rule as CLI flags vs. config file in the
native binary).
Helpers
The module also exposes topic/payload utilities for code that needs to match the bridge's wire format:
tpl_to_wildcard(template, root_topic)— template → MQTT wildcard.match_topic(topic, template)— returns extracted variables orNone.render_template(template, vars)— substitutes{key}placeholders.parse_payload(payload, vars)— parses an MQTT payload into a structured value.parse_payload_with_template(payload, template)— reverse ofrender_template: recovers placeholder values from a rendered payload, orNoneif not reversible.parse_seed_dps(payload, dp=None, template=None)— extracts the DPS map from an event payload exactly as the bridge's seed phase does; passdpfor single-DP ({dp}) topics,Nonefor multi-DP topics whose payload is the full DPS object.validate_payload_template(template)—(ok, message); checks whether a payload template can be reverse-parsed.
See the project repository for full documentation.
Release files for pyrustuyabridge 0.4.0.dev1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyrustuyabridge-0.4.0.dev1-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| pyrustuyabridge-0.4.0.dev1-cp39-abi3-musllinux_1_2_x86_64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ x86-64 | Details |
| pyrustuyabridge-0.4.0.dev1-cp39-abi3-musllinux_1_2_aarch64.whl | CPython 3.9 | abi3 | Linux musl 1.2+ ARM64 | Details |
| pyrustuyabridge-0.4.0.dev1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| pyrustuyabridge-0.4.0.dev1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| pyrustuyabridge-0.4.0.dev1-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| pyrustuyabridge-0.4.0.dev1-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 20.2 MB
Release files / pyrustuyabridge-0.4.0.dev1-cp39-abi3-win_amd64.whl
| Download URL | pyrustuyabridge-0.4.0.dev1-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 2.6 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f6b7cfb4fee804931dea44bcb882bb4e9aa60a4d7343a6c526f2fa9f99401d2d
|
|
BLAKE2b-256 checksum How to use checksums |
b34a2bd97813309fc9807039070f983c18e5e3793fcf37d81fbcf5eb66e2d464
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / pyrustuyabridge-0.4.0.dev1-cp39-abi3-musllinux_1_2_x86_64.whl
| Download URL | pyrustuyabridge-0.4.0.dev1-cp39-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.9 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7204b6b0c9585c337400bb55001a7b0bf1a97e28df43c23b8a878ca5185a7a78
|
|
BLAKE2b-256 checksum How to use checksums |
9351ec6c994311a7c8ef1156e694f8e582675ef5ab6840d5b72c97704f2c1b36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / pyrustuyabridge-0.4.0.dev1-cp39-abi3-musllinux_1_2_aarch64.whl
| Download URL | pyrustuyabridge-0.4.0.dev1-cp39-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.9 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
822ce703e433c1bdb84183e1254f61457aba363a0df0e893a383ee59652f5aef
|
|
BLAKE2b-256 checksum How to use checksums |
b3eda8d7c73d610b78adcda028272cd2b2c4541454608dfc147e5bf79d294a1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / pyrustuyabridge-0.4.0.dev1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pyrustuyabridge-0.4.0.dev1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0dffe791e4ed5837da97f221357df13f717ee68d13544dfe8b441f98c5c976ca
|
|
BLAKE2b-256 checksum How to use checksums |
c935411e21ded371bc4519bb880361268ab28b93a26c94bb28a57e3c7b6cfdb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / pyrustuyabridge-0.4.0.dev1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | pyrustuyabridge-0.4.0.dev1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.8 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
e2f1ca886b3e264436e4a8a866032f74f180bdd1aede7f4c4c380a6ad4dedbeb
|
|
BLAKE2b-256 checksum How to use checksums |
3ee4c9dd3892b824bfdb2ccbf0f60394d89ab98ee65d29ecc2ede82c2bc43cae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / pyrustuyabridge-0.4.0.dev1-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | pyrustuyabridge-0.4.0.dev1-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fd667fbb18481fe5916ab2673fceb0aaf7783e2891b3e2cfebfdb7fc840903bf
|
|
BLAKE2b-256 checksum How to use checksums |
b2fa3f5c19d9896120307664feb90c2bc0dac955924831305e5f5e3572170f68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency logRelease files / pyrustuyabridge-0.4.0.dev1-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | pyrustuyabridge-0.4.0.dev1-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
2727f2d4b5cb215e59e21089c93b6cf224e018b988e8a572ad4f6a26db31a0c4
|
|
BLAKE2b-256 checksum How to use checksums |
305c020d5d9d27bc2a4d6c3dda5cff55300ff29325cf864657892ead29b0fee4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.
Transparency log