ai-computer-client 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl
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.
- ai_computer/__init__.py +13 -3
- ai_computer/client.py +172 -549
- ai_computer/models.py +45 -0
- ai_computer/submodules/__init__.py +5 -0
- ai_computer/submodules/base.py +81 -0
- ai_computer/submodules/code.py +295 -0
- ai_computer/submodules/filesystem.py +373 -0
- ai_computer/submodules/shell.py +52 -0
- ai_computer_client-0.3.3.dist-info/METADATA +222 -0
- ai_computer_client-0.3.3.dist-info/RECORD +12 -0
- ai_computer_client-0.3.1.dist-info/METADATA +0 -147
- ai_computer_client-0.3.1.dist-info/RECORD +0 -6
- {ai_computer_client-0.3.1.dist-info → ai_computer_client-0.3.3.dist-info}/WHEEL +0 -0
- {ai_computer_client-0.3.1.dist-info → ai_computer_client-0.3.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,147 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: ai-computer-client
|
3
|
-
Version: 0.3.1
|
4
|
-
Summary: Python client for interacting with the AI Computer service
|
5
|
-
Project-URL: Homepage, https://github.com/ColeMurray/ai-computer-client-python
|
6
|
-
Project-URL: Documentation, https://github.com/ColeMurray/ai-computer-client-python#readme
|
7
|
-
Author: AI Computer
|
8
|
-
License: MIT
|
9
|
-
License-File: LICENSE
|
10
|
-
Classifier: Development Status :: 4 - Beta
|
11
|
-
Classifier: Intended Audience :: Developers
|
12
|
-
Classifier: License :: OSI Approved :: MIT License
|
13
|
-
Classifier: Programming Language :: Python :: 3
|
14
|
-
Classifier: Programming Language :: Python :: 3.7
|
15
|
-
Classifier: Programming Language :: Python :: 3.8
|
16
|
-
Classifier: Programming Language :: Python :: 3.9
|
17
|
-
Classifier: Programming Language :: Python :: 3.10
|
18
|
-
Classifier: Programming Language :: Python :: 3.11
|
19
|
-
Requires-Python: >=3.7
|
20
|
-
Requires-Dist: aiohttp>=3.8.0
|
21
|
-
Requires-Dist: typing-extensions>=4.0.0
|
22
|
-
Provides-Extra: dev
|
23
|
-
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
24
|
-
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
25
|
-
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
26
|
-
Description-Content-Type: text/markdown
|
27
|
-
|
28
|
-
# AI Computer Python Client
|
29
|
-
|
30
|
-
Python client library for interacting with the AI Computer Sandbox service.
|
31
|
-
|
32
|
-
## Installation
|
33
|
-
|
34
|
-
```bash
|
35
|
-
pip install ai-computer-client
|
36
|
-
```
|
37
|
-
|
38
|
-
## Usage
|
39
|
-
|
40
|
-
### Basic Usage
|
41
|
-
|
42
|
-
```python
|
43
|
-
from ai_computer import SandboxClient
|
44
|
-
|
45
|
-
async def main():
|
46
|
-
# Initialize client
|
47
|
-
client = SandboxClient()
|
48
|
-
|
49
|
-
# Setup sandbox environment
|
50
|
-
await client.setup()
|
51
|
-
|
52
|
-
try:
|
53
|
-
# Execute code
|
54
|
-
result = await client.execute_code("print('Hello, World!')")
|
55
|
-
print(result.data["output"])
|
56
|
-
|
57
|
-
# Upload a file
|
58
|
-
response = await client.upload_file("local/path/to/file.txt")
|
59
|
-
if response.success:
|
60
|
-
print(f"File uploaded to {response.path}")
|
61
|
-
|
62
|
-
# Download a file
|
63
|
-
response = await client.download_file(
|
64
|
-
"/workspace/file.txt",
|
65
|
-
"local/download/path.txt"
|
66
|
-
)
|
67
|
-
if response.success:
|
68
|
-
print(f"File downloaded to {response.path}")
|
69
|
-
|
70
|
-
# Work with bytes directly
|
71
|
-
content = b"Hello, World!"
|
72
|
-
response = await client.upload_bytes(
|
73
|
-
content=content,
|
74
|
-
filename="hello.txt"
|
75
|
-
)
|
76
|
-
|
77
|
-
# Download as bytes
|
78
|
-
content = await client.download_bytes("/workspace/hello.txt")
|
79
|
-
if isinstance(content, bytes):
|
80
|
-
print(content.decode())
|
81
|
-
|
82
|
-
finally:
|
83
|
-
# Cleanup
|
84
|
-
await client.cleanup()
|
85
|
-
|
86
|
-
# Run with asyncio
|
87
|
-
import asyncio
|
88
|
-
asyncio.run(main())
|
89
|
-
```
|
90
|
-
|
91
|
-
### Advanced Usage
|
92
|
-
|
93
|
-
```python
|
94
|
-
# Stream code execution
|
95
|
-
async for event in client.execute_code_stream("print('Hello')\nprint('World')"):
|
96
|
-
if event.type == "stdout":
|
97
|
-
print(f"Output: {event.data}")
|
98
|
-
elif event.type == "stderr":
|
99
|
-
print(f"Error: {event.data}")
|
100
|
-
elif event.type == "completed":
|
101
|
-
print("Execution completed")
|
102
|
-
|
103
|
-
# Upload with custom settings
|
104
|
-
response = await client.upload_file(
|
105
|
-
"file.txt",
|
106
|
-
destination="/workspace/custom/path",
|
107
|
-
chunk_size=2*1024*1024, # 2MB chunks
|
108
|
-
timeout=600 # 10 minutes
|
109
|
-
)
|
110
|
-
|
111
|
-
# Work with file-like objects
|
112
|
-
from io import BytesIO
|
113
|
-
|
114
|
-
buffer = BytesIO(b"Hello from buffer!")
|
115
|
-
response = await client.upload_bytes(
|
116
|
-
content=buffer,
|
117
|
-
filename="buffer.txt",
|
118
|
-
content_type="text/plain"
|
119
|
-
)
|
120
|
-
```
|
121
|
-
|
122
|
-
## Development
|
123
|
-
|
124
|
-
### Setup
|
125
|
-
|
126
|
-
```bash
|
127
|
-
# Clone the repository
|
128
|
-
git clone https://github.com/ai-computer/ai-computer-client-python
|
129
|
-
cd ai-computer-client-python
|
130
|
-
|
131
|
-
# Create and activate virtual environment
|
132
|
-
python -m venv venv
|
133
|
-
source venv/bin/activate # or `venv\Scripts\activate` on Windows
|
134
|
-
|
135
|
-
# Install development dependencies
|
136
|
-
pip install -e ".[dev]"
|
137
|
-
```
|
138
|
-
|
139
|
-
### Running Tests
|
140
|
-
|
141
|
-
```bash
|
142
|
-
pytest tests/
|
143
|
-
```
|
144
|
-
|
145
|
-
## License
|
146
|
-
|
147
|
-
MIT License
|
@@ -1,6 +0,0 @@
|
|
1
|
-
ai_computer/__init__.py,sha256=9slbwvU5DHW6aOeLy7qIFe7TQkXF3-kOMI2x82VqiAk,197
|
2
|
-
ai_computer/client.py,sha256=TwVsAmNjaj5MDytKZtoHefFJAwYyL2OndtVbY2YxJlM,28729
|
3
|
-
ai_computer_client-0.3.1.dist-info/METADATA,sha256=YDRTkYudV6X0SRLW0OECdduJgCc3dYITjTr99eat0ls,3754
|
4
|
-
ai_computer_client-0.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
5
|
-
ai_computer_client-0.3.1.dist-info/licenses/LICENSE,sha256=N_0S5G1Wik2LWVDViJMAM0Z-6vTBX1bvDjb8vouBA-c,1068
|
6
|
-
ai_computer_client-0.3.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|