Interactive WebSocket server and remote REPL for live editing of py2max Max/MSP patches.
Project description
py2max-server
Interactive WebSocket server and remote REPL for live editing of py2max Max/MSP patches.
This package was split out of the core py2max library so the patch generator stays a small, dependency-light, offline tool. Install this package only when you want a browser-based live editor or an interactive REPL.
Installation
pip install py2max-server
This pulls in py2max (the core generator) plus websockets and ptpython.
Usage
Browser live editor
py2max-server serve my-patch.maxpat
Opens a browser-based editor that syncs bidirectionally with the patch file:
-
HTTP server on
http://localhost:8000 -
WebSocket on
ws://localhost:8001 -
Remote REPL on
localhost:8002
Remote REPL
In a second terminal, connect a REPL client (the token is printed by the server, or set PY2MAX_REPL_TOKEN):
py2max-server repl localhost:8002 --token <session-token>
Python API
import asyncio
from py2max import Patcher
from py2max_server import serve_interactive
p = Patcher("demo.maxpat")
p.add("cycle~ 440")
async def main():
server = await serve_interactive(p, port=8000, auto_open=True)
await asyncio.sleep(60)
await server.stop()
asyncio.run(main())
Security
The remote REPL executes code (eval/exec) sent over its socket. Every connection must authenticate with the session token the server generates; an unauthenticated connection is refused. Bind to localhost and treat the token as a secret.
Relationship to py2max
py2max (core) generates .maxpat files offline and has no knowledge of this server. py2max-server depends on py2max and operates on Patcher objects. Generating patches needs only py2max; serving them needs this package.
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 py2max_server-0.1.1.tar.gz.
File metadata
- Download URL: py2max_server-0.1.1.tar.gz
- Upload date:
- Size: 801.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85a03ec4eefa4363a8fd086260ad5b090e3ae57bb607456313bf5cfb045ff9c8
|
|
| MD5 |
806c4b3c3ca8169e5bfd423abeda9d65
|
|
| BLAKE2b-256 |
0d487385d166623d1658b7ade60d1f5970e6b1bfffa025b0a7927fe2bf741100
|
File details
Details for the file py2max_server-0.1.1-py3-none-any.whl.
File metadata
- Download URL: py2max_server-0.1.1-py3-none-any.whl
- Upload date:
- Size: 796.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2f44271999b5a50534dad0c8d599200824fb5688e684854023037238f0f6086
|
|
| MD5 |
f8fdedbc4456c0422590a33fad3d3c62
|
|
| BLAKE2b-256 |
8ab313cdc34600a187346aef501cbf1968d82463c9d87aca442f0dfb2a669fef
|