psyclone-client (Python)
Talk to a running Psyclone system from outside it: post messages into
the system by post name and receive what its triggers send out by trigger name, over UDP, TCP
or WebSocket. Messages are CMSDK DataMessages, byte-identical with the C++ library (full or packed
form). Pure Python, standard library only: one wheel for Python 3.8+ on every OS.
pip install psyclone-client
from psyclone_client import PsycloneClient, DataMessage
with PsycloneClient.websocket("ws://host:18600/phone", device="py-1") as psy: # or .udp(host, port), .tcp(...)
psy.on_trigger("Playout", lambda m: print("got", m.get_data("audio"))) # pushed by the system
psy.post("AudioFrame", DataMessage().set_data("audio", b"...")) # into the system
reply = psy.request("Question", DataMessage().set_string("Text", "hi"), timeout=3) # or None
The service it talks to (any Psyclone 2.3+ system):
<service name="Phone">
<post name="AudioFrame" type="Mimir.Audio.Frame"/>
<trigger name="Playout" type="Mimir.Playout.Chunk"/>
</service>
<interface name="PhoneTCP" port="18600" protocol="HTTP" service="Phone"/> <!-- HTTP + WebSocket -->
<interface name="PhoneUDP" port="18600" ip="UDP" protocol="Message" service="Phone"/>
DataMessage
m = DataMessage().set_string("Name", "x").set_int("N", 42).set_double("Gain", 0.7).set_data("pcm", b"\0\1")
m["Other"] = 5 # by Python type: str, int, float, bytes, DataMessage
m.to_bytes(); m.to_packed_bytes() # the two wire forms
DataMessage.from_bytes(wire) # either form
setString/getInt/getBytes/fromBytes... (the names of the C++ binding cmsdk3) work too, so code
moves between the two. Header fields are attributes (time, serial, type, tag, ...).
Behaviour
post(name, msg)setsPsyPost(andPsyDevice) onmsgand sends it; False when the pipe is down (nothing is queued; reliability belongs in the modules, as with every Psyclone service).- Received messages go to the
on_trigger(name, handler)handlers by theirPsyTrigger, then toon_any_message. Handlers run on the reader thread; passcallback=loop.call_soon_threadsafe(or any callable that runs a function) to move them, e.g. into asyncio. request()/request_async()addPsyClientRequestIDand wait for the reply carrying it back. A responder that copies the request (the built-inSimplecrank) does; one that builds a new message must copyPsyClientRequestIDandPsyServiceConnection.- TCP and WebSocket reconnect by themselves (0.5 s doubling to 10 s,
on_state_changed); WebSocket pings every 20 s. A UDP service learns a peer's address from its first datagram; withdeviceset it follows the peer across address changes. packed=Truesends the packed form (about 3x less overhead); Psyclone answers in the form a peer used.- WebSocket text frames:
send_text(),on_text(handler). PsycloneHttp(base_url).request(path, post, fields)for a service's HTTP interface.
Not to be confused with cmsdk3, the C++ binding that runs Python cranks inside Psyclone; this
package is for programs outside it. Licence: BSD with the CADIA clause (CMSDK).
Tests
python3 -m unittest discover -s tests # codec conformance (C++ golden messages) + local transports
# live, against bin/<arch>/Psyclone spec=CMSDK/tools/client-test.xml port=18700:
PSYCLONE_LIVE=127.0.0.1 python3 -m unittest tests.test_client
Metadata
Release files for psyclone-client 2.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| psyclone_client-2.3.1.tar.gz | 26.8 kB | Without provenance | Details for psyclone_client-2.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| psyclone_client-2.3.1-py3-none-any.whl | Python 3 | none | any | Details for psyclone_client-2.3.1-py3-none-any.whl |
Total release size: 48.6 kB
Release files / psyclone_client-2.3.1.tar.gz
| Download URL | psyclone_client-2.3.1.tar.gz |
|---|---|
| Size | 26.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85e143dc15bea29ecca586c8721d6da9c503e9c6caaa83400b9b6ff3b750748a
|
|
BLAKE2b-256 checksum How to use checksums |
992b0d16931e0143f38fdc114b7ab7a55acaafd91d764f2bcdfe6f6bb6749605
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / psyclone_client-2.3.1-py3-none-any.whl
| Download URL | psyclone_client-2.3.1-py3-none-any.whl |
|---|---|
| Size | 21.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c782a2ded37b84abcdc4d47d4b3dfa0bcfc5bff84c8f325b25cb14709a4979fe
|
|
BLAKE2b-256 checksum How to use checksums |
015c9c03aba2f69fa2cc3ac3654c7f962e2113bd90bed7699d802ad1021bd215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for psyclone-client 2.3.1
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.