CLASP client for Python - Creative Low-Latency Application Streaming Protocol
Project description
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 serverclose()- Close connectionsubscribe(pattern, callback)- Subscribe to address patternon(pattern)- Decorator for subscriptionsset(address, value)- Set parameter valueget(address)- Get parameter valueemit(address, payload)- Emit eventstream(address, value)- Send stream samplebundle(messages, at)- Send atomic bundlecached(address)- Get cached valuetime()- Get server time (microseconds)
Properties
connected- Check if connectedsession_id- Get session ID
Callbacks
on_connect(callback)- Register connect callbackon_disconnect(callback)- Register disconnect callbackon_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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clasp_to-3.2.0.tar.gz.
File metadata
- Download URL: clasp_to-3.2.0.tar.gz
- Upload date:
- Size: 14.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b9b18ae544bd7087fca00c409abd39d2af24a8800cf47233aa518ccafc596e5
|
|
| MD5 |
c5276c3aed2bf7c116c7aefbc34a2015
|
|
| BLAKE2b-256 |
e96f2465a8096ef93a2404bd220559ca5f7c5110f0a203655190772b584f16e6
|
File details
Details for the file clasp_to-3.2.0-py3-none-any.whl.
File metadata
- Download URL: clasp_to-3.2.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31db247e2a69388067bc622c5fae38400ec888f34c3c2340ebeca889e012fd9f
|
|
| MD5 |
fae55b9a9c9adf7e66ea87b0d4e5313e
|
|
| BLAKE2b-256 |
065e8f6fe1ecaa5e7d895a7a567d9b43aad0fa27720130bdb3242a0e87798b18
|