Skip to content

Commit db663a3

Browse files
committed
Renamed local_binary_path to _local_stagehand_binary_path, making it internal and clarifying the name
1 parent 787f717 commit db663a3

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

src/stagehand/_client.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
browserbase_project_id: str | None = None,
6363
model_api_key: str | None = None,
6464
server: Literal["remote", "local"] = "remote",
65-
local_binary_path: str | os.PathLike[str] | None = None,
65+
_local_stagehand_binary_path: str | os.PathLike[str] | None = None,
6666
local_host: str = "127.0.0.1",
6767
local_port: int = 0,
6868
local_headless: bool = True,
@@ -96,7 +96,7 @@ def __init__(
9696
- `model_api_key` from `MODEL_API_KEY`
9797
"""
9898
self._server_mode: Literal["remote", "local"] = server
99-
self._local_binary_path = local_binary_path
99+
self._local_stagehand_binary_path = _local_stagehand_binary_path
100100
self._local_host = local_host
101101
self._local_port = local_port
102102
self._local_headless = local_headless
@@ -136,7 +136,7 @@ def __init__(
136136
openai_api_key=openai_api_key,
137137
shutdown_on_close=local_shutdown_on_close,
138138
),
139-
local_binary_path=local_binary_path,
139+
_local_stagehand_binary_path=_local_stagehand_binary_path,
140140
)
141141
else:
142142
if base_url is None:
@@ -229,7 +229,7 @@ def copy(
229229
browserbase_project_id: str | None = None,
230230
model_api_key: str | None = None,
231231
server: Literal["remote", "local"] | None = None,
232-
local_binary_path: str | os.PathLike[str] | None = None,
232+
_local_stagehand_binary_path: str | os.PathLike[str] | None = None,
233233
local_host: str | None = None,
234234
local_port: int | None = None,
235235
local_headless: bool | None = None,
@@ -273,7 +273,7 @@ def copy(
273273
browserbase_project_id=browserbase_project_id or self.browserbase_project_id,
274274
model_api_key=model_api_key or self.model_api_key,
275275
server=server or self._server_mode,
276-
local_binary_path=local_binary_path if local_binary_path is not None else self._local_binary_path,
276+
_local_stagehand_binary_path=_local_stagehand_binary_path if _local_stagehand_binary_path is not None else self._local_stagehand_binary_path,
277277
local_host=local_host or self._local_host,
278278
local_port=local_port if local_port is not None else self._local_port,
279279
local_headless=local_headless if local_headless is not None else self._local_headless,
@@ -346,7 +346,7 @@ def __init__(
346346
browserbase_project_id: str | None = None,
347347
model_api_key: str | None = None,
348348
server: Literal["remote", "local"] = "remote",
349-
local_binary_path: str | os.PathLike[str] | None = None,
349+
_local_stagehand_binary_path: str | os.PathLike[str] | None = None,
350350
local_host: str = "127.0.0.1",
351351
local_port: int = 0,
352352
local_headless: bool = True,
@@ -380,7 +380,7 @@ def __init__(
380380
- `model_api_key` from `MODEL_API_KEY`
381381
"""
382382
self._server_mode: Literal["remote", "local"] = server
383-
self._local_binary_path = local_binary_path
383+
self._local_stagehand_binary_path = _local_stagehand_binary_path
384384
self._local_host = local_host
385385
self._local_port = local_port
386386
self._local_headless = local_headless
@@ -419,7 +419,7 @@ def __init__(
419419
openai_api_key=openai_api_key,
420420
shutdown_on_close=local_shutdown_on_close,
421421
),
422-
local_binary_path=local_binary_path,
422+
_local_stagehand_binary_path=_local_stagehand_binary_path,
423423
)
424424
else:
425425
if base_url is None:
@@ -512,7 +512,7 @@ def copy(
512512
browserbase_project_id: str | None = None,
513513
model_api_key: str | None = None,
514514
server: Literal["remote", "local"] | None = None,
515-
local_binary_path: str | os.PathLike[str] | None = None,
515+
_local_stagehand_binary_path: str | os.PathLike[str] | None = None,
516516
local_host: str | None = None,
517517
local_port: int | None = None,
518518
local_headless: bool | None = None,
@@ -556,7 +556,7 @@ def copy(
556556
browserbase_project_id=browserbase_project_id or self.browserbase_project_id,
557557
model_api_key=model_api_key or self.model_api_key,
558558
server=server or self._server_mode,
559-
local_binary_path=local_binary_path if local_binary_path is not None else self._local_binary_path,
559+
_local_stagehand_binary_path=_local_stagehand_binary_path if _local_stagehand_binary_path is not None else self._local_stagehand_binary_path,
560560
local_host=local_host or self._local_host,
561561
local_port=local_port if local_port is not None else self._local_port,
562562
local_headless=local_headless if local_headless is not None else self._local_headless,

src/stagehand/lib/sea_binary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ def _copy_to_cache(*, src: Path, filename: str, version: str) -> Path:
7878

7979
def resolve_binary_path(
8080
*,
81-
local_binary_path: str | os.PathLike[str] | None = None,
81+
_local_stagehand_binary_path: str | os.PathLike[str] | None = None,
8282
version: str | None = None,
8383
) -> Path:
84-
if local_binary_path is not None:
85-
path = Path(local_binary_path)
84+
if _local_stagehand_binary_path is not None:
85+
path = Path(_local_stagehand_binary_path)
8686
_ensure_executable(path)
8787
return path
8888

src/stagehand/lib/sea_server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ def __init__(
101101
self,
102102
*,
103103
config: SeaServerConfig,
104-
local_binary_path: str | os.PathLike[str] | None = None,
104+
_local_stagehand_binary_path: str | os.PathLike[str] | None = None,
105105
) -> None:
106106
self._config = config
107-
self._binary_path: Path = resolve_binary_path(local_binary_path=local_binary_path, version=__version__)
107+
self._binary_path: Path = resolve_binary_path(_local_stagehand_binary_path=_local_stagehand_binary_path, version=__version__)
108108

109109
self._lock = Lock()
110110
self._async_lock = asyncio.Lock()
@@ -163,7 +163,7 @@ def _start_sync(self) -> tuple[str, subprocess.Popen[bytes]]:
163163
if not self._binary_path.exists():
164164
raise FileNotFoundError(
165165
f"Stagehand SEA binary not found at {self._binary_path}. "
166-
"Pass local_binary_path=... or set STAGEHAND_SEA_BINARY."
166+
"Pass _local_stagehand_binary_path=... or set STAGEHAND_SEA_BINARY."
167167
)
168168

169169
port = _pick_free_port(self._config.host) if self._config.port == 0 else self._config.port
@@ -212,7 +212,7 @@ async def _start_async(self) -> tuple[str, subprocess.Popen[bytes]]:
212212
if not self._binary_path.exists():
213213
raise FileNotFoundError(
214214
f"Stagehand SEA binary not found at {self._binary_path}. "
215-
"Pass local_binary_path=... or set STAGEHAND_SEA_BINARY."
215+
"Pass _local_stagehand_binary_path=... or set STAGEHAND_SEA_BINARY."
216216
)
217217

218218
port = _pick_free_port(self._config.host) if self._config.port == 0 else self._config.port

tests/test_local_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def test_sync_local_mode_starts_before_first_request(respx_mock: MockRouter, mon
5555
)
5656
)
5757

58-
client = Stagehand(server="local", local_binary_path="/does/not/matter/in/test")
58+
client = Stagehand(server="local", _local_stagehand_binary_path="/does/not/matter/in/test")
5959
# Swap in a dummy server so we don't spawn a real binary in unit tests.
6060
client._sea_server = dummy # type: ignore[attr-defined]
6161

@@ -90,7 +90,7 @@ async def test_async_local_mode_starts_before_first_request(
9090
)
9191
)
9292

93-
async with AsyncStagehand(server="local", local_binary_path="/does/not/matter/in/test") as client:
93+
async with AsyncStagehand(server="local", _local_stagehand_binary_path="/does/not/matter/in/test") as client:
9494
client._sea_server = dummy # type: ignore[attr-defined]
9595
resp = await client.sessions.start(model_name="openai/gpt-5-nano")
9696
assert resp.success is True

0 commit comments

Comments
 (0)