Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

tmuxp shell

Edit this page on GitHub

TmuxWorkspace 0.1.0-alpha.5 · Source

tmuxp compatibility reference. Examples using tmuxp run the Python reference. Local CLI status describes this port’s implemented coverage.

Open a Python shell with tmux objects available, or evaluate Python using -c. This command remains Python-specific even when reached through a native command.

Evaluate with a selected serverLink to section

Continue the installation walkthrough through its detached load, leaving workspace-guide running in the same shell:

Terminal window
$ tmuxp shell \
-S "$WORKSPACE_TMP/tmux.sock" \
-c 'print(server.sessions)' \
workspace-guide editor

Use -c; the reference does not define --command. Optional session and window arguments select context. --best chooses the best available shell backend; the explicit selectors require their corresponding Python packages. The --pdb path uses a debugger rather than a normal REPL.

The paired --use-pythonrc / --no-startup and --use-vi-mode / --no-vi-mode options share destinations. The last occurrence wins. The negative options disable the corresponding setting. See environment for startup and backend settings.

A native REPL is not an equivalent implementation of Python -c, IPython, or PTPython. Native ports that support this command use an optional version-checked Python bridge and report an unsupported-runtime error if it is absent. Check port coverage before relying on that bridge. Interactive machine output needs a separate terminal; an interactive transcript cannot share JSON stdout.

Backend selectors are mutually exclusive.

Native Swift shellLink to section

The Swift command uses TMUX_WORKSPACE_PYTHON (default python3) and checks for tmuxp 1.74.0 plus libtmux Server support for selecting tmux_bin before evaluation. It passes the selected native tmux executable and socket to that runtime. Run the example above with tmux-workspace after installing this compatible Python environment.

Captured -c calls stream output while Python runs. Machine calls require -c; live chunks use structured stderr warnings and the final stdout result contains both captured streams and the child exit status. See the child output contract for filtering, UTF-8 handling and the one MiB limit per stream. Interactive backends require a terminal; optional backend packages need broader verification.

Arguments and flagsLink to section

Argument or flagsArity / defaultChoices or meaning
"session_name"optional
"window_name"optional
-Svalue; Nonepass-through for tmux -S
-Lvalue; Nonepass-through for tmux -L
-cvalue; Noneinstead of opening shell, execute python code in libtmux and exit
--bestflag; bestuse best shell available in site packages
--pdbflag; Noneuse plain pdb
--codeflag; Noneuse stdlib’s code.interact()
--ptipythonflag; Noneuse ptpython + ipython
--ptpythonflag; Noneuse ptpython
--ipythonflag; Noneuse ipython
--bpythonflag; Noneuse bpython
--use-pythonrcflag; Falseload PYTHONSTARTUP env var and ~/.pythonrc.py script in —code
--no-startupflag; Falsedisable Python startup loading; shares a destination with --use-pythonrc, last occurrence wins
--use-vi-modeflag; Falseuse vi-mode in ptpython/ptipython
--no-vi-modeflag; Falsedisable vi mode; shares a destination with --use-vi-mode, last occurrence wins

All commands accept -h / --help. Root options precede the command; see the CLI overview. The output reference distinguishes current Python flags from native all-command JSON and NDJSON.

Parser and implementation source.

tmuxp reference source.

Esc

Type to search.