fleet-python 0.2.28__tar.gz → 0.2.29__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.
Potentially problematic release.
This version of fleet-python might be problematic. Click here for more details.
- {fleet_python-0.2.28 → fleet_python-0.2.29}/PKG-INFO +1 -1
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/client.py +47 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/env/client.py +3 -1
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/tasks.py +2 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/client.py +55 -2
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/env/__init__.py +2 -1
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/env/client.py +3 -2
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/tasks.py +2 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet_python.egg-info/PKG-INFO +1 -1
- {fleet_python-0.2.28 → fleet_python-0.2.29}/pyproject.toml +1 -1
- {fleet_python-0.2.28 → fleet_python-0.2.29}/LICENSE +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/README.md +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/diff_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/dsl_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_action_log.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_client.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_mcp_anthropic.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_mcp_openai.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_sync.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_task.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_tasks.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/example_verifier.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/gemini_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/json_tasks_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/nova_act_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/openai_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/openai_simple_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/query_builder_example.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/examples/quickstart.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/base.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/env/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/exceptions.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/instance/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/instance/base.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/instance/client.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/models.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/resources/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/resources/base.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/resources/browser.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/resources/sqlite.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/verifiers/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/verifiers/bundler.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/_async/verifiers/verifier.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/base.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/config.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/exceptions.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/instance/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/instance/base.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/instance/client.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/instance/models.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/models.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/resources/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/resources/base.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/resources/browser.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/resources/mcp.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/resources/sqlite.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/types.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/__init__.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/bundler.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/code.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/db.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/decorator.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/parse.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/sql_differ.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet/verifiers/verifier.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet_python.egg-info/SOURCES.txt +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet_python.egg-info/dependency_links.txt +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet_python.egg-info/requires.txt +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/fleet_python.egg-info/top_level.txt +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/scripts/fix_sync_imports.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/scripts/unasync.py +0 -0
- {fleet_python-0.2.28 → fleet_python-0.2.29}/setup.cfg +0 -0
|
@@ -213,6 +213,9 @@ class AsyncFleet:
|
|
|
213
213
|
await instance.instance.load()
|
|
214
214
|
return instance
|
|
215
215
|
|
|
216
|
+
async def make_for_task(self, task: Task) -> AsyncEnv:
|
|
217
|
+
return self.make(env_key=f"{task.env_id}:{task.version}")
|
|
218
|
+
|
|
216
219
|
async def instances(
|
|
217
220
|
self, status: Optional[str] = None, region: Optional[str] = None
|
|
218
221
|
) -> List[AsyncEnv]:
|
|
@@ -247,6 +250,50 @@ class AsyncFleet:
|
|
|
247
250
|
async def delete(self, instance_id: str) -> InstanceResponse:
|
|
248
251
|
return await _delete_instance(self.client, instance_id)
|
|
249
252
|
|
|
253
|
+
async def load_tasks_from_file(self, filename: str) -> List[Task]:
|
|
254
|
+
with open(filename, 'r', encoding='utf-8') as f:
|
|
255
|
+
tasks_data = f.read()
|
|
256
|
+
|
|
257
|
+
return self.load_task_array_from_string(tasks_data)
|
|
258
|
+
|
|
259
|
+
async def load_task_array_from_string(self, serialized_tasks: List[Dict]) -> List[Task]:
|
|
260
|
+
tasks = []
|
|
261
|
+
|
|
262
|
+
json_tasks = json.loads(serialized_tasks)
|
|
263
|
+
for json_task in json_tasks:
|
|
264
|
+
parsed_task = self.load_task_from_json(json_task)
|
|
265
|
+
tasks.append(parsed_task)
|
|
266
|
+
return tasks
|
|
267
|
+
|
|
268
|
+
async def load_task_from_string(self, task_string: str) -> Task:
|
|
269
|
+
task_json = json.loads(task_string)
|
|
270
|
+
return self.load_task_from_json(task_json)
|
|
271
|
+
|
|
272
|
+
async def load_task_from_json(self, task_json: Dict) -> Task:
|
|
273
|
+
try:
|
|
274
|
+
if 'verifier_id' in task_json and task_json['verifier_id']:
|
|
275
|
+
verifier = self._create_verifier_from_data(
|
|
276
|
+
verifier_id=task_json['verifier_id'],
|
|
277
|
+
verifier_key=task_json['key'],
|
|
278
|
+
verifier_code=task_json['verifier_func'],
|
|
279
|
+
verifier_sha=task_json.get('verifier_sha', '')
|
|
280
|
+
)
|
|
281
|
+
except Exception as e:
|
|
282
|
+
logger.warning(f"Failed to create verifier {task_json['key']}: {e}")
|
|
283
|
+
|
|
284
|
+
task = Task(
|
|
285
|
+
key=task_json['key'],
|
|
286
|
+
prompt=task_json['prompt'],
|
|
287
|
+
env_id=task_json['env_id'], # Use env_id from the data
|
|
288
|
+
created_at=task_json['created_at'],
|
|
289
|
+
version=task_json.get('version'),
|
|
290
|
+
env_variables=task_json.get('env_variables', {}),
|
|
291
|
+
verifier_func=task_json.get('verifier_func'), # Set verifier code
|
|
292
|
+
verifier=verifier, # Use created verifier or None
|
|
293
|
+
metadata=task_json.get('metadata', {}) # Default empty metadata
|
|
294
|
+
)
|
|
295
|
+
return task
|
|
296
|
+
|
|
250
297
|
async def load_tasks(self, env_key: Optional[str] = None) -> List[Task]:
|
|
251
298
|
"""Load tasks for the authenticated team, optionally filtered by environment.
|
|
252
299
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from ..client import AsyncFleet, AsyncEnv
|
|
1
|
+
from ..client import AsyncFleet, AsyncEnv, Task
|
|
2
2
|
from ...models import Environment as EnvironmentModel, AccountResponse
|
|
3
3
|
from typing import List, Optional
|
|
4
4
|
|
|
@@ -6,6 +6,8 @@ from typing import List, Optional
|
|
|
6
6
|
async def make_async(env_key: str, region: Optional[str] = None) -> AsyncEnv:
|
|
7
7
|
return await AsyncFleet().make(env_key, region=region)
|
|
8
8
|
|
|
9
|
+
async def make_for_task_async(task: Task) -> AsyncEnv:
|
|
10
|
+
return await AsyncFleet().make_for_task(task)
|
|
9
11
|
|
|
10
12
|
async def list_envs_async() -> List[EnvironmentModel]:
|
|
11
13
|
return await AsyncFleet().list_envs()
|
|
@@ -24,6 +24,8 @@ class Task(BaseModel):
|
|
|
24
24
|
version: Optional[str] = Field(None, description="Task version")
|
|
25
25
|
verifier_func: Optional[str] = Field(None, description="Verifier function code")
|
|
26
26
|
verifier: Optional[Any] = Field(None, description="Verifier function with decorator (async or sync)")
|
|
27
|
+
verifier_id: Optional[str] = Field(None, description="Verifier identifier")
|
|
28
|
+
verifier_sha: Optional[str] = Field(None, description="Verifier SHA256 hash")
|
|
27
29
|
metadata: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Additional task metadata")
|
|
28
30
|
|
|
29
31
|
@validator('key')
|
|
@@ -213,6 +213,9 @@ class Fleet:
|
|
|
213
213
|
instance.instance.load()
|
|
214
214
|
return instance
|
|
215
215
|
|
|
216
|
+
def make_for_task(self, task: Task) -> SyncEnv:
|
|
217
|
+
return self.make(env_key=f"{task.env_id}:{task.version}")
|
|
218
|
+
|
|
216
219
|
def instances(
|
|
217
220
|
self, status: Optional[str] = None, region: Optional[str] = None
|
|
218
221
|
) -> List[SyncEnv]:
|
|
@@ -246,8 +249,54 @@ class Fleet:
|
|
|
246
249
|
|
|
247
250
|
def delete(self, instance_id: str) -> InstanceResponse:
|
|
248
251
|
return _delete_instance(self.client, instance_id)
|
|
252
|
+
|
|
253
|
+
def load_tasks_from_file(self, filename: str) -> List[Task]:
|
|
254
|
+
with open(filename, 'r', encoding='utf-8') as f:
|
|
255
|
+
tasks_data = f.read()
|
|
256
|
+
|
|
257
|
+
return self.load_task_array_from_string(tasks_data)
|
|
258
|
+
|
|
259
|
+
def load_task_array_from_string(self, serialized_tasks: List[Dict]) -> List[Task]:
|
|
260
|
+
tasks = []
|
|
261
|
+
|
|
262
|
+
json_tasks = json.loads(serialized_tasks)
|
|
263
|
+
for json_task in json_tasks:
|
|
264
|
+
parsed_task = self.load_task_from_json(json_task)
|
|
265
|
+
tasks.append(parsed_task)
|
|
266
|
+
return tasks
|
|
267
|
+
|
|
268
|
+
def load_task_from_string(self, task_string: str) -> Task:
|
|
269
|
+
task_json = json.loads(task_string)
|
|
270
|
+
return self.load_task_from_json(task_json)
|
|
271
|
+
|
|
272
|
+
def load_task_from_json(self, task_json: Dict) -> Task:
|
|
273
|
+
verifier = None
|
|
274
|
+
try:
|
|
275
|
+
if 'verifier_id' in task_json and task_json['verifier_id']:
|
|
276
|
+
verifier = self._create_verifier_from_data(
|
|
277
|
+
verifier_id=task_json['verifier_id'],
|
|
278
|
+
verifier_key=task_json['key'],
|
|
279
|
+
verifier_code=task_json['verifier_func'],
|
|
280
|
+
verifier_sha=task_json.get('verifier_sha', '')
|
|
281
|
+
)
|
|
282
|
+
except Exception as e:
|
|
283
|
+
logger.warning(f"Failed to create verifier {task_json['key']}: {e}")
|
|
284
|
+
|
|
285
|
+
task = Task(
|
|
286
|
+
key=task_json['key'],
|
|
287
|
+
prompt=task_json['prompt'],
|
|
288
|
+
env_id=task_json['env_id'], # Use env_id from the data
|
|
289
|
+
created_at=task_json['created_at'],
|
|
290
|
+
version=task_json.get('version'),
|
|
291
|
+
env_variables=task_json.get('env_variables', {}),
|
|
292
|
+
verifier_func=task_json.get('verifier_func'), # Set verifier code
|
|
293
|
+
verifier=verifier, # Use created verifier or None
|
|
294
|
+
metadata=task_json.get('metadata', {}) # Default empty metadata
|
|
295
|
+
)
|
|
296
|
+
return task
|
|
249
297
|
|
|
250
|
-
|
|
298
|
+
|
|
299
|
+
def load_tasks(self, env_key: Optional[str] = None, task_keys: Optional[List[str]] = None) -> List[Task]:
|
|
251
300
|
"""Load tasks for the authenticated team, optionally filtered by environment.
|
|
252
301
|
|
|
253
302
|
Args:
|
|
@@ -259,6 +308,9 @@ class Fleet:
|
|
|
259
308
|
params = {}
|
|
260
309
|
if env_key is not None:
|
|
261
310
|
params["env_key"] = env_key
|
|
311
|
+
|
|
312
|
+
if task_keys is not None:
|
|
313
|
+
params["task_keys"] = task_keys
|
|
262
314
|
|
|
263
315
|
response = self.client.request("GET", "/v1/tasks", params=params)
|
|
264
316
|
task_list_response = TaskListResponse(**response.json())
|
|
@@ -294,6 +346,8 @@ class Fleet:
|
|
|
294
346
|
env_variables=task_response.env_variables or {},
|
|
295
347
|
verifier_func=verifier_func, # Set verifier code
|
|
296
348
|
verifier=verifier, # Use created verifier or None
|
|
349
|
+
verifier_id=task_response.verifier.verifier_id,
|
|
350
|
+
verifier_sha=task_response.verifier.sha256,
|
|
297
351
|
metadata={} # Default empty metadata
|
|
298
352
|
)
|
|
299
353
|
tasks.append(task)
|
|
@@ -371,7 +425,6 @@ class Fleet:
|
|
|
371
425
|
logger.error(f"Failed to import task {task.key}: {e}")
|
|
372
426
|
continue
|
|
373
427
|
|
|
374
|
-
|
|
375
428
|
def account(self) -> AccountResponse:
|
|
376
429
|
"""Get account information including instance limits and usage.
|
|
377
430
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Fleet env module - convenience functions for environment management."""
|
|
2
2
|
|
|
3
|
-
from .client import make, list_envs, list_regions, get, list_instances, account
|
|
3
|
+
from .client import make, make_for_task, list_envs, list_regions, get, list_instances, account
|
|
4
4
|
|
|
5
5
|
# Import async versions from _async
|
|
6
6
|
from .._async.env.client import (
|
|
@@ -14,6 +14,7 @@ from .._async.env.client import (
|
|
|
14
14
|
|
|
15
15
|
__all__ = [
|
|
16
16
|
"make",
|
|
17
|
+
"make_for_task",
|
|
17
18
|
"list_envs",
|
|
18
19
|
"list_regions",
|
|
19
20
|
"list_instances",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from ..client import Fleet, SyncEnv
|
|
1
|
+
from ..client import Fleet, SyncEnv, Task
|
|
2
2
|
from ..models import Environment as EnvironmentModel, AccountResponse
|
|
3
3
|
from typing import List, Optional
|
|
4
4
|
|
|
@@ -6,11 +6,12 @@ from typing import List, Optional
|
|
|
6
6
|
def make(env_key: str, region: Optional[str] = None) -> SyncEnv:
|
|
7
7
|
return Fleet().make(env_key, region=region)
|
|
8
8
|
|
|
9
|
+
def make_for_task(task: Task) -> SyncEnv:
|
|
10
|
+
return Fleet().make_for_task(task)
|
|
9
11
|
|
|
10
12
|
def list_envs() -> List[EnvironmentModel]:
|
|
11
13
|
return Fleet().list_envs()
|
|
12
14
|
|
|
13
|
-
|
|
14
15
|
def list_regions() -> List[str]:
|
|
15
16
|
return Fleet().list_regions()
|
|
16
17
|
|
|
@@ -24,6 +24,8 @@ class Task(BaseModel):
|
|
|
24
24
|
version: Optional[str] = Field(None, description="Task version")
|
|
25
25
|
verifier_func: Optional[str] = Field(None, description="Verifier function code")
|
|
26
26
|
verifier: Optional[Any] = Field(None, description="Verifier function with decorator (async or sync)")
|
|
27
|
+
verifier_id: Optional[str] = Field(None, description="Verifier identifier")
|
|
28
|
+
verifier_sha: Optional[str] = Field(None, description="Verifier SHA256 hash")
|
|
27
29
|
metadata: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Additional task metadata")
|
|
28
30
|
|
|
29
31
|
@validator('key')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|