libtmux¶
Typed Python API for tmux. Control servers, sessions, windows, and panes as Python objects.
Quickstart
Install and make your first API call in 5 minutes.
Topics
Architecture, traversal, filtering, and automation patterns.
API Reference
Every public class, function, and exception.
Testing
Isolated tmux fixtures and test helpers.
Contributing
Development setup, code style, release process.
Install¶
$ pip install libtmux
$ uv add libtmux
Tip: libtmux is pre-1.0. Pin to a range: libtmux>=0.55,<0.56
See Quickstart for all methods and first steps.
At a glance¶
>>> demo_window = session.new_window(window_name="my-project")
>>> demo_pane = demo_window.active_pane
>>> demo_pane.send_keys("echo hello")
>>> demo_window.kill()
Server → Session → Window → Pane
Every level of the tmux hierarchy is a typed Python object with traversal, filtering, and command execution.
Testing¶
libtmux ships a pytest plugin with isolated tmux fixtures:
>>> test_window = session.new_window(window_name="test")
>>> test_pane = test_window.active_pane
>>> test_pane.send_keys("echo hello")
>>> test_window.window_name
'test'
>>> test_window.kill()