voidrun 0.0.1__tar.gz → 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- voidrun-0.0.2/PKG-INFO +214 -0
- voidrun-0.0.2/README.md +190 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/pyproject.toml +1 -1
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/__init__.py +18 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api/__init__.py +1 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api/authentication_api.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api/execution_api.py +602 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api/file_system_api.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api/images_api.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api/organizations_api.py +967 -106
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api/sandboxes_api.py +160 -707
- voidrun-0.0.2/voidrun/api_client/api/system_api.py +281 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api_client.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/configuration.py +4 -8
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/exceptions.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/__init__.py +9 -2
- voidrun-0.0.2/voidrun/api_client/models/activate_api_key_request.py +87 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/api_key_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/api_response_sandbox.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/api_response_sandboxes_list.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/api_response_sandboxes_list_meta.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/command_kill_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/command_list_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/command_run_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/command_wait_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/compress_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/create_file_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/create_image_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/create_pty_session200_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/create_pty_session200_response_all_of_data.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/create_pty_session_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/create_sandbox201_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/create_sandbox_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/disk_usage.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/error_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/exec_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/exec_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/exec_response_data.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/execute_in_session_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/extract_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/file_event.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/file_info.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/file_stats.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/generate_api_key_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/generated_api_key_response.py +2 -2
- voidrun-0.0.2/voidrun/api_client/models/get_org_users200_response.py +99 -0
- voidrun-0.0.2/voidrun/api_client/models/get_org_users200_response_all_of_data_inner.py +96 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/get_pty_buffer200_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/get_pty_buffer200_response_all_of_data.py +2 -2
- voidrun-0.0.2/voidrun/api_client/models/get_version200_response.py +91 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/image.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/kill_background_process_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/list_files200_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/list_files200_response_data.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/list_pty_sessions200_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/list_pty_sessions200_response_all_of_data.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/organization.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/process_info.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/pty_session_info.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/register_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/register_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/register_response_data.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/resize_terminal_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/restore_sandbox_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/run_background_command_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/sandbox.py +2 -2
- voidrun-0.0.2/voidrun/api_client/models/session_exec_request.py +107 -0
- voidrun-0.0.2/voidrun/api_client/models/session_exec_response.py +100 -0
- voidrun-0.0.2/voidrun/api_client/models/session_exec_stream_request.py +89 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/snapshot.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/start_watch200_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/start_watch200_response_data.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/start_watch_request.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/models/success_response.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/rest.py +2 -2
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/sandbox.py +64 -0
- voidrun-0.0.1/PKG-INFO +0 -27
- voidrun-0.0.1/README.md +0 -3
- {voidrun-0.0.1 → voidrun-0.0.2}/.gitignore +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/__init__.py +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/api_response.py +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/api_client/py.typed +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/client.py +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/commands.py +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/fs.py +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/interpreter.py +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/pty.py +0 -0
- {voidrun-0.0.1 → voidrun-0.0.2}/voidrun/response.py +0 -0
voidrun-0.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: voidrun
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Python SDK for VoidRun AI Sandbox
|
|
5
|
+
Project-URL: Homepage, https://voidrun.io
|
|
6
|
+
Project-URL: Documentation, https://docs.voidrun.io
|
|
7
|
+
Project-URL: Repository, https://github.com/voidrun/py-sdk
|
|
8
|
+
Author-email: VoidRun Team <support@voidrun.io>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Classifier: Framework :: AsyncIO
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Requires-Dist: certifi
|
|
16
|
+
Requires-Dist: httpx>=0.24.0
|
|
17
|
+
Requires-Dist: pydantic>=2.0.0
|
|
18
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
19
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
20
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
21
|
+
Requires-Dist: urllib3>=2.0.0
|
|
22
|
+
Requires-Dist: websockets>=11.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# VoidRun Python SDK
|
|
26
|
+
|
|
27
|
+
Python SDK for interacting with VoidRun AI Sandboxes. Create sandboxes, execute commands, manage files, watch changes, and use interactive PTY sessions.
|
|
28
|
+
|
|
29
|
+
[](https://pypi.org/project/voidrun/)
|
|
30
|
+
[](https://opensource.org/licenses/MIT)
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- Sandbox lifecycle management
|
|
35
|
+
- Command execution with stdout/stderr capture
|
|
36
|
+
- File system operations (upload, download, list, copy, move)
|
|
37
|
+
- File watching via WebSocket
|
|
38
|
+
- PTY sessions (ephemeral and persistent)
|
|
39
|
+
- Code interpreter helper for common languages
|
|
40
|
+
- Sync and async clients
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
With pip:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install voidrun
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
With Poetry:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
poetry add voidrun
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start (Sync)
|
|
57
|
+
|
|
58
|
+
Set your API key:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
export VR_API_KEY="your-api-key"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Basic usage:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from voidrun import VoidRun
|
|
68
|
+
|
|
69
|
+
vr = VoidRun()
|
|
70
|
+
|
|
71
|
+
resp = vr.sandboxes.create(mem=1024, cpu=1)
|
|
72
|
+
sandbox = resp.data
|
|
73
|
+
|
|
74
|
+
exec_resp = sandbox.exec('echo "Hello from VoidRun"')
|
|
75
|
+
print(exec_resp.data.data.stdout)
|
|
76
|
+
|
|
77
|
+
sandbox.delete()
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Quick Start (Async)
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
import asyncio
|
|
84
|
+
from voidrun import AsyncVoidRun
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
async def main():
|
|
88
|
+
vr = AsyncVoidRun()
|
|
89
|
+
resp = await vr.sandboxes.create(mem=1024, cpu=1)
|
|
90
|
+
sandbox = resp.data
|
|
91
|
+
|
|
92
|
+
exec_resp = sandbox.exec('echo "Hello from VoidRun"')
|
|
93
|
+
print(exec_resp.data.data.stdout)
|
|
94
|
+
|
|
95
|
+
await sandbox.delete_async()
|
|
96
|
+
await vr.aclose()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
asyncio.run(main())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Core Operations
|
|
103
|
+
|
|
104
|
+
### Sandboxes
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
resp = vr.sandboxes.list()
|
|
108
|
+
sandboxes = resp.data
|
|
109
|
+
|
|
110
|
+
resp = vr.sandboxes.get("sandbox-id")
|
|
111
|
+
existing = resp.data
|
|
112
|
+
|
|
113
|
+
vr.sandboxes.delete("sandbox-id")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Command Execution
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
result = sandbox.exec("ls -la /home")
|
|
120
|
+
print(result.data.data.stdout)
|
|
121
|
+
print(result.data.data.stderr)
|
|
122
|
+
print(result.data.data.exit_code)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Streaming Execution
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
def on_stdout(data):
|
|
129
|
+
print("STDOUT:", data)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def on_stderr(data):
|
|
133
|
+
print("STDERR:", data)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
sandbox.exec_stream(
|
|
137
|
+
"python3 -c 'print(2 + 2)'",
|
|
138
|
+
on_stdout=on_stdout,
|
|
139
|
+
on_stderr=on_stderr,
|
|
140
|
+
)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Code Interpreter
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
resp = sandbox.run_code("print(2 + 2)", language="python")
|
|
147
|
+
print(resp.data.stdout)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### File Operations
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
sandbox.fs.create_file("/tmp/hello.txt")
|
|
154
|
+
sandbox.fs.upload_file("/tmp/hello.txt", "Hello, World!")
|
|
155
|
+
|
|
156
|
+
data = sandbox.fs.download_file("/tmp/hello.txt")
|
|
157
|
+
print(data.decode("utf-8"))
|
|
158
|
+
|
|
159
|
+
files = sandbox.fs.list_files("/tmp")
|
|
160
|
+
print(files.data)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### File Watching (Async)
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
async def watch_tmp():
|
|
167
|
+
watcher = await sandbox.fs.watch(
|
|
168
|
+
"/tmp",
|
|
169
|
+
recursive=True,
|
|
170
|
+
on_event=lambda evt: print("event:", evt),
|
|
171
|
+
on_error=lambda err: print("watch error:", err),
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
# Stop watching when done
|
|
175
|
+
watcher.close()
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### PTY Sessions (Async)
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
session_resp = sandbox.pty.create_session()
|
|
182
|
+
session_id = session_resp.data.data.session_id
|
|
183
|
+
|
|
184
|
+
pty = await sandbox.pty.connect(
|
|
185
|
+
session_id=session_id,
|
|
186
|
+
on_data=lambda data: print(data, end=""),
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
pty.send_input("echo 'hello'\n")
|
|
190
|
+
await pty.close()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Configuration
|
|
194
|
+
|
|
195
|
+
Environment variables:
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
export VR_API_KEY="your-api-key"
|
|
199
|
+
export VOIDRUN_BASE_URL="https://api.voidrun.io"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
You can also pass `api_key` and `base_url` directly:
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
vr = VoidRun(api_key="...", base_url="https://api.voidrun.io")
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Examples
|
|
209
|
+
|
|
210
|
+
See the examples in [py-sdk/examples](py-sdk/examples).
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
MIT License
|
voidrun-0.0.2/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# VoidRun Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for interacting with VoidRun AI Sandboxes. Create sandboxes, execute commands, manage files, watch changes, and use interactive PTY sessions.
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/voidrun/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Sandbox lifecycle management
|
|
11
|
+
- Command execution with stdout/stderr capture
|
|
12
|
+
- File system operations (upload, download, list, copy, move)
|
|
13
|
+
- File watching via WebSocket
|
|
14
|
+
- PTY sessions (ephemeral and persistent)
|
|
15
|
+
- Code interpreter helper for common languages
|
|
16
|
+
- Sync and async clients
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
With pip:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install voidrun
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
With Poetry:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
poetry add voidrun
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick Start (Sync)
|
|
33
|
+
|
|
34
|
+
Set your API key:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export VR_API_KEY="your-api-key"
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Basic usage:
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from voidrun import VoidRun
|
|
44
|
+
|
|
45
|
+
vr = VoidRun()
|
|
46
|
+
|
|
47
|
+
resp = vr.sandboxes.create(mem=1024, cpu=1)
|
|
48
|
+
sandbox = resp.data
|
|
49
|
+
|
|
50
|
+
exec_resp = sandbox.exec('echo "Hello from VoidRun"')
|
|
51
|
+
print(exec_resp.data.data.stdout)
|
|
52
|
+
|
|
53
|
+
sandbox.delete()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start (Async)
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
import asyncio
|
|
60
|
+
from voidrun import AsyncVoidRun
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
async def main():
|
|
64
|
+
vr = AsyncVoidRun()
|
|
65
|
+
resp = await vr.sandboxes.create(mem=1024, cpu=1)
|
|
66
|
+
sandbox = resp.data
|
|
67
|
+
|
|
68
|
+
exec_resp = sandbox.exec('echo "Hello from VoidRun"')
|
|
69
|
+
print(exec_resp.data.data.stdout)
|
|
70
|
+
|
|
71
|
+
await sandbox.delete_async()
|
|
72
|
+
await vr.aclose()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
asyncio.run(main())
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Core Operations
|
|
79
|
+
|
|
80
|
+
### Sandboxes
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
resp = vr.sandboxes.list()
|
|
84
|
+
sandboxes = resp.data
|
|
85
|
+
|
|
86
|
+
resp = vr.sandboxes.get("sandbox-id")
|
|
87
|
+
existing = resp.data
|
|
88
|
+
|
|
89
|
+
vr.sandboxes.delete("sandbox-id")
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Command Execution
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
result = sandbox.exec("ls -la /home")
|
|
96
|
+
print(result.data.data.stdout)
|
|
97
|
+
print(result.data.data.stderr)
|
|
98
|
+
print(result.data.data.exit_code)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Streaming Execution
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
def on_stdout(data):
|
|
105
|
+
print("STDOUT:", data)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def on_stderr(data):
|
|
109
|
+
print("STDERR:", data)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
sandbox.exec_stream(
|
|
113
|
+
"python3 -c 'print(2 + 2)'",
|
|
114
|
+
on_stdout=on_stdout,
|
|
115
|
+
on_stderr=on_stderr,
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Code Interpreter
|
|
120
|
+
|
|
121
|
+
```python
|
|
122
|
+
resp = sandbox.run_code("print(2 + 2)", language="python")
|
|
123
|
+
print(resp.data.stdout)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### File Operations
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
sandbox.fs.create_file("/tmp/hello.txt")
|
|
130
|
+
sandbox.fs.upload_file("/tmp/hello.txt", "Hello, World!")
|
|
131
|
+
|
|
132
|
+
data = sandbox.fs.download_file("/tmp/hello.txt")
|
|
133
|
+
print(data.decode("utf-8"))
|
|
134
|
+
|
|
135
|
+
files = sandbox.fs.list_files("/tmp")
|
|
136
|
+
print(files.data)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### File Watching (Async)
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
async def watch_tmp():
|
|
143
|
+
watcher = await sandbox.fs.watch(
|
|
144
|
+
"/tmp",
|
|
145
|
+
recursive=True,
|
|
146
|
+
on_event=lambda evt: print("event:", evt),
|
|
147
|
+
on_error=lambda err: print("watch error:", err),
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# Stop watching when done
|
|
151
|
+
watcher.close()
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### PTY Sessions (Async)
|
|
155
|
+
|
|
156
|
+
```python
|
|
157
|
+
session_resp = sandbox.pty.create_session()
|
|
158
|
+
session_id = session_resp.data.data.session_id
|
|
159
|
+
|
|
160
|
+
pty = await sandbox.pty.connect(
|
|
161
|
+
session_id=session_id,
|
|
162
|
+
on_data=lambda data: print(data, end=""),
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
pty.send_input("echo 'hello'\n")
|
|
166
|
+
await pty.close()
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Configuration
|
|
170
|
+
|
|
171
|
+
Environment variables:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
export VR_API_KEY="your-api-key"
|
|
175
|
+
export VOIDRUN_BASE_URL="https://api.voidrun.io"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
You can also pass `api_key` and `base_url` directly:
|
|
179
|
+
|
|
180
|
+
```python
|
|
181
|
+
vr = VoidRun(api_key="...", base_url="https://api.voidrun.io")
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Examples
|
|
185
|
+
|
|
186
|
+
See the examples in [py-sdk/examples](py-sdk/examples).
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT License
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
# flake8: noqa
|
|
4
4
|
|
|
5
5
|
"""
|
|
6
|
-
|
|
6
|
+
VoidRun API
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
VoidRun API provides comprehensive management of virtual machines (sandboxes), file system operations, execution environments, and organizational resources. All endpoints except `/api/register` and `/api/version` require the `X-API-Key` header for authentication.
|
|
9
9
|
|
|
10
10
|
The version of the OpenAPI document: 1.0.0
|
|
11
11
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
@@ -24,6 +24,7 @@ __all__ = [
|
|
|
24
24
|
"ImagesApi",
|
|
25
25
|
"OrganizationsApi",
|
|
26
26
|
"SandboxesApi",
|
|
27
|
+
"SystemApi",
|
|
27
28
|
"ApiResponse",
|
|
28
29
|
"ApiClient",
|
|
29
30
|
"Configuration",
|
|
@@ -34,6 +35,7 @@ __all__ = [
|
|
|
34
35
|
"ApiAttributeError",
|
|
35
36
|
"ApiException",
|
|
36
37
|
"APIKeyResponse",
|
|
38
|
+
"ActivateAPIKeyRequest",
|
|
37
39
|
"ApiResponseSandbox",
|
|
38
40
|
"ApiResponseSandboxesList",
|
|
39
41
|
"ApiResponseSandboxesListMeta",
|
|
@@ -61,8 +63,11 @@ __all__ = [
|
|
|
61
63
|
"FileStats",
|
|
62
64
|
"GenerateAPIKeyRequest",
|
|
63
65
|
"GeneratedAPIKeyResponse",
|
|
66
|
+
"GetOrgUsers200Response",
|
|
67
|
+
"GetOrgUsers200ResponseAllOfDataInner",
|
|
64
68
|
"GetPTYBuffer200Response",
|
|
65
69
|
"GetPTYBuffer200ResponseAllOfData",
|
|
70
|
+
"GetVersion200Response",
|
|
66
71
|
"Image",
|
|
67
72
|
"KillBackgroundProcessRequest",
|
|
68
73
|
"ListFiles200Response",
|
|
@@ -79,6 +84,9 @@ __all__ = [
|
|
|
79
84
|
"RestoreSandboxRequest",
|
|
80
85
|
"RunBackgroundCommandRequest",
|
|
81
86
|
"Sandbox",
|
|
87
|
+
"SessionExecRequest",
|
|
88
|
+
"SessionExecResponse",
|
|
89
|
+
"SessionExecStreamRequest",
|
|
82
90
|
"Snapshot",
|
|
83
91
|
"StartWatch200Response",
|
|
84
92
|
"StartWatch200ResponseData",
|
|
@@ -93,6 +101,7 @@ from voidrun.api_client.api.file_system_api import FileSystemApi as FileSystemAp
|
|
|
93
101
|
from voidrun.api_client.api.images_api import ImagesApi as ImagesApi
|
|
94
102
|
from voidrun.api_client.api.organizations_api import OrganizationsApi as OrganizationsApi
|
|
95
103
|
from voidrun.api_client.api.sandboxes_api import SandboxesApi as SandboxesApi
|
|
104
|
+
from voidrun.api_client.api.system_api import SystemApi as SystemApi
|
|
96
105
|
|
|
97
106
|
# import ApiClient
|
|
98
107
|
from voidrun.api_client.api_response import ApiResponse as ApiResponse
|
|
@@ -107,6 +116,7 @@ from voidrun.api_client.exceptions import ApiException as ApiException
|
|
|
107
116
|
|
|
108
117
|
# import models into sdk package
|
|
109
118
|
from voidrun.api_client.models.api_key_response import APIKeyResponse as APIKeyResponse
|
|
119
|
+
from voidrun.api_client.models.activate_api_key_request import ActivateAPIKeyRequest as ActivateAPIKeyRequest
|
|
110
120
|
from voidrun.api_client.models.api_response_sandbox import ApiResponseSandbox as ApiResponseSandbox
|
|
111
121
|
from voidrun.api_client.models.api_response_sandboxes_list import ApiResponseSandboxesList as ApiResponseSandboxesList
|
|
112
122
|
from voidrun.api_client.models.api_response_sandboxes_list_meta import ApiResponseSandboxesListMeta as ApiResponseSandboxesListMeta
|
|
@@ -134,8 +144,11 @@ from voidrun.api_client.models.file_info import FileInfo as FileInfo
|
|
|
134
144
|
from voidrun.api_client.models.file_stats import FileStats as FileStats
|
|
135
145
|
from voidrun.api_client.models.generate_api_key_request import GenerateAPIKeyRequest as GenerateAPIKeyRequest
|
|
136
146
|
from voidrun.api_client.models.generated_api_key_response import GeneratedAPIKeyResponse as GeneratedAPIKeyResponse
|
|
147
|
+
from voidrun.api_client.models.get_org_users200_response import GetOrgUsers200Response as GetOrgUsers200Response
|
|
148
|
+
from voidrun.api_client.models.get_org_users200_response_all_of_data_inner import GetOrgUsers200ResponseAllOfDataInner as GetOrgUsers200ResponseAllOfDataInner
|
|
137
149
|
from voidrun.api_client.models.get_pty_buffer200_response import GetPTYBuffer200Response as GetPTYBuffer200Response
|
|
138
150
|
from voidrun.api_client.models.get_pty_buffer200_response_all_of_data import GetPTYBuffer200ResponseAllOfData as GetPTYBuffer200ResponseAllOfData
|
|
151
|
+
from voidrun.api_client.models.get_version200_response import GetVersion200Response as GetVersion200Response
|
|
139
152
|
from voidrun.api_client.models.image import Image as Image
|
|
140
153
|
from voidrun.api_client.models.kill_background_process_request import KillBackgroundProcessRequest as KillBackgroundProcessRequest
|
|
141
154
|
from voidrun.api_client.models.list_files200_response import ListFiles200Response as ListFiles200Response
|
|
@@ -152,6 +165,9 @@ from voidrun.api_client.models.resize_terminal_request import ResizeTerminalRequ
|
|
|
152
165
|
from voidrun.api_client.models.restore_sandbox_request import RestoreSandboxRequest as RestoreSandboxRequest
|
|
153
166
|
from voidrun.api_client.models.run_background_command_request import RunBackgroundCommandRequest as RunBackgroundCommandRequest
|
|
154
167
|
from voidrun.api_client.models.sandbox import Sandbox as Sandbox
|
|
168
|
+
from voidrun.api_client.models.session_exec_request import SessionExecRequest as SessionExecRequest
|
|
169
|
+
from voidrun.api_client.models.session_exec_response import SessionExecResponse as SessionExecResponse
|
|
170
|
+
from voidrun.api_client.models.session_exec_stream_request import SessionExecStreamRequest as SessionExecStreamRequest
|
|
155
171
|
from voidrun.api_client.models.snapshot import Snapshot as Snapshot
|
|
156
172
|
from voidrun.api_client.models.start_watch200_response import StartWatch200Response as StartWatch200Response
|
|
157
173
|
from voidrun.api_client.models.start_watch200_response_data import StartWatch200ResponseData as StartWatch200ResponseData
|
|
@@ -7,4 +7,5 @@ from voidrun.api_client.api.file_system_api import FileSystemApi
|
|
|
7
7
|
from voidrun.api_client.api.images_api import ImagesApi
|
|
8
8
|
from voidrun.api_client.api.organizations_api import OrganizationsApi
|
|
9
9
|
from voidrun.api_client.api.sandboxes_api import SandboxesApi
|
|
10
|
+
from voidrun.api_client.api.system_api import SystemApi
|
|
10
11
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
|
|
3
3
|
"""
|
|
4
|
-
|
|
4
|
+
VoidRun API
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
VoidRun API provides comprehensive management of virtual machines (sandboxes), file system operations, execution environments, and organizational resources. All endpoints except `/api/register` and `/api/version` require the `X-API-Key` header for authentication.
|
|
7
7
|
|
|
8
8
|
The version of the OpenAPI document: 1.0.0
|
|
9
9
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|