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()
        borealis = next(effect for effect in effects if effect.name == "Borealis")

        await client.apply_effect(
            borealis.id,
            controls={"speed": 5, "palette": "SilkCircuit"},
            transition="cut",
        )


asyncio.run(main())

Control Surfaces

Control surfaces are dynamic device and driver settings. Request helpers accept normal Python values and return the canonical API resource contracts.

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.surface_id,
            {
                "enabled": True,
                "brightness": 0.88,
            },
        )

        await client.invoke_control_action(
            surface.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.

Event and metrics messages carry mono_us, the publication time in microseconds on the daemon's monotonic clock, beside the wall-clock timestamp. Order and time messages with mono_us: it never moves backwards when the host clock steps. stream.hello.clock_epoch names the clock, and a reconnect that reports a different epoch means the daemon restarted and old stamps no longer line up. Command responses carry mono_us too, read after the command finished, so it falls inside each request's round trip.

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

Metadata

Release files for hypercolor 0.7.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hypercolor 0.7.2
File Size Uploaded Provenance
hypercolor-0.7.2.tar.gz 331.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hypercolor 0.7.2
File Interpreter ABI Platform
hypercolor-0.7.2-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / hypercolor-0.7.2.tar.gz

Download URL hypercolor-0.7.2.tar.gz
Size 331.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9bdc7dab45c18cf4993127a9446f3faed90d5c07af8df2c300dfd4cf6aaa98a8
BLAKE2b-256 checksum
How to use checksums
9882223f5add381439f53eb0b5ab7b78332168da254bc9cb37ca25d088a948d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / hypercolor-0.7.2-py3-none-any.whl

Download URL hypercolor-0.7.2-py3-none-any.whl
Size 827.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02ae38cc2c1ce9c014406907166f92b3ad81722e064fd83b77fc6ef1724308af
BLAKE2b-256 checksum
How to use checksums
6e93e47734446de6d7317a3ac2bd6f96ff6d214823a22569d7dde28db963f4ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for hypercolor 0.7.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hypercolor-0.7.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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