Skip to content

Commit 9d9e3c7

Browse files
committed
cp dines
1 parent ad1479c commit 9d9e3c7

4 files changed

Lines changed: 54 additions & 38 deletions

File tree

src/runloop_api_client/sdk/async_devbox.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,14 @@ def shell(self, shell_name: str | None = None) -> AsyncNamedShell:
295295
296296
Example:
297297
>>> # Create a named shell with a custom name
298-
>>> shell = await devbox.shell('my-session')
298+
>>> shell = await devbox.shell("my-session")
299299
>>> # Create a named shell with an auto-generated UUID name
300300
>>> shell2 = await devbox.shell()
301301
>>> # Commands execute sequentially and share state
302-
>>> await shell.exec('cd /app')
303-
>>> await shell.exec('export MY_VAR=value')
304-
>>> result = await shell.exec('echo $MY_VAR') # Will output 'value'
305-
>>> result = await shell.exec('pwd') # Will output '/app'
302+
>>> await shell.exec("cd /app")
303+
>>> await shell.exec("export MY_VAR=value")
304+
>>> result = await shell.exec("echo $MY_VAR") # Will output 'value'
305+
>>> result = await shell.exec("pwd") # Will output '/app'
306306
"""
307307
if shell_name is None:
308308
# uuid_utils is not typed
@@ -596,11 +596,11 @@ class AsyncNamedShell:
596596
shell name, it will re-attach to the existing named shell, preserving its state.
597597
598598
Example:
599-
>>> shell = await devbox.shell('my-session')
600-
>>> await shell.exec('cd /app')
601-
>>> await shell.exec('export MY_VAR=value')
602-
>>> result = await shell.exec('echo $MY_VAR') # Will output 'value'
603-
>>> result = await shell.exec('pwd') # Will output '/app'
599+
>>> shell = await devbox.shell("my-session")
600+
>>> await shell.exec("cd /app")
601+
>>> await shell.exec("export MY_VAR=value")
602+
>>> result = await shell.exec("echo $MY_VAR") # Will output 'value'
603+
>>> result = await shell.exec("pwd") # Will output '/app'
604604
"""
605605

606606
def __init__(self, devbox: AsyncDevbox, shell_name: str) -> None:
@@ -636,11 +636,11 @@ async def exec(
636636
:rtype: AsyncExecutionResult
637637
638638
Example:
639-
>>> shell = await devbox.shell('my-session')
640-
>>> result = await shell.exec('ls -la')
639+
>>> shell = await devbox.shell("my-session")
640+
>>> result = await shell.exec("ls -la")
641641
>>> print(await result.stdout())
642642
>>> # With streaming callbacks
643-
>>> result = await shell.exec('npm install', stdout=lambda line: print(f"[LOG] {line}"))
643+
>>> result = await shell.exec("npm install", stdout=lambda line: print(f"[LOG] {line}"))
644644
"""
645645
# Ensure shell_name is set and cannot be overridden by user params
646646
params = dict(params)
@@ -669,12 +669,12 @@ async def exec_async(
669669
:rtype: AsyncExecution
670670
671671
Example:
672-
>>> shell = await devbox.shell('my-session')
673-
>>> execution = await shell.exec_async('long-running-task.sh', stdout=lambda line: print(f"[LOG] {line}"))
672+
>>> shell = await devbox.shell("my-session")
673+
>>> execution = await shell.exec_async("long-running-task.sh", stdout=lambda line: print(f"[LOG] {line}"))
674674
>>> # Do other work while command runs...
675675
>>> result = await execution.result()
676676
>>> if result.success:
677-
... print('Task completed successfully!')
677+
... print("Task completed successfully!")
678678
"""
679679
# Ensure shell_name is set and cannot be overridden by user params
680680
params = dict(params)

src/runloop_api_client/sdk/devbox.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,14 @@ def shell(self, shell_name: str | None = None) -> NamedShell:
297297
298298
Example:
299299
>>> # Create a named shell with a custom name
300-
>>> shell = devbox.shell('my-session')
300+
>>> shell = devbox.shell("my-session")
301301
>>> # Create a named shell with an auto-generated UUID name
302302
>>> shell2 = devbox.shell()
303303
>>> # Commands execute sequentially and share state
304-
>>> shell.exec('cd /app')
305-
>>> shell.exec('export MY_VAR=value')
306-
>>> result = shell.exec('echo $MY_VAR') # Will output 'value'
307-
>>> result = shell.exec('pwd') # Will output '/app'
304+
>>> shell.exec("cd /app")
305+
>>> shell.exec("export MY_VAR=value")
306+
>>> result = shell.exec("echo $MY_VAR") # Will output 'value'
307+
>>> result = shell.exec("pwd") # Will output '/app'
308308
"""
309309
if shell_name is None:
310310
# uuid_utils is not typed
@@ -604,11 +604,11 @@ class NamedShell:
604604
name, it will re-attach to the existing named shell, preserving its state.
605605
606606
Example:
607-
>>> shell = devbox.shell('my-session')
608-
>>> shell.exec('cd /app')
609-
>>> shell.exec('export MY_VAR=value')
610-
>>> result = shell.exec('echo $MY_VAR') # Will output 'value'
611-
>>> result = shell.exec('pwd') # Will output '/app'
607+
>>> shell = devbox.shell("my-session")
608+
>>> shell.exec("cd /app")
609+
>>> shell.exec("export MY_VAR=value")
610+
>>> result = shell.exec("echo $MY_VAR") # Will output 'value'
611+
>>> result = shell.exec("pwd") # Will output '/app'
612612
"""
613613

614614
def __init__(self, devbox: Devbox, shell_name: str) -> None:
@@ -644,11 +644,11 @@ def exec(
644644
:rtype: ExecutionResult
645645
646646
Example:
647-
>>> shell = devbox.shell('my-session')
648-
>>> result = shell.exec('ls -la')
647+
>>> shell = devbox.shell("my-session")
648+
>>> result = shell.exec("ls -la")
649649
>>> print(result.stdout())
650650
>>> # With streaming callbacks
651-
>>> result = shell.exec('npm install', stdout=lambda line: print(f"[LOG] {line}"))
651+
>>> result = shell.exec("npm install", stdout=lambda line: print(f"[LOG] {line}"))
652652
"""
653653
# Ensure shell_name is set and cannot be overridden by user params
654654
params = dict(params)
@@ -677,12 +677,12 @@ def exec_async(
677677
:rtype: Execution
678678
679679
Example:
680-
>>> shell = devbox.shell('my-session')
681-
>>> execution = shell.exec_async('long-running-task.sh', stdout=lambda line: print(f"[LOG] {line}"))
680+
>>> shell = devbox.shell("my-session")
681+
>>> execution = shell.exec_async("long-running-task.sh", stdout=lambda line: print(f"[LOG] {line}"))
682682
>>> # Do other work while command runs...
683683
>>> result = execution.result()
684684
>>> if result.success:
685-
... print('Task completed successfully!')
685+
... print("Task completed successfully!")
686686
"""
687687
# Ensure shell_name is set and cannot be overridden by user params
688688
params = dict(params)

tests/smoketests/sdk/test_async_devbox.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,9 @@ async def test_shell_exec_with_streaming(self, devbox: AsyncDevbox) -> None:
861861
shell = devbox.shell("test-shell-9")
862862
stdout_lines: list[str] = []
863863

864-
result = await shell.exec('echo "line1" && echo "line2" && echo "line3"', stdout=lambda line: stdout_lines.append(line))
864+
result = await shell.exec(
865+
'echo "line1" && echo "line2" && echo "line3"', stdout=lambda line: stdout_lines.append(line)
866+
)
865867

866868
assert result.success is True
867869
assert result.exit_code == 0
@@ -879,7 +881,9 @@ async def test_shell_exec_async_with_streaming(self, devbox: AsyncDevbox) -> Non
879881
shell = devbox.shell("test-shell-10")
880882
stdout_lines: list[str] = []
881883

882-
execution = await shell.exec_async('echo "async-line1" && sleep 0.5 && echo "async-line2"', stdout=lambda line: stdout_lines.append(line))
884+
execution = await shell.exec_async(
885+
'echo "async-line1" && sleep 0.5 && echo "async-line2"', stdout=lambda line: stdout_lines.append(line)
886+
)
883887

884888
result = await execution.result()
885889
assert result.success is True
@@ -977,7 +981,11 @@ async def test_shell_exec_async_with_both_streams(self, devbox: AsyncDevbox) ->
977981
stdout_lines: list[str] = []
978982
stderr_lines: list[str] = []
979983

980-
execution = await shell.exec_async('echo "to stdout" && echo "to stderr" >&2', stdout=lambda line: stdout_lines.append(line), stderr=lambda line: stderr_lines.append(line))
984+
execution = await shell.exec_async(
985+
'echo "to stdout" && echo "to stderr" >&2',
986+
stdout=lambda line: stdout_lines.append(line),
987+
stderr=lambda line: stderr_lines.append(line),
988+
)
981989

982990
result = await execution.result()
983991
assert result.success is True

tests/smoketests/sdk/test_devbox.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,9 @@ def test_shell_exec_with_streaming(self, devbox: Devbox) -> None:
849849
shell = devbox.shell("test-shell-9")
850850
stdout_lines: list[str] = []
851851

852-
result = shell.exec('echo "line1" && echo "line2" && echo "line3"', stdout=lambda line: stdout_lines.append(line))
852+
result = shell.exec(
853+
'echo "line1" && echo "line2" && echo "line3"', stdout=lambda line: stdout_lines.append(line)
854+
)
853855

854856
assert result.success is True
855857
assert result.exit_code == 0
@@ -867,7 +869,9 @@ def test_shell_exec_async_with_streaming(self, devbox: Devbox) -> None:
867869
shell = devbox.shell("test-shell-10")
868870
stdout_lines: list[str] = []
869871

870-
execution = shell.exec_async('echo "async-line1" && sleep 0.5 && echo "async-line2"', stdout=lambda line: stdout_lines.append(line))
872+
execution = shell.exec_async(
873+
'echo "async-line1" && sleep 0.5 && echo "async-line2"', stdout=lambda line: stdout_lines.append(line)
874+
)
871875

872876
result = execution.result()
873877
assert result.success is True
@@ -965,7 +969,11 @@ def test_shell_exec_async_with_both_streams(self, devbox: Devbox) -> None:
965969
stdout_lines: list[str] = []
966970
stderr_lines: list[str] = []
967971

968-
execution = shell.exec_async('echo "to stdout" && echo "to stderr" >&2', stdout=lambda line: stdout_lines.append(line), stderr=lambda line: stderr_lines.append(line))
972+
execution = shell.exec_async(
973+
'echo "to stdout" && echo "to stderr" >&2',
974+
stdout=lambda line: stdout_lines.append(line),
975+
stderr=lambda line: stderr_lines.append(line),
976+
)
969977

970978
result = execution.result()
971979
assert result.success is True

0 commit comments

Comments
 (0)