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

tmuxp.workspace.builder.WorkspaceBuilderProtocol

Python
  • Python
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

API reference · Markdown

class tmuxp.workspace.builder.WorkspaceBuilderProtocol
class [source]
class [source]
class tmuxp.workspace.builder.WorkspaceBuilderProtocol
Bases:
  • t.Protocol

Contract a builder must satisfy to be driven by tmuxp load.

A conforming builder is constructed with at least session_config and server (plus the optional plugins and on_* callbacks the classic builder accepts). It exposes build , surfaces the populated tmux session via session , and honors the plugin/progress integration points the CLI drives.

Because the protocol carries data members (session, plugins, the on_* callbacks), validate *instances* with isinstance ; class-level issubclass checks are not supported for runtime-checkable protocols with non-method members.

Examples

A builder implementing the full contract satisfies the protocol:

>>> from tmuxp.workspace.builder.protocol import WorkspaceBuilderProtocol
>>> class MiniBuilder:
... plugins: list = []
... on_progress = None
... on_before_script = None
... on_script_output = None
... on_build_event = None
... def __init__(self, session_config, server, **kwargs):
... self._session_config = session_config
... def build(self, session=None, append=False):
... ...
... def session_exists(self, session_name):
... ...
... def find_current_attached_session(self):
... ...
... @property
... def session(self):
... ...
>>> builder = MiniBuilder(session_config={}, server=None)
>>> isinstance(builder, WorkspaceBuilderProtocol)
True

An object missing the contract does not:

>>> isinstance(object(), WorkspaceBuilderProtocol)
False

Discussed in Python workspace internal API

Members

plugins

plugins : list[t.Any]
attribute [source]
attribute [source]
plugins

on_progress

on_progress : t.Callable[[str], None] | None
attribute [source]
attribute [source]
on_progress

on_before_script

on_before_script : t.Callable[[], None] | None
attribute [source]
attribute [source]
on_before_script

on_script_output

on_script_output : t.Callable[[str], None] | None
attribute [source]
attribute [source]
on_script_output

on_build_event

on_build_event : t.Callable[[dict[str, t.Any]], None] | None
attribute [source]
attribute [source]
on_build_event

__init__

__init__ ( self , session_config : dict[str, t.Any] , server : Server , plugins : list[t.Any] | None = None , on_progress : t.Callable[[str], None] | None = None , on_before_script : t.Callable[[], None] | None = None , on_script_output : t.Callable[[str], None] | None = None , on_build_event : t.Callable[[dict[str, t.Any]], None] | None = None ) → None
method [source]
method [source]
__init__

Construct a builder from an expanded workspace and a tmux server.

session

session ( self ) → Session
property [source]
property [source]
session

Return the tmux session the builder created or populated.

build

build ( self , session : Session | None = None , append : bool = False ) → None
method [source]
method [source]
build

Build the workspace, creating or populating a tmux session.

session_exists

session_exists ( self , session_name : str ) → bool
method [source]
method [source]
session_exists

Return True if a session with session_name already exists.

find_current_attached_session

find_current_attached_session ( self ) → Session
method [source]
method [source]
find_current_attached_session

Return the session currently attached within $TMUX.

Esc

Type to search.