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.2.tar.gz (833.8 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.2-py3-none-any.whl (817.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for py2max_server-0.2.2.tar.gz
Algorithm Hash digest
SHA256 134813dfa701b239c1a6a7b93978c63cd13827f0e711990507949a7ef96eb012
MD5 5270e21a474818eb4dae925f6ed397ce
BLAKE2b-256 66c6bc988135f8119dbdb00261058607248e1710bc894c0afd5350fd2107135b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for py2max_server-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 26cffa10dfb387269923b6728454be2ac3b98a5d999fd56dc40bd5c268d34b92
MD5 8dc184f56544c63edb3b1e20178757d1
BLAKE2b-256 cba74e8c1bf2aa3d3d5d04d354ce90c1a281c3d54eecb812dda797a47730fb1f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.1

2 files

0.3.0

2 files

This release

0.2.2 This release

2 files

0.2.0

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