Skip to main content

Hypercolor Python

Async Python client and WebSocket helpers for the Hypercolor daemon.

This package lives inside the main Hypercolor repository at python/. It is a standalone uv project, so Python contributors can work here without touching the Rust workspace.

Generation details live in ../docs/development/CLIENT_GENERATION.md.

Install

The client is published to PyPI as hypercolor (alpha):

uv add hypercolor

For development inside this repository:

uv sync

Quick Start

import asyncio

from hypercolor import HypercolorClient


async def main() -> None:
    async with HypercolorClient() as client:
        status = await client.get_status()
        devices = await client.get_devices()

    print(status.running)
    print([device.name for device in devices])


asyncio.run(main())

The async client is the primary API. Use SyncHypercolorClient for scripts or small tools that are not already running an event loop.

from hypercolor import SyncHypercolorClient

with SyncHypercolorClient() as client:
    print(client.get_status().global_brightness)

Drivers

Driver inventory includes module capabilities, config keys, optional control surface paths, and protocol catalogs for HAL-backed modules.

import asyncio

from hypercolor import HypercolorClient


async def main() -> None:
    async with HypercolorClient() as client:
        for driver in await client.get_drivers():
            if driver.descriptor.capabilities.protocol_catalog:
                print(driver.descriptor.display_name)
                print([protocol.display_name for protocol in driver.protocols])


asyncio.run(main())

Effects

import asyncio

from hypercolor import HypercolorClient


async def main() -> None:
    async with HypercolorClient() as client:
        effects = await client.get_effects()
        aurora = next(effect for effect in effects if effect.name == "Aurora")

        await client.apply_effect(
            aurora.id,
            controls={"speed": 72, "palette": "silkcircuit"},
            transition={"type": "fade", "duration_ms": 400},
        )


asyncio.run(main())

Control Surfaces

Control surfaces are dynamic device and driver settings. The generated OpenAPI models stay private; the public client accepts normal Python values.

import asyncio

from hypercolor import HypercolorClient


async def main() -> None:
    async with HypercolorClient() as client:
        surface = await client.get_device_controls("keyboard")

        await client.set_control_values(
            surface.id,
            {
                "enabled": True,
                "brightness": 88,
            },
            expected_revision=surface.revision,
        )

        await client.invoke_control_action(
            surface.id,
            "identify",
            {"duration_ms": 750},
        )


asyncio.run(main())

Inside an async function, typed daemon values can pass through directly:

async with HypercolorClient() as client:
    await client.set_control_values(
        "device:keyboard",
        {"accent": {"kind": "color_rgb", "value": [128, 255, 234]}},
    )

WebSocket Events

import asyncio

from hypercolor import HypercolorClient
from hypercolor.websocket import EventMessage, MetricsMessage


async def main() -> None:
    async with HypercolorClient() as client:
        async with client.events() as stream:
            await stream.subscribe("events", "metrics")

            async for message in stream:
                if isinstance(message, EventMessage):
                    print(message.event, message.data)
                elif isinstance(message, MetricsMessage):
                    print(message.data)


asyncio.run(main())

Binary frame, spectrum, and canvas messages are decoded into dataclasses, so callers do not need to parse the wire format.

Development

Use the local recipes from python/:

just verify
just fix
just generate
just generate-check

The full project recipe also runs the Python gate:

just python-verify

Manual equivalents:

uv run ruff check .
uv run ruff format --check .
uv run ty check
uv run python scripts/generate_ws_protocol.py --check
uv run pytest
uv run python scripts/generate_openapi_client.py --check

Download files

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

Source Distribution

hypercolor-0.3.2.tar.gz (169.6 kB view details)

Uploaded Source

Built Distribution

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

hypercolor-0.3.2-py3-none-any.whl (481.0 kB view details)

Uploaded Python 3

File details

Details for the file hypercolor-0.3.2.tar.gz.

File metadata

  • Download URL: hypercolor-0.3.2.tar.gz
  • Upload date:
  • Size: 169.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hypercolor-0.3.2.tar.gz
Algorithm Hash digest
SHA256 bb01338326ba6e08916d7f32e2204a5e5df3b312c12c8066eeba3b6f66015d06
MD5 2d3f5deb3c6902538d7019baff0e5fe7
BLAKE2b-256 fa34e2d3d1852e9c7b335de274652103c4d63678d4fab94b496dab98b09d9cff

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercolor-0.3.2.tar.gz:

Publisher: ci.yml on hyperb1iss/hypercolor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hypercolor-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: hypercolor-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 481.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for hypercolor-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 948706baec010f01a266f9e5728a1d8f056d9f372b04d5dc10cf0816b410e088
MD5 9d23e2572c39fd4157f696f0c2b33d74
BLAKE2b-256 1ed9803cc83cb5a4118db52f4ef6bc418aa95fc532a2c973848f4f83f029c543

See more details on using hashes here.

Provenance

The following attestation bundles were made for hypercolor-0.3.2-py3-none-any.whl:

Publisher: ci.yml on hyperb1iss/hypercolor

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 files

0.3.1

2 files

0.2.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page