Download Latest Version v0.55.0 - compatibility features, more logging source code.tar.gz (425.3 kB)
Email in envelope

Get an email when there's a new version of libtmux

Home / v0.54.0
Name Modified Size InfoDownloads / Week
Parent folder
README.md 2026-03-07 3.2 kB
v0.54.0 - Revamped logging source code.tar.gz 2026-03-07 423.0 kB
v0.54.0 - Revamped logging source code.zip 2026-03-07 477.7 kB
Totals: 3 Items   903.9 kB 0

Highlights

  • Structured lifecycle logging across Server, Session, Window, and Pane with filterable extra context
  • Bug fixes for rename_window(), Server.kill(), new_session(), and kill_window() error handling

What's new

Structured lifecycle logging (#637)

All lifecycle operations (create, kill, rename, split) now emit INFO-level log records with structured extra context. Every log call includes scalar keys for filtering in log aggregators and test assertions via caplog.records:

Key Type Context
tmux_subcommand str tmux subcommand (e.g. new-session)
tmux_target str tmux target specifier
tmux_session str session name
tmux_window str window name or index
tmux_pane str pane identifier

Logging hygiene improvements:

  • NullHandler added to library __init__.py per Python logging best practices
  • DEBUG-level structured logs for tmux_cmd execution with isEnabledFor guards and heavy keys (tmux_stdout, tmux_stderr, tmux_stdout_len, tmux_stderr_len)
  • Lazy formatting: replaced f-string log formatting with %s throughout
  • Diagnostics: replaced traceback.print_stack() with logger.debug(exc_info=True)
  • Options warnings: replaced logger.exception() with logger.warning() and tmux_option_key structured context for recoverable parse failures
  • Cleanup: removed unused logger definitions from modules that don't log

Bug fixes

Window.rename_window() now raises on failure (#637)

Previously rename_window() caught all exceptions and logged them, masking tmux errors. It now propagates the error, consistent with all other command methods.

Server.kill() captures stderr (#637)

Server.kill() previously discarded the tmux return value. It now checks stderr, raises on unexpected errors, and silently returns for expected conditions ("no server running", "error connecting to").

Server.new_session() checks kill-session stderr (#637)

When kill_session=True and the existing session kill fails, new_session() now raises LibTmuxException with the stderr instead of proceeding silently.

Session.kill_window() target formatting fix (#637)

Fixed self.window_name (wrong attribute) to self.session_name when formatting tmux targets for integer target_window values. Also widened the type signature from str | None to str | int | None to match the existing isinstance(target_window, int) branch.


Installation

pip:

:::console
$ pip install libtmux==0.54.0

uv:

:::console
$ uv add libtmux==0.54.0

What's Changed

Full Changelog: https://github.com/tmux-python/libtmux/compare/v0.53.1...v0.54.0

Source: README.md, updated 2026-03-07