# tmuxp.workspace.builder.WorkspaceBuilderProtocol

- **Module:** tmuxp.workspace.builder
- **Package:** tmuxp
- **Language:** Python
- **Kind:** class
- **Source:** https://github.com/tmux-python/tmuxp/blob/153acdf6ff1268b14d3d03ed488f545a7123c8f1/src/tmuxp/workspace/builder/protocol.py#L28
- **Page:** https://libtmux.org/en/py/latest/workspace/reference/tmuxp-workspace-builder-workspacebuilderprotocol/

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 :meth:`build`, surfaces the populated tmux
session via :attr:`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 :func:`isinstance`;
class-level ``issubclass`` checks are not supported for runtime-checkable
protocols with non-method members.

## Example

A builder implementing the full contract satisfies the protocol:

```python
>>> 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
```

## Example

An object missing the contract does not:

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

## Members

- `plugins` (attribute)
- `on_progress` (attribute)
- `on_before_script` (attribute)
- `on_script_output` (attribute)
- `on_build_event` (attribute)
- `__init__` (method): Construct a builder from an expanded workspace and a tmux server.
- `session` (property): Return the tmux session the builder created or populated.
- `build` (method): Build the workspace, creating or populating a tmux session.
- `session_exists` (method): Return ``True`` if a session with ``session_name`` already exists.
- `find_current_attached_session` (method): Return the session currently attached within ``$TMUX``.
