Async Python port of the Loupedeck Node.js library for Live, Live S, CT, and Razer Stream Controller devices.
Project description
Loupedeck Python
Async Python API for Loupedeck Live, Live S, CT, and Razer Stream Controller devices. This is a port of the original Node.js library (foxxyz/loupedeck), created with assistance from Codex.
Quickstart
Install dependencies:
uv sync
Minimal async example:
import asyncio
from loupedeck_python import discover
async def main() -> None:
device = await discover(auto_connect=False)
async def on_connect(info: dict[str, str]) -> None:
print(f"Connected: {info['address']}")
async def on_button(event: dict[str, int | str]) -> None:
print(f"Button down: {event['id']}")
async def on_touch(event: dict[str, object]) -> None:
print(f"Touch: {event}")
device.on("connect", on_connect)
device.on("down", on_button)
device.on("touchstart", on_touch)
device.on("touchend", on_touch)
await device.connect()
await device.set_brightness(0.8)
while True:
await asyncio.sleep(1)
if __name__ == "__main__":
asyncio.run(main())
Canvas drawing example (requires Pillow):
uv add pillow
import asyncio
from loupedeck_python import discover
async def main() -> None:
device = await discover(auto_connect=False)
def draw_screen(draw, width: int, height: int, _image) -> None:
draw.rectangle((0, 0, width, height), fill=(0, 0, 0))
draw.rectangle((10, 10, width - 10, height - 10), outline=(255, 255, 255), width=3)
draw.text((20, 20), "Hello Loupedeck", fill=(255, 255, 0))
await device.connect()
await device.draw_screen("center", draw_screen)
while True:
await asyncio.sleep(1)
if __name__ == "__main__":
asyncio.run(main())
Notes
- Ensure the official Loupedeck software is not running, as it can conflict with direct device access.
- Firmware 0.2.26 reportedly fails on Linux; 0.2.23 is known to work.
Examples
examples/simple_async.py: minimal connection + event loggingexamples/simple_demo.py: button colors, knobs, touch, and CT knob renderingexamples/draw_canvas.py: Pillow-based drawing demoexamples/slide_puzzle.py: knob-controlled slide puzzleexamples/web/: local web UI + websocket relay
Credits
Original Node.js library by foxxyz.
License
MIT
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 loupedeck_python-0.1.2.tar.gz.
File metadata
- Download URL: loupedeck_python-0.1.2.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae266ac29d560599cd38a764c5fd1c7a9e61c1c650459ccc6004ac3b975ec4ab
|
|
| MD5 |
5990a914c2af05cfcd435903a5c71e59
|
|
| BLAKE2b-256 |
fbcd3864705f0f378230c47fbf535cd86400f88ad7e18ef6b68074f149b88285
|
File details
Details for the file loupedeck_python-0.1.2-py3-none-any.whl.
File metadata
- Download URL: loupedeck_python-0.1.2-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
298d15936334e6fe7029b4f91108f9bd1ffb60963851a923a72627576008d7a2
|
|
| MD5 |
8e6ee18be93ffc244e038dc35010509e
|
|
| BLAKE2b-256 |
d9bcb0aaac2a0faedd92f9405686ff545567841dbb94d7192d885c9e2501fd49
|