@@ -9,6 +9,15 @@ sessions, windows, and panes. Additionally, `libtmux` powers [tmuxp], a tmux wor
9
9
[ ![ Code Coverage] ( https://codecov.io/gh/tmux-python/libtmux/branch/master/graph/badge.svg )] ( https://codecov.io/gh/tmux-python/libtmux )
10
10
[ ![ License] ( https://img.shields.io/github/license/tmux-python/libtmux.svg )] ( https://github.com/tmux-python/libtmux/blob/master/LICENSE )
11
11
12
+ ## Key Features
13
+
14
+ - ** Intuitive API** : Control tmux servers, sessions, windows, and panes with a clean, object-oriented interface
15
+ - ** Complete Automation** : Create and manage complex tmux environments programmatically
16
+ - ** Type Annotations** : Full typing support for modern Python development
17
+ - ** Pytest Plugin** : Built-in testing tools for tmux automation
18
+ - ** Context Managers** : Safe session and window management with Python's context protocol
19
+ - ** Robust Architecture** : Built on tmux's native concepts of targets and formats
20
+
12
21
libtmux builds upon tmux's
13
22
[ target] ( http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#COMMANDS ) and
14
23
[ formats] ( http://man.openbsd.org/OpenBSD-5.9/man1/tmux.1#FORMATS ) to
@@ -19,6 +28,17 @@ View the [documentation](https://libtmux.git-pull.com/),
19
28
[ API] ( https://libtmux.git-pull.com/api.html ) information and
20
29
[ architectural details] ( https://libtmux.git-pull.com/about.html ) .
21
30
31
+ ## Use Cases
32
+
33
+ - ** Development Environment Automation** : Set up consistent workspaces across projects
34
+ - ** CI/CD Systems** : Create isolated environments for testing and deployment
35
+ - ** System Monitoring** : Build interactive dashboards for server administration
36
+ - ** Remote Pair Programming** : Facilitate collaborative development sessions
37
+ - ** Data Science Workflows** : Manage complex data processing pipelines
38
+ - ** Education and Demonstrations** : Create multi-window learning environments
39
+
40
+ For more detailed examples, see our [ use cases documentation] ( https://libtmux.git-pull.com/topics/use_cases.html ) .
41
+
22
42
# Install
23
43
24
44
``` console
@@ -246,6 +266,64 @@ Window(@1 1:..., Session($1 ...))
246
266
Session($ 1 ... )
247
267
```
248
268
269
+ # Testing with pytest
270
+
271
+ libtmux includes a pytest plugin that provides fixtures for testing tmux operations:
272
+
273
+ ``` python
274
+ def test_session_creation (session ):
275
+ """ Test creating a new window in the session."""
276
+ window = session.new_window(window_name = " test_window" )
277
+ assert window.window_name == " test_window"
278
+
279
+ # Create a new pane
280
+ pane = window.split_window()
281
+ assert len (window.panes) == 2
282
+
283
+ # Send keys to the pane
284
+ pane.send_keys(" echo 'Hello from test'" )
285
+ ```
286
+
287
+ See [ pytest plugin documentation] ( https://libtmux.git-pull.com/pytest-plugin/index.html ) for more details.
288
+
289
+ # Advanced Usage
290
+
291
+ libtmux supports a wide range of advanced use cases:
292
+
293
+ ## Context Managers
294
+
295
+ Safely manage sessions and windows with Python's context protocol:
296
+
297
+ ``` python
298
+ with Server().new_session(session_name = " my_session" ) as session:
299
+ window = session.new_window(window_name = " my_window" )
300
+ # Work with the window...
301
+ # Session is properly cleaned up when context exits
302
+ ```
303
+
304
+ ## Advanced Scripting
305
+
306
+ Create complex window layouts and integrate with external systems:
307
+
308
+ ``` python
309
+ session = server.new_session(session_name = " dashboard" )
310
+ main = session.new_window(window_name = " main" )
311
+
312
+ # Create a grid layout with 4 panes
313
+ top_left = main.attached_pane
314
+ top_right = top_left.split_window(vertical = True )
315
+ bottom_left = top_left.split_window(vertical = False )
316
+ bottom_right = top_right.split_window(vertical = False )
317
+
318
+ # Configure each pane
319
+ top_left.send_keys(" htop" , enter = True )
320
+ top_right.send_keys(" watch -n 1 df -h" , enter = True )
321
+ bottom_left.send_keys(" tail -f /var/log/syslog" , enter = True )
322
+ bottom_right.send_keys(" netstat -tunapl" , enter = True )
323
+ ```
324
+
325
+ See [ advanced scripting documentation] ( https://libtmux.git-pull.com/topics/advanced_scripting.html ) for more examples.
326
+
249
327
# Python support
250
328
251
329
Unsupported / no security releases or bug fixes:
0 commit comments