Skip to main content

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.

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.2.0.tar.gz (817.9 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.2.0-py3-none-any.whl (810.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py2max_server-0.2.0.tar.gz
  • Upload date:
  • Size: 817.9 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.2.0.tar.gz
Algorithm Hash digest
SHA256 dd6f50b1f46d0d00b64bfa72163faca18f0105a1236d38bfb31238772b707b3f
MD5 6d11c06428f6ed5213618ee627fb2bde
BLAKE2b-256 98e7013143c708ee96cc773bd6c2f275d5096314b9e954db14bad69319c76802

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py2max_server-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 810.9 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 817e05389c03c7bdbd8a8c900a95701d0627042c6655d88ad130c929557dd6b7
MD5 2927cd72bf4e0958b76807b014a1da76
BLAKE2b-256 6b32bca729660cf858047a4bbaa0348457caa62f2cda20ece12b48aabc4824a2

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.1

2 files

0.3.0

2 files

0.2.2

2 files

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

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