web¶
Serve a CLABE experiment's terminal UI over a local web port.
Thin wrapper around :mod:textual_serve so the existing Textual TUI can be
reached from a browser without building a separate web frontend. The server
binds to localhost by default; for remote access, forward the port over SSH
(ssh -L) rather than exposing it to the network.
This is an optional feature: install the web extra (pip install
'aind-clabe[web]') to make it available.
serve ¶
serve(
command: str,
*,
host: str = DEFAULT_HOST,
port: int = DEFAULT_PORT,
title: str = "CLABE",
open_browser: bool = False,
) -> None
Serves a CLABE TUI command over a local web port.
Each browser connection launches command as its own subprocess. The
clabe serve command guards against this by passing --single-session,
so a stray second connection refuses to start rather than fighting the live
session over the rig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
str
|
Shell command that starts the CLABE TUI, e.g.
|
required |
host
|
str
|
Interface to bind. Defaults to localhost; keep it there and use SSH port forwarding for remote access. |
DEFAULT_HOST
|
port
|
int
|
TCP port to listen on. |
DEFAULT_PORT
|
title
|
str
|
Title shown in the browser tab. |
'CLABE'
|
open_browser
|
bool
|
When set, open the web UI in the local default browser once the server is ready. Leave off for headless/remote hosts. |
False
|
Raises:
| Type | Description |
|---|---|
ImportError
|
If the optional |
RuntimeError
|
If the server cannot bind (e.g. the port is in use). |
Source code in src/clabe/web.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |