Skip to content

Installation

Requirements

py2max requires:

  • Python 3.9 or later
  • No runtime dependencies (pure Python)

The library is designed to work without any external dependencies, making it easy to integrate into existing projects.

Install from PyPI

Once published to PyPI, py2max can be installed using pip:

pip install py2max

Install from Source

To install from source, clone the repository and install using pip:

git clone https://github.com/shakfu/py2max.git
cd py2max
pip install .

Development Installation

For development, use uv (recommended):

git clone https://github.com/shakfu/py2max.git
cd py2max
uv sync
source .venv/bin/activate

Verify Installation

To verify the installation works correctly:

import py2max
print(py2max.__version__)

# Create a simple test patch
p = py2max.Patcher('test.maxpat')
osc = p.add_textbox('cycle~ 440')
print(f"Created patch with oscillator: {osc}")

Optional Dependencies

The interactive browser-based server and REPL now live in the separate py2max-server package:

pip install py2max-server

This pulls in py2max plus websockets and ptpython for the live editing server and interactive REPL. See https://github.com/shakfu/py2max-server.

For enhanced layout algorithms, you can optionally install:

pip install networkx matplotlib
pip install hola-graph      # HOLA orthogonal layout
pip install graph-layout    # COLA constraint-based layout

These are only required for advanced graph-based layout algorithms and are not needed for basic usage.

Max/MSP Integration

py2max works with Max/MSP installations to provide enhanced object documentation and validation:

  • macOS: Automatically detects Max.app installations in /Applications
  • Windows/Linux: Basic functionality available without Max installation

The MaxRef system will automatically discover your Max installation and provide rich documentation for 1157+ Max objects. If Max is not found, the library falls back to basic functionality.