Workspace Manager1.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

tmuxp.workspace.builder.WorkspaceBuilderProtocol

class tmuxp.workspace.builder.WorkspaceBuilderProtocol
Bases:

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

Description#

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

Guides#

Pages that discuss WorkspaceBuilderProtocol.

Members10#

Esc

Type to search.

Reference previewOpen reference