fleet-python 0.2.54__tar.gz → 0.2.55__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.

Files changed (84) hide show
  1. {fleet_python-0.2.54 → fleet_python-0.2.55}/PKG-INFO +1 -1
  2. fleet_python-0.2.55/examples/export_tasks.py +76 -0
  3. fleet_python-0.2.55/examples/import_tasks.py +102 -0
  4. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/client.py +21 -0
  5. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/tasks.py +19 -0
  6. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/client.py +21 -0
  7. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/tasks.py +22 -3
  8. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet_python.egg-info/PKG-INFO +1 -1
  9. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet_python.egg-info/SOURCES.txt +1 -0
  10. {fleet_python-0.2.54 → fleet_python-0.2.55}/pyproject.toml +1 -1
  11. fleet_python-0.2.54/examples/import_tasks.py +0 -16
  12. {fleet_python-0.2.54 → fleet_python-0.2.55}/LICENSE +0 -0
  13. {fleet_python-0.2.54 → fleet_python-0.2.55}/README.md +0 -0
  14. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/diff_example.py +0 -0
  15. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/dsl_example.py +0 -0
  16. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example.py +0 -0
  17. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/exampleResume.py +0 -0
  18. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_account.py +0 -0
  19. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_action_log.py +0 -0
  20. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_client.py +0 -0
  21. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_mcp_anthropic.py +0 -0
  22. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_mcp_openai.py +0 -0
  23. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_sync.py +0 -0
  24. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_task.py +0 -0
  25. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_tasks.py +0 -0
  26. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/example_verifier.py +0 -0
  27. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/gemini_example.py +0 -0
  28. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/json_tasks_example.py +0 -0
  29. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/nova_act_example.py +0 -0
  30. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/openai_example.py +0 -0
  31. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/openai_simple_example.py +0 -0
  32. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/query_builder_example.py +0 -0
  33. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/quickstart.py +0 -0
  34. {fleet_python-0.2.54 → fleet_python-0.2.55}/examples/test_cdp_logging.py +0 -0
  35. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/__init__.py +0 -0
  36. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/__init__.py +0 -0
  37. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/base.py +0 -0
  38. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/env/__init__.py +0 -0
  39. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/env/client.py +0 -0
  40. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/exceptions.py +0 -0
  41. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/global_client.py +0 -0
  42. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/instance/__init__.py +0 -0
  43. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/instance/base.py +0 -0
  44. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/instance/client.py +0 -0
  45. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/models.py +0 -0
  46. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/resources/__init__.py +0 -0
  47. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/resources/base.py +0 -0
  48. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/resources/browser.py +0 -0
  49. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/resources/mcp.py +0 -0
  50. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/resources/sqlite.py +0 -0
  51. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/verifiers/__init__.py +0 -0
  52. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/verifiers/bundler.py +0 -0
  53. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/_async/verifiers/verifier.py +0 -0
  54. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/base.py +0 -0
  55. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/config.py +0 -0
  56. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/env/__init__.py +0 -0
  57. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/env/client.py +0 -0
  58. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/exceptions.py +0 -0
  59. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/global_client.py +0 -0
  60. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/instance/__init__.py +0 -0
  61. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/instance/base.py +0 -0
  62. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/instance/client.py +0 -0
  63. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/instance/models.py +0 -0
  64. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/models.py +0 -0
  65. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/resources/__init__.py +0 -0
  66. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/resources/base.py +0 -0
  67. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/resources/browser.py +0 -0
  68. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/resources/mcp.py +0 -0
  69. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/resources/sqlite.py +0 -0
  70. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/types.py +0 -0
  71. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/__init__.py +0 -0
  72. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/bundler.py +0 -0
  73. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/code.py +0 -0
  74. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/db.py +0 -0
  75. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/decorator.py +0 -0
  76. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/parse.py +0 -0
  77. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/sql_differ.py +0 -0
  78. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet/verifiers/verifier.py +0 -0
  79. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet_python.egg-info/dependency_links.txt +0 -0
  80. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet_python.egg-info/requires.txt +0 -0
  81. {fleet_python-0.2.54 → fleet_python-0.2.55}/fleet_python.egg-info/top_level.txt +0 -0
  82. {fleet_python-0.2.54 → fleet_python-0.2.55}/scripts/fix_sync_imports.py +0 -0
  83. {fleet_python-0.2.54 → fleet_python-0.2.55}/scripts/unasync.py +0 -0
  84. {fleet_python-0.2.54 → fleet_python-0.2.55}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.54
3
+ Version: 0.2.55
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -0,0 +1,76 @@
1
+ import argparse
2
+ import json
3
+ import fleet
4
+ from dotenv import load_dotenv
5
+
6
+ load_dotenv()
7
+
8
+
9
+ def main():
10
+ parser = argparse.ArgumentParser(description="Export tasks to a JSON file")
11
+ parser.add_argument(
12
+ "--project-key",
13
+ "-p",
14
+ help="Optional project key to filter tasks",
15
+ default=None,
16
+ )
17
+ parser.add_argument(
18
+ "--output",
19
+ "-o",
20
+ help="Output JSON filename (defaults to {team_id}.json)",
21
+ default=None,
22
+ )
23
+
24
+ args = parser.parse_args()
25
+
26
+ # Get account info
27
+ account = fleet.env.account()
28
+ print(f"Exporting from team: {account.team_name}")
29
+
30
+ # Load tasks
31
+ if args.project_key:
32
+ print(f"Loading tasks from project: {args.project_key}")
33
+ tasks = fleet.load_tasks(project_key=args.project_key)
34
+ else:
35
+ print("Loading all tasks")
36
+ tasks = fleet.load_tasks()
37
+
38
+ print(f"\nFound {len(tasks)} task(s)")
39
+
40
+ # Validate that all tasks have verifier_func
41
+ print("Validating tasks have verifier_func...")
42
+ missing_verifier = []
43
+ for task in tasks:
44
+ if not task.verifier_func:
45
+ missing_verifier.append(task.key)
46
+
47
+ if missing_verifier:
48
+ print(f"\n✗ Error: {len(missing_verifier)} task(s) missing verifier_func:")
49
+ for key in missing_verifier[:10]: # Show first 10
50
+ print(f" - {key}")
51
+ if len(missing_verifier) > 10:
52
+ print(f" ... and {len(missing_verifier) - 10} more")
53
+ raise ValueError(
54
+ "All tasks must have a verifier_func. Cannot export tasks without verifiers."
55
+ )
56
+
57
+ print("✓ All tasks have verifier_func")
58
+
59
+ # Determine output filename
60
+ output_file = args.output or f"{account.team_id}.json"
61
+
62
+ # Export to JSON
63
+ print(f"\nExporting to: {output_file}")
64
+ with open(output_file, "w", encoding="utf-8") as f:
65
+ json.dump(
66
+ [task.model_dump() for task in tasks],
67
+ f,
68
+ indent=2,
69
+ ensure_ascii=False,
70
+ )
71
+
72
+ print(f"✓ Successfully exported {len(tasks)} task(s) to {output_file}")
73
+
74
+
75
+ if __name__ == "__main__":
76
+ main()
@@ -0,0 +1,102 @@
1
+ import asyncio
2
+ import argparse
3
+ import json
4
+ import sys
5
+ import fleet
6
+ from dotenv import load_dotenv
7
+
8
+ load_dotenv()
9
+
10
+
11
+ async def main():
12
+ parser = argparse.ArgumentParser(description="Import tasks from a JSON file")
13
+ parser.add_argument("json_file", help="Path to the JSON file containing tasks")
14
+ parser.add_argument(
15
+ "--project-key",
16
+ "-p",
17
+ help="Optional project key to associate with the tasks",
18
+ default=None,
19
+ )
20
+ parser.add_argument(
21
+ "--yes",
22
+ "-y",
23
+ action="store_true",
24
+ help="Skip confirmation prompt and import automatically",
25
+ )
26
+
27
+ args = parser.parse_args()
28
+
29
+ # Load and parse the JSON file
30
+ try:
31
+ with open(args.json_file, "r", encoding="utf-8") as f:
32
+ tasks_data = json.load(f)
33
+ except FileNotFoundError:
34
+ print(f"Error: File '{args.json_file}' not found")
35
+ sys.exit(1)
36
+ except json.JSONDecodeError as e:
37
+ print(f"Error: Invalid JSON in '{args.json_file}': {e}")
38
+ sys.exit(1)
39
+
40
+ # Extract task information and validate verifier_func
41
+ task_count = len(tasks_data)
42
+ task_keys = []
43
+ missing_verifier = []
44
+ for task_data in tasks_data:
45
+ task_key = task_data.get("key") or task_data.get("id")
46
+ if task_key:
47
+ task_keys.append(task_key)
48
+ else:
49
+ task_keys.append("(no key)")
50
+
51
+ # Check for verifier_func
52
+ verifier_code = task_data.get("verifier_func") or task_data.get("verifier_code")
53
+ if not verifier_code:
54
+ missing_verifier.append(task_key or "(no key)")
55
+
56
+ # Validate all tasks have verifier_func
57
+ if missing_verifier:
58
+ print(f"✗ Error: {len(missing_verifier)} task(s) missing verifier_func:")
59
+ for key in missing_verifier[:10]: # Show first 10
60
+ print(f" - {key}")
61
+ if len(missing_verifier) > 10:
62
+ print(f" ... and {len(missing_verifier) - 10} more")
63
+ print("\nAll tasks must have a verifier_func to be imported.")
64
+ sys.exit(1)
65
+
66
+ # Get account info
67
+ account = await fleet.env.account_async()
68
+
69
+ # Print summary
70
+ print(f"Importing to team: {account.team_name}")
71
+ print(f"\nFound {task_count} task(s) in '{args.json_file}':")
72
+ print("\nTask keys:")
73
+ for i, key in enumerate(task_keys, 1):
74
+ print(f" {i}. {key}")
75
+
76
+ if args.project_key:
77
+ print(f"\nProject key: {args.project_key}")
78
+ else:
79
+ print("\nProject key: (none)")
80
+
81
+ # Confirmation prompt (unless --yes flag is provided)
82
+ if not args.yes:
83
+ print("\n" + "=" * 60)
84
+ response = input("Type 'YES' to proceed with import: ")
85
+ if response != "YES":
86
+ print("Import cancelled.")
87
+ sys.exit(0)
88
+
89
+ # Import tasks
90
+ print("\nImporting tasks...")
91
+ try:
92
+ results = await fleet.import_tasks_async(
93
+ args.json_file, project_key=args.project_key
94
+ )
95
+ print(f"\n✓ Successfully imported {len(results)} task(s)")
96
+ except Exception as e:
97
+ print(f"\n✗ Error importing tasks: {e}")
98
+ sys.exit(1)
99
+
100
+
101
+ if __name__ == "__main__":
102
+ asyncio.run(main())
@@ -372,6 +372,8 @@ class AsyncFleet:
372
372
  ), # Use env_id or fallback to env_key
373
373
  created_at=task_json.get("created_at"),
374
374
  version=task_json.get("version"),
375
+ data_id=task_json.get("data_id"),
376
+ data_version=task_json.get("data_version"),
375
377
  env_variables=task_json.get("env_variables", {}),
376
378
  verifier_func=verifier_code, # Set verifier code
377
379
  verifier=verifier, # Use created verifier or None
@@ -386,6 +388,8 @@ class AsyncFleet:
386
388
  version: Optional[str] = None,
387
389
  team_id: Optional[str] = None,
388
390
  project_key: Optional[str] = None,
391
+ data_id: Optional[str] = None,
392
+ data_version: Optional[str] = None,
389
393
  ) -> List[Task]:
390
394
  """Load tasks for the authenticated team, with optional filtering.
391
395
 
@@ -394,6 +398,9 @@ class AsyncFleet:
394
398
  keys: Optional list of task keys to filter by
395
399
  version: Optional version to filter tasks by (client-side filter)
396
400
  team_id: Optional team_id to filter by (admin only)
401
+ project_key: Optional project key to filter tasks by
402
+ data_id: Optional data identifier to filter tasks by
403
+ data_version: Optional data version to filter tasks by
397
404
 
398
405
  Returns:
399
406
  List[Task] containing Task objects
@@ -407,6 +414,10 @@ class AsyncFleet:
407
414
  params["team_id"] = team_id
408
415
  if project_key is not None:
409
416
  params["project_key"] = project_key
417
+ if data_id is not None:
418
+ params["data_id"] = data_id
419
+ if data_version is not None:
420
+ params["data_version"] = data_version
410
421
 
411
422
  response = await self.client.request("GET", "/v1/tasks", params=params)
412
423
  task_list_response = TaskListResponse(**response.json())
@@ -511,6 +522,8 @@ class AsyncFleet:
511
522
  env_id=task_response.environment_id, # Map environment_id -> env_id
512
523
  created_at=task_response.created_at,
513
524
  version=task_response.version,
525
+ data_id=getattr(task_response, "data_id", None), # Get data_id if available
526
+ data_version=getattr(task_response, "data_version", None), # Get data_version if available
514
527
  env_variables=task_response.env_variables or {},
515
528
  verifier_func=verifier_func, # Set verifier code
516
529
  verifier=verifier, # Use created verifier or None
@@ -521,6 +534,14 @@ class AsyncFleet:
521
534
  # Apply client-side filtering for version if specified
522
535
  if version is not None:
523
536
  tasks = [task for task in tasks if task.version == version]
537
+
538
+ # Apply client-side filtering for data_id if specified
539
+ if data_id is not None:
540
+ tasks = [task for task in tasks if task.data_id == data_id]
541
+
542
+ # Apply client-side filtering for data_version if specified
543
+ if data_version is not None:
544
+ tasks = [task for task in tasks if task.data_version == data_version]
524
545
 
525
546
  return tasks
526
547
 
@@ -25,6 +25,8 @@ class Task(BaseModel):
25
25
  )
26
26
  created_at: Optional[datetime] = Field(None, description="Task creation timestamp")
27
27
  version: Optional[str] = Field(None, description="Task version")
28
+ data_id: Optional[str] = Field(None, description="Data identifier")
29
+ data_version: Optional[str] = Field(None, description="Data version")
28
30
  verifier_func: Optional[str] = Field(None, description="Verifier function code")
29
31
  verifier: Optional[Any] = Field(
30
32
  None,
@@ -58,6 +60,15 @@ class Task(BaseModel):
58
60
  return f"{self.env_id}:{self.version}"
59
61
  return self.env_id
60
62
 
63
+ @property
64
+ def data_key(self) -> Optional[str]:
65
+ """Get the data key combining data_id and data_version."""
66
+ if self.data_id and self.data_version:
67
+ return f"{self.data_id}:{self.data_version}"
68
+ elif self.data_id:
69
+ return self.data_id
70
+ return None
71
+
61
72
  class Config:
62
73
  """Pydantic model configuration."""
63
74
 
@@ -282,6 +293,8 @@ async def load_tasks(
282
293
  version: Optional[str] = None,
283
294
  team_id: Optional[str] = None,
284
295
  project_key: Optional[str] = None,
296
+ data_id: Optional[str] = None,
297
+ data_version: Optional[str] = None,
285
298
  ) -> List[Task]:
286
299
  """Convenience function to load tasks with optional filtering.
287
300
 
@@ -290,11 +303,15 @@ async def load_tasks(
290
303
  keys: Optional list of task keys to filter by
291
304
  version: Optional version to filter tasks by
292
305
  team_id: Optional team_id to filter by (admin only)
306
+ project_key: Optional project key to filter tasks by
307
+ data_id: Optional data identifier to filter tasks by
308
+ data_version: Optional data version to filter tasks by
293
309
 
294
310
  Examples:
295
311
  tasks = await fleet.load_tasks(env_key="fira")
296
312
  tasks = await fleet.load_tasks(keys=["task1", "task2"])
297
313
  tasks = await fleet.load_tasks(env_key="fira", version="v1.0")
314
+ tasks = await fleet.load_tasks(data_id="my-data", data_version="v1.0")
298
315
  """
299
316
  # Use the global client by default so users can pre-configure it once
300
317
  from .global_client import get_client
@@ -306,6 +323,8 @@ async def load_tasks(
306
323
  version=version,
307
324
  team_id=team_id,
308
325
  project_key=project_key,
326
+ data_id=data_id,
327
+ data_version=data_version,
309
328
  )
310
329
 
311
330
 
@@ -370,6 +370,8 @@ class Fleet:
370
370
  ), # Use env_id or fallback to env_key
371
371
  created_at=task_json.get("created_at"),
372
372
  version=task_json.get("version"),
373
+ data_id=task_json.get("data_id"),
374
+ data_version=task_json.get("data_version"),
373
375
  env_variables=task_json.get("env_variables", {}),
374
376
  verifier_func=verifier_code, # Set verifier code
375
377
  verifier=verifier, # Use created verifier or None
@@ -384,6 +386,8 @@ class Fleet:
384
386
  version: Optional[str] = None,
385
387
  team_id: Optional[str] = None,
386
388
  project_key: Optional[str] = None,
389
+ data_id: Optional[str] = None,
390
+ data_version: Optional[str] = None,
387
391
  ) -> List[Task]:
388
392
  """Load tasks for the authenticated team, with optional filtering.
389
393
 
@@ -392,6 +396,9 @@ class Fleet:
392
396
  keys: Optional list of task keys to filter by
393
397
  version: Optional version to filter tasks by (client-side filter)
394
398
  team_id: Optional team_id to filter by (admin only)
399
+ project_key: Optional project key to filter tasks by
400
+ data_id: Optional data identifier to filter tasks by
401
+ data_version: Optional data version to filter tasks by
395
402
 
396
403
  Returns:
397
404
  List[Task] containing Task objects
@@ -405,6 +412,10 @@ class Fleet:
405
412
  params["team_id"] = team_id
406
413
  if project_key is not None:
407
414
  params["project_key"] = project_key
415
+ if data_id is not None:
416
+ params["data_id"] = data_id
417
+ if data_version is not None:
418
+ params["data_version"] = data_version
408
419
 
409
420
  response = self.client.request("GET", "/v1/tasks", params=params)
410
421
  task_list_response = TaskListResponse(**response.json())
@@ -517,6 +528,8 @@ class Fleet:
517
528
  env_id=task_response.environment_id, # Map environment_id -> env_id
518
529
  created_at=task_response.created_at,
519
530
  version=task_response.version,
531
+ data_id=getattr(task_response, "data_id", None), # Get data_id if available
532
+ data_version=getattr(task_response, "data_version", None), # Get data_version if available
520
533
  env_variables=task_response.env_variables or {},
521
534
  verifier_func=verifier_func, # Set verifier code
522
535
  verifier=verifier, # Use created verifier or None
@@ -527,6 +540,14 @@ class Fleet:
527
540
  # Apply client-side filtering for version if specified
528
541
  if version is not None:
529
542
  tasks = [task for task in tasks if task.version == version]
543
+
544
+ # Apply client-side filtering for data_id if specified
545
+ if data_id is not None:
546
+ tasks = [task for task in tasks if task.data_id == data_id]
547
+
548
+ # Apply client-side filtering for data_version if specified
549
+ if data_version is not None:
550
+ tasks = [task for task in tasks if task.data_version == data_version]
530
551
 
531
552
  return tasks
532
553
 
@@ -26,6 +26,8 @@ class Task(BaseModel):
26
26
  )
27
27
  created_at: Optional[datetime] = Field(None, description="Task creation timestamp")
28
28
  version: Optional[str] = Field(None, description="Task version")
29
+ data_id: Optional[str] = Field(None, description="Data identifier")
30
+ data_version: Optional[str] = Field(None, description="Data version")
29
31
  verifier_func: Optional[str] = Field(None, description="Verifier function code")
30
32
  verifier: Optional[Any] = Field(
31
33
  None,
@@ -59,6 +61,15 @@ class Task(BaseModel):
59
61
  return f"{self.env_id}:{self.version}"
60
62
  return self.env_id
61
63
 
64
+ @property
65
+ def data_key(self) -> Optional[str]:
66
+ """Get the data key combining data_id and data_version."""
67
+ if self.data_id and self.data_version:
68
+ return f"{self.data_id}:{self.data_version}"
69
+ elif self.data_id:
70
+ return self.data_id
71
+ return None
72
+
62
73
  class Config:
63
74
  """Pydantic model configuration."""
64
75
 
@@ -285,6 +296,8 @@ def load_tasks(
285
296
  version: Optional[str] = None,
286
297
  team_id: Optional[str] = None,
287
298
  project_key: Optional[str] = None,
299
+ data_id: Optional[str] = None,
300
+ data_version: Optional[str] = None,
288
301
  ) -> List[Task]:
289
302
  """Convenience function to load tasks with optional filtering.
290
303
 
@@ -293,11 +306,15 @@ def load_tasks(
293
306
  keys: Optional list of task keys to filter by
294
307
  version: Optional version to filter tasks by
295
308
  team_id: Optional team_id to filter by (admin only)
309
+ project_key: Optional project key to filter tasks by
310
+ data_id: Optional data identifier to filter tasks by
311
+ data_version: Optional data version to filter tasks by
296
312
 
297
313
  Examples:
298
- tasks = await fleet.load_tasks(env_key="fira")
299
- tasks = await fleet.load_tasks(keys=["task1", "task2"])
300
- tasks = await fleet.load_tasks(env_key="fira", version="v1.0")
314
+ tasks = fleet.load_tasks(env_key="fira")
315
+ tasks = fleet.load_tasks(keys=["task1", "task2"])
316
+ tasks = fleet.load_tasks(env_key="fira", version="v1.0")
317
+ tasks = fleet.load_tasks(data_id="my-data", data_version="v1.0")
301
318
  """
302
319
  # Use the global client by default so users can pre-configure it once
303
320
  from .global_client import get_client
@@ -309,6 +326,8 @@ def load_tasks(
309
326
  version=version,
310
327
  team_id=team_id,
311
328
  project_key=project_key,
329
+ data_id=data_id,
330
+ data_version=data_version,
312
331
  )
313
332
 
314
333
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.54
3
+ Version: 0.2.55
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -14,6 +14,7 @@ examples/example_sync.py
14
14
  examples/example_task.py
15
15
  examples/example_tasks.py
16
16
  examples/example_verifier.py
17
+ examples/export_tasks.py
17
18
  examples/gemini_example.py
18
19
  examples/import_tasks.py
19
20
  examples/json_tasks_example.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fleet-python"
7
- version = "0.2.54"
7
+ version = "0.2.55"
8
8
  description = "Python SDK for Fleet environments"
9
9
  authors = [
10
10
  {name = "Fleet AI", email = "nic@fleet.so"},
@@ -1,16 +0,0 @@
1
- import asyncio
2
- import fleet
3
- from dotenv import load_dotenv
4
-
5
- load_dotenv()
6
-
7
-
8
- async def main():
9
- print(f"Importing tasks... {(await fleet.env.account_async()).team_name}")
10
- await fleet._async.import_tasks(
11
- "6bb6c6b6-36a8-4407-ba66-6908e42069c8.json", project_key="amazon"
12
- )
13
-
14
-
15
- if __name__ == "__main__":
16
- asyncio.run(main())
File without changes
File without changes
File without changes