Skip to main content

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 logging
  • examples/simple_demo.py: button colors, knobs, touch, and CT knob rendering
  • examples/draw_canvas.py: Pillow-based drawing demo
  • examples/slide_puzzle.py: knob-controlled slide puzzle
  • examples/web/: local web UI + websocket relay

Credits

Original Node.js library by foxxyz.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loupedeck_python-0.1.1.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

loupedeck_python-0.1.1-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file loupedeck_python-0.1.1.tar.gz.

File metadata

  • Download URL: loupedeck_python-0.1.1.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

Hashes for loupedeck_python-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3384b87d1954eb44f1f66f8fb7fdf34a7c5d8f579865a62105c3b5a6e0915943
MD5 e753d813092154bdbaf9fe1cf5faacce
BLAKE2b-256 d4da36422e42b2644d8f7d817889f949bbca32a749f739c9a1dbd3a2f8321288

See more details on using hashes here.

File details

Details for the file loupedeck_python-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: loupedeck_python-0.1.1-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

Hashes for loupedeck_python-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3da63684c59901d3d9996ebad1a3affb929941a863d54a959678b7375ae38199
MD5 dbd9769bfd4a16aa5e50dc22f612e8b0
BLAKE2b-256 a98a5bc0db129d15983799d41b34f600d2b58fabda4bbe6fb127aea47b946837

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page