Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 1.28 KB

File metadata and controls

54 lines (40 loc) · 1.28 KB

librmux

librmux is the Python SDK for RMUX. Its public handles follow the same vocabulary as the Rust SDK: RMUX, Session, Window, and Pane.

Examples available

Installation

python -m pip install librmux

librmux targets RMUX 0.6.1 and uses the rmux executable. Install the RMUX binary separately and keep it on PATH, or pass a specific binary with RMUX.builder().binary(...).

from librmux import RMUX

rmux = RMUX()
for session in rmux.list_sessions():
    print(session["session_name"])

Rmux and Server remain available as aliases for existing code.

Endpoint Selection

RMUX()                         # default rmux endpoint
RMUX(socket_path="/tmp/rmux")   # passes -S /tmp/rmux
RMUX(socket_name="demo")        # passes -L demo
RMUX.builder().socket_name("demo").connect_or_start()

Common Operations

session = rmux.ensure_session("demo")
pane = session.pane(0, 0)
pane.send_text("echo hello\n")
pane.expect_visible_text().to_contain("hello").timeout(5)
text = pane.capture_text()

For raw commands:

run = rmux.cmd("rename-window", "-t", "demo:0", "logs")
if run.returncode != 0:
    raise RuntimeError(run.stderr)