fleet-python 0.2.51__tar.gz → 0.2.53__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 (81) hide show
  1. {fleet_python-0.2.51 → fleet_python-0.2.53}/PKG-INFO +1 -1
  2. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/__init__.py +7 -2
  3. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/client.py +38 -9
  4. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/client.py +27 -13
  5. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet_python.egg-info/PKG-INFO +1 -1
  6. {fleet_python-0.2.51 → fleet_python-0.2.53}/pyproject.toml +1 -1
  7. {fleet_python-0.2.51 → fleet_python-0.2.53}/LICENSE +0 -0
  8. {fleet_python-0.2.51 → fleet_python-0.2.53}/README.md +0 -0
  9. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/diff_example.py +0 -0
  10. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/dsl_example.py +0 -0
  11. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example.py +0 -0
  12. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/exampleResume.py +0 -0
  13. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_account.py +0 -0
  14. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_action_log.py +0 -0
  15. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_client.py +0 -0
  16. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_mcp_anthropic.py +0 -0
  17. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_mcp_openai.py +0 -0
  18. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_sync.py +0 -0
  19. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_task.py +0 -0
  20. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_tasks.py +0 -0
  21. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/example_verifier.py +0 -0
  22. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/gemini_example.py +0 -0
  23. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/json_tasks_example.py +0 -0
  24. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/nova_act_example.py +0 -0
  25. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/openai_example.py +0 -0
  26. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/openai_simple_example.py +0 -0
  27. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/query_builder_example.py +0 -0
  28. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/quickstart.py +0 -0
  29. {fleet_python-0.2.51 → fleet_python-0.2.53}/examples/test_cdp_logging.py +0 -0
  30. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/__init__.py +0 -0
  31. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/base.py +0 -0
  32. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/env/__init__.py +0 -0
  33. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/env/client.py +0 -0
  34. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/exceptions.py +0 -0
  35. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/global_client.py +0 -0
  36. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/instance/__init__.py +0 -0
  37. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/instance/base.py +0 -0
  38. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/instance/client.py +0 -0
  39. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/models.py +0 -0
  40. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/resources/__init__.py +0 -0
  41. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/resources/base.py +0 -0
  42. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/resources/browser.py +0 -0
  43. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/resources/mcp.py +0 -0
  44. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/resources/sqlite.py +0 -0
  45. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/tasks.py +0 -0
  46. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/verifiers/__init__.py +0 -0
  47. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/verifiers/bundler.py +0 -0
  48. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/_async/verifiers/verifier.py +0 -0
  49. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/base.py +0 -0
  50. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/config.py +0 -0
  51. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/env/__init__.py +0 -0
  52. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/env/client.py +0 -0
  53. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/exceptions.py +0 -0
  54. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/global_client.py +0 -0
  55. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/instance/__init__.py +0 -0
  56. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/instance/base.py +0 -0
  57. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/instance/client.py +0 -0
  58. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/instance/models.py +0 -0
  59. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/models.py +0 -0
  60. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/resources/__init__.py +0 -0
  61. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/resources/base.py +0 -0
  62. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/resources/browser.py +0 -0
  63. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/resources/mcp.py +0 -0
  64. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/resources/sqlite.py +0 -0
  65. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/tasks.py +0 -0
  66. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/types.py +0 -0
  67. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/__init__.py +0 -0
  68. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/bundler.py +0 -0
  69. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/code.py +0 -0
  70. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/db.py +0 -0
  71. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/decorator.py +0 -0
  72. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/parse.py +0 -0
  73. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/sql_differ.py +0 -0
  74. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet/verifiers/verifier.py +0 -0
  75. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet_python.egg-info/SOURCES.txt +0 -0
  76. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet_python.egg-info/dependency_links.txt +0 -0
  77. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet_python.egg-info/requires.txt +0 -0
  78. {fleet_python-0.2.51 → fleet_python-0.2.53}/fleet_python.egg-info/top_level.txt +0 -0
  79. {fleet_python-0.2.51 → fleet_python-0.2.53}/scripts/fix_sync_imports.py +0 -0
  80. {fleet_python-0.2.51 → fleet_python-0.2.53}/scripts/unasync.py +0 -0
  81. {fleet_python-0.2.51 → fleet_python-0.2.53}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.51
3
+ Version: 0.2.53
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -193,13 +193,18 @@ async def export_tasks(
193
193
  return await _async_global_client.get_client().export_tasks(env_key, filename)
194
194
 
195
195
 
196
- async def import_tasks(filename: str):
196
+ async def import_tasks(filename: str, project_key: Optional[str] = None):
197
197
  """Import tasks from a JSON file.
198
198
 
199
+ Args:
200
+ filename: Path to the JSON file of Task objects to import
201
+ project_key: Optional project key to associate with the tasks
202
+
199
203
  Example:
200
204
  await fleet.import_tasks("tasks.json")
205
+ await fleet.import_tasks("tasks.json", project_key="my-project")
201
206
  """
202
- return await _async_global_client.get_client().import_tasks(filename)
207
+ return await _async_global_client.get_client().import_tasks(filename, project_key)
203
208
 
204
209
 
205
210
  async def account() -> AccountResponse:
@@ -560,11 +560,34 @@ class AsyncFleet:
560
560
  logger.info("No tasks found to export")
561
561
  return None
562
562
 
563
- async def import_tasks(self, filename: str):
563
+ async def import_single_task(self, task: Task, project_key: Optional[str] = None):
564
+ """Import a single task.
565
+
566
+ Args:
567
+ task: Task object to import
568
+ project_key: Optional project key to associate with the task
569
+
570
+ Returns:
571
+ Response from the API, or None if the import failed
572
+ """
573
+ try:
574
+ params = {}
575
+ if project_key:
576
+ params["project_key"] = project_key
577
+ response = await self.client.request(
578
+ "POST", "/v1/tasks", json=task.model_dump(), params=params
579
+ )
580
+ return response
581
+ except Exception as e:
582
+ logger.error(f"Failed to import task {task.key}: {e}")
583
+ return None
584
+
585
+ async def import_tasks(self, filename: str, project_key: Optional[str] = None):
564
586
  """Import tasks from a JSON file.
565
587
 
566
588
  Args:
567
589
  filename: Path to the JSON file of Task objects to import
590
+ project_key: Optional project key to associate with the tasks
568
591
 
569
592
  Returns:
570
593
  List[Task] containing imported Task objects
@@ -578,14 +601,20 @@ class AsyncFleet:
578
601
  task = Task(**task_data)
579
602
  tasks.append(task)
580
603
 
581
- for task in tasks:
582
- try:
583
- response = await self.client.request(
584
- "POST", "/v1/tasks", json=task.model_dump()
585
- )
586
- except Exception as e:
587
- logger.error(f"Failed to import task {task.key}: {e}")
588
- continue
604
+ # Use semaphore to limit concurrency to 20
605
+ semaphore = asyncio.Semaphore(20)
606
+
607
+ async def import_with_semaphore(task):
608
+ async with semaphore:
609
+ return await self.import_single_task(task, project_key)
610
+
611
+ # Use asyncio.gather to parallelize the imports
612
+ responses = await asyncio.gather(
613
+ *[import_with_semaphore(task) for task in tasks]
614
+ )
615
+
616
+ # Filter out None values (failed imports)
617
+ return [r for r in responses if r is not None]
589
618
 
590
619
  async def account(self) -> AccountResponse:
591
620
  """Get account information including instance limits and usage.
@@ -566,11 +566,32 @@ class Fleet:
566
566
  logger.info("No tasks found to export")
567
567
  return None
568
568
 
569
- def import_tasks(self, filename: str):
569
+ def import_single_task(self, task: Task, project_key: Optional[str] = None):
570
+ """Import a single task.
571
+
572
+ Args:
573
+ task: Task object to import
574
+ project_key: Optional project key to associate with the task
575
+
576
+ Returns:
577
+ Response from the API, or None if the import failed
578
+ """
579
+ try:
580
+ params = {}
581
+ if project_key:
582
+ params["project_key"] = project_key
583
+ response = self.client.request("POST", "/v1/tasks", json=task.model_dump(), params=params)
584
+ return response
585
+ except Exception as e:
586
+ logger.error(f"Failed to import task {task.key}: {e}")
587
+ return None
588
+
589
+ def import_tasks(self, filename: str, project_key: Optional[str] = None):
570
590
  """Import tasks from a JSON file.
571
591
 
572
592
  Args:
573
593
  filename: Path to the JSON file of Task objects to import
594
+ project_key: Optional project key to associate with the tasks
574
595
 
575
596
  Returns:
576
597
  List[Task] containing imported Task objects
@@ -584,19 +605,12 @@ class Fleet:
584
605
  task = Task(**task_data)
585
606
  tasks.append(task)
586
607
 
587
- responses = []
588
-
589
- for task in tasks:
590
- try:
591
- response = self.client.request(
592
- "POST", "/v1/tasks", json=task.model_dump()
593
- )
594
- responses.append(response)
595
- except Exception as e:
596
- logger.error(f"Failed to import task {task.key}: {e}")
597
- continue
608
+ # Use ThreadPoolExecutor to parallelize the imports with max 20 workers
609
+ with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
610
+ responses = list(executor.map(lambda t: self.import_single_task(t, project_key), tasks))
598
611
 
599
- return responses
612
+ # Filter out None values (failed imports)
613
+ return [r for r in responses if r is not None]
600
614
 
601
615
  def account(self) -> AccountResponse:
602
616
  """Get account information including instance limits and usage.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.51
3
+ Version: 0.2.53
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fleet-python"
7
- version = "0.2.51"
7
+ version = "0.2.53"
8
8
  description = "Python SDK for Fleet environments"
9
9
  authors = [
10
10
  {name = "Fleet AI", email = "nic@fleet.so"},
File without changes
File without changes
File without changes