@@ -38,12 +38,12 @@ runloop = RunloopSDK()
3838
3939# Create a ready-to-use devbox
4040with runloop.devbox.create(name = " my-devbox" ) as devbox:
41- result = devbox.cmd.exec(command = " echo 'Hello from Runloop!'" )
41+ result = devbox.cmd.exec(" echo 'Hello from Runloop!'" )
4242 print (result.stdout())
4343
4444 # Stream stdout in real time
4545 devbox.cmd.exec(
46- command = " ls -la" ,
46+ " ls -la" ,
4747 stdout = lambda line : print (" stdout:" , line),
4848 )
4949
@@ -68,13 +68,13 @@ from runloop_api_client import AsyncRunloopSDK
6868async def main ():
6969 runloop = AsyncRunloopSDK()
7070 async with await runloop.devbox.create(name = " async-devbox" ) as devbox:
71- result = await devbox.cmd.exec(command = " pwd" )
71+ result = await devbox.cmd.exec(" pwd" )
7272 print (await result.stdout())
7373
7474 def capture (line : str ) -> None :
7575 print (" >>" , line)
7676
77- await devbox.cmd.exec(command = " ls" , stdout = capture)
77+ await devbox.cmd.exec(" ls" , stdout = capture)
7878
7979asyncio.run(main())
8080```
@@ -147,13 +147,13 @@ Execute commands synchronously or asynchronously:
147147
148148``` python
149149# Synchronous command execution (waits for completion)
150- result = devbox.cmd.exec(command = " ls -la" )
150+ result = devbox.cmd.exec(" ls -la" )
151151print (" Output:" , result.stdout())
152152print (" Exit code:" , result.exit_code)
153153print (" Success:" , result.success)
154154
155155# Asynchronous command execution (returns immediately)
156- execution = devbox.cmd.exec_async(command = " npm run dev" )
156+ execution = devbox.cmd.exec_async(" npm run dev" )
157157
158158# Check execution status
159159state = execution.get_state()
@@ -173,7 +173,7 @@ The `Execution` object provides fine-grained control over asynchronous command e
173173
174174``` python
175175# Start a long-running process
176- execution = devbox.cmd.exec_async(command = " python train_model.py" )
176+ execution = devbox.cmd.exec_async(" python train_model.py" )
177177
178178# Get the execution ID
179179print (" Execution ID:" , execution.execution_id)
@@ -208,10 +208,10 @@ The `ExecutionResult` object contains the output and exit status of a completed
208208
209209``` python
210210# From synchronous execution
211- result = devbox.cmd.exec(command = " ls -la /tmp" )
211+ result = devbox.cmd.exec(" ls -la /tmp" )
212212
213213# Or from asynchronous execution
214- execution = devbox.cmd.exec_async(command = " echo 'test'" )
214+ execution = devbox.cmd.exec_async(" echo 'test'" )
215215result = execution.result()
216216
217217# Access execution results
@@ -250,7 +250,7 @@ def handle_output(line: str) -> None:
250250 print (" LOG:" , line)
251251
252252result = devbox.cmd.exec(
253- command = " python train.py" ,
253+ " python train.py" ,
254254 stdout = handle_output,
255255 stderr = lambda line : print (" ERR:" , line),
256256 output = lambda line : print (" ANY:" , line),
@@ -267,7 +267,7 @@ def capture(line: str) -> None:
267267 log_queue.put_nowait(line)
268268
269269await devbox.cmd.exec(
270- command = " tail -f /var/log/app.log" ,
270+ " tail -f /var/log/app.log" ,
271271 stdout = capture,
272272)
273273```
@@ -365,13 +365,13 @@ Devboxes support context managers for automatic cleanup:
365365``` python
366366# Synchronous
367367with runloop.devbox.create(name = " temp-devbox" ) as devbox:
368- result = devbox.cmd.exec(command = " echo 'Hello'" )
368+ result = devbox.cmd.exec(" echo 'Hello'" )
369369 print (result.stdout())
370370# devbox is automatically shutdown when exiting the context
371371
372372# Asynchronous
373373async with await runloop.devbox.create(name = " temp-devbox" ) as devbox:
374- result = await devbox.cmd.exec(command = " echo 'Hello'" )
374+ result = await devbox.cmd.exec(" echo 'Hello'" )
375375 print (await result.stdout())
376376# devbox is automatically shutdown when exiting the context
377377```
@@ -586,7 +586,7 @@ devbox = runloop.devbox.create(
586586)
587587
588588# The storage object is now accessible at /home/user/data.txt in the devbox
589- result = devbox.cmd.exec(command = " cat /home/user/data.txt" )
589+ result = devbox.cmd.exec(" cat /home/user/data.txt" )
590590print (result.stdout()) # "Hello, World!"
591591
592592# Mount archived objects (tar, tgz, gzip) - they get extracted to a directory
@@ -607,7 +607,7 @@ devbox_with_archive = runloop.devbox.create(
607607)
608608
609609# Access extracted archive contents
610- result = devbox_with_archive.cmd.exec(command = " ls -la /home/user/project/" )
610+ result = devbox_with_archive.cmd.exec(" ls -la /home/user/project/" )
611611print (result.stdout())
612612```
613613
@@ -634,7 +634,7 @@ runloop = RunloopSDK()
634634
635635try :
636636 devbox = runloop.devbox.create(name = " example-devbox" )
637- result = devbox.cmd.exec(command = " invalid-command" )
637+ result = devbox.cmd.exec(" invalid-command" )
638638except runloop_api_client.APIConnectionError as e:
639639 print (" The server could not be reached" )
640640 print (e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -694,14 +694,14 @@ async def main():
694694
695695 # All the same operations, but with await
696696 async with await runloop.devbox.create(name = " async-devbox" ) as devbox:
697- result = await devbox.cmd.exec(command = " pwd" )
697+ result = await devbox.cmd.exec(" pwd" )
698698 print (await result.stdout())
699699
700700 # Streaming (note: callbacks must be synchronous)
701701 def capture (line : str ) -> None :
702702 print (" >>" , line)
703703
704- await devbox.cmd.exec(command = " ls" , stdout = capture)
704+ await devbox.cmd.exec(" ls" , stdout = capture)
705705
706706 # Async file operations
707707 await devbox.file.write(path = " /tmp/test.txt" , contents = " Hello" )
0 commit comments