Skip to main content

Add your description here

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.0.tar.gz (10.3 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.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: loupedeck_python-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 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.0.tar.gz
Algorithm Hash digest
SHA256 b8ee740c083d45836df7955532cbfa729c6cf7c2d877411631b0ec835bb50c26
MD5 2444fdad7d59c405c8651bf32a8cc4dd
BLAKE2b-256 af53e4bb7814d6b86a09140ee1f1302ea392afc563045f79ec2f22cadfbd9150

See more details on using hashes here.

File details

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

File metadata

  • Download URL: loupedeck_python-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 727a6d797574ecb6f15a6c2d05e9a484487c86eb1e789f9354da344b91ffe59e
MD5 fc478aff0cd696991dd352f5462f0eeb
BLAKE2b-256 92286ce88d33dc90b41f2b52c99c4f4ba014a7a5456875193ff76206ed0d0ee3

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