Python SDK (connekt)
Zero-dependency Python 3.9+ SDK built purely on the Python standard library — providing both a PC Control Client and a managed Sidecar runner for connekt-hub.
Installation (PyPI)
bash
pip install connektQuick Start: Managed Sidecar
Ideal for automated QA suites, hardware test benches, and CLI tooling:
python
from connekt import Target, spawn_daemon
with spawn_daemon(binary_path="./connekt-hub") as daemon:
client = daemon.client
# 1. Subscribe to messages and inbound streams
msg_sub = client.channel("network").on_message(
lambda m: print("HTTP:", m.src, m.text)
)
def handle_file(stream):
if stream.meta.get("mime") == "video/mp4":
stream.reject("video/mp4 rejected")
return
for chunk in stream:
process_chunk(chunk.bytes)
stream_sub = client.channel("files").on_stream(handle_file)
# 2. RPC, multicast send, and binary streaming
peers = client.refresh_peers()
targets = [p.peer_id for p in peers[:2]]
resp = client.channel("echo").request(targets[0], "hello")
print(resp.text)
client.channel("notice").send(targets, "group-sync")
client.channel("notice").send(Target.ALL, "reload")
with client.channel("files").open_stream(targets, {"mime": "image/png"}) as s:
s.write(png_bytes)
msg_sub.cancel()
stream_sub.cancel()Connect to an Already-Running Hub
python
from connekt import ConnektClient
with ConnektClient("http://127.0.0.1:9527") as client:
print("Health:", client.health())
for peer in client.refresh_peers():
print(peer.peer_id, peer.platform, peer.active_transport)Headless Sidecar Flags
spawn_daemon supports fine-grained flags for CI and deterministic testing:
python
with spawn_daemon(
binary_path="./connekt-hub-headless",
no_adb=False,
no_usbmux=False,
no_udp_discovery=True,
no_bonjour=True,
) as daemon:
...