Skip to main content

CLASP Python Client

A Python client for the CLASP protocol - Creative Low-Latency Application Streaming Protocol for creative tools communication.

Installation

pip install clasp-to

Quick Start

import asyncio
from clasp import Clasp

async def main():
    # Connect to a CLASP server
    sf = Clasp('ws://localhost:7330')
    await sf.connect()

    # Subscribe to parameter changes
    @sf.on('/lumen/layer/*/opacity')
    def on_opacity(value, address):
        print(f'{address} = {value}')

    # Set a parameter
    await sf.set('/lumen/layer/0/opacity', 0.75)

    # Get a parameter
    opacity = await sf.get('/lumen/layer/0/opacity')
    print(f'Current opacity: {opacity}')

    # Emit an event
    await sf.emit('/lumen/cue/fire', {'cue': 1})

    # Keep running
    sf.run()

asyncio.run(main())

Builder Pattern

from clasp import ClaspBuilder

async def main():
    client = await (
        ClaspBuilder('ws://localhost:7330')
        .with_name('My Python App')
        .with_features(['param', 'event'])
        .with_reconnect(True, interval=5.0)
        .connect()
    )

    # Use client...
    await client.close()

API Reference

Clasp

  • connect() - Connect to server
  • close() - Close connection
  • subscribe(pattern, callback) - Subscribe to address pattern
  • on(pattern) - Decorator for subscriptions
  • set(address, value, ttl=None) - Set parameter value (optional TTL in microseconds)
  • get(address) - Get parameter value
  • emit(address, payload) - Emit event
  • stream(address, value) - Send stream sample
  • bundle(messages, at) - Send atomic bundle
  • cached(address) - Get cached value
  • time() - Get server time (microseconds)

Properties

  • connected - Check if connected
  • session_id - Get session ID

Callbacks

  • on_connect(callback) - Register connect callback
  • on_disconnect(callback) - Register disconnect callback
  • on_error(callback) - Register error callback

Address Patterns

CLASP supports wildcard patterns:

  • * - Match single path segment
  • ** - Match multiple path segments

Examples:

  • /lumen/layer/*/opacity - All layer opacities
  • /lumen/**/enabled - All enabled properties

Documentation

Visit clasp.to for full documentation.

License

MIT


Maintained by LumenCanvas | 2026

Metadata

Release files for clasp-to 4.2.0

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

Source distribution (sdist)

Source distribution for clasp-to 4.2.0
File Size Uploaded Provenance Actions
clasp_to-4.2.0.tar.gz 14.9 kB Without provenance Details for clasp_to-4.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clasp-to 4.2.0
File Interpreter ABI Platform Actions
clasp_to-4.2.0-py3-none-any.whl Python 3 none any Details for clasp_to-4.2.0-py3-none-any.whl

Total release size: 27.4 kB

Release files / clasp_to-4.2.0.tar.gz

Download URL clasp_to-4.2.0.tar.gz
Size 14.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3c121f6d510014e9715dee0dc441e5e54ee5e371ac70cb8907dfa39b846cacbf
BLAKE2b-256 checksum
How to use checksums
6e0d45691b61256a8284d9755fb4b06410007979b91656c10625b025db52f1fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / clasp_to-4.2.0-py3-none-any.whl

Download URL clasp_to-4.2.0-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02c9c7d7cb0f3d678c13b2e330fe94f2f173bb3a4b71949bd71613e245d0514d
BLAKE2b-256 checksum
How to use checksums
7fe89528db36b62de6e7a1dc3b2639328a3459a0c1a13d95ecde30144533cb57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for clasp-to 4.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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