Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py2max_server-0.1.0.tar.gz (795.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py2max_server-0.1.0-py3-none-any.whl (793.7 kB view details)

Uploaded Python 3

File details

Details for the file py2max_server-0.1.0.tar.gz.

File metadata

  • Download URL: py2max_server-0.1.0.tar.gz
  • Upload date:
  • Size: 795.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for py2max_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b754855127f3482cf3989a4f119902e798eeaa3a479efc217e2043f618f739f4
MD5 79e328209fc85268ee52c0a96e677481
BLAKE2b-256 312aa92f91225e83e9fb14e5e7a6bdc88da1130d60dd574081ca6cc0a42715de

See more details on using hashes here.

File details

Details for the file py2max_server-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: py2max_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 793.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for py2max_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 32ce6585cc307ae9c0e7b0ba5eb1ac1cb18363c7e475d4a6621747843a9e3170
MD5 cbdae998071b818cb0b3d09cc7af8987
BLAKE2b-256 39fb00e4a36c2b47cd1f12537eb9317a59645fa9da38f638307f8b046ae232d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page