fleet-python 0.2.34__tar.gz → 0.2.35__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.34 → fleet_python-0.2.35}/PKG-INFO +1 -1
  2. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/__init__.py +8 -10
  3. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/__init__.py +1 -28
  4. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/client.py +3 -9
  5. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/tasks.py +50 -0
  6. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/client.py +5 -17
  7. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/env/__init__.py +2 -2
  8. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/global_client.py +1 -1
  9. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/tasks.py +50 -0
  10. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet_python.egg-info/PKG-INFO +1 -1
  11. {fleet_python-0.2.34 → fleet_python-0.2.35}/pyproject.toml +1 -1
  12. {fleet_python-0.2.34 → fleet_python-0.2.35}/LICENSE +0 -0
  13. {fleet_python-0.2.34 → fleet_python-0.2.35}/README.md +0 -0
  14. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/diff_example.py +0 -0
  15. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/dsl_example.py +0 -0
  16. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example.py +0 -0
  17. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/exampleResume.py +0 -0
  18. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_account.py +0 -0
  19. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_action_log.py +0 -0
  20. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_client.py +0 -0
  21. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_mcp_anthropic.py +0 -0
  22. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_mcp_openai.py +0 -0
  23. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_sync.py +0 -0
  24. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_task.py +0 -0
  25. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_tasks.py +0 -0
  26. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/example_verifier.py +0 -0
  27. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/gemini_example.py +0 -0
  28. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/json_tasks_example.py +0 -0
  29. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/nova_act_example.py +0 -0
  30. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/openai_example.py +0 -0
  31. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/openai_simple_example.py +0 -0
  32. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/query_builder_example.py +0 -0
  33. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/quickstart.py +0 -0
  34. {fleet_python-0.2.34 → fleet_python-0.2.35}/examples/test_cdp_logging.py +0 -0
  35. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/base.py +0 -0
  36. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/env/__init__.py +0 -0
  37. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/env/client.py +0 -0
  38. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/exceptions.py +0 -0
  39. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/global_client.py +0 -0
  40. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/instance/__init__.py +0 -0
  41. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/instance/base.py +0 -0
  42. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/instance/client.py +0 -0
  43. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/models.py +0 -0
  44. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/resources/__init__.py +0 -0
  45. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/resources/base.py +0 -0
  46. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/resources/browser.py +0 -0
  47. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/resources/mcp.py +0 -0
  48. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/resources/sqlite.py +0 -0
  49. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/verifiers/__init__.py +0 -0
  50. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/verifiers/bundler.py +0 -0
  51. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/_async/verifiers/verifier.py +0 -0
  52. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/base.py +0 -0
  53. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/config.py +0 -0
  54. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/env/client.py +0 -0
  55. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/exceptions.py +0 -0
  56. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/instance/__init__.py +0 -0
  57. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/instance/base.py +0 -0
  58. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/instance/client.py +0 -0
  59. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/instance/models.py +0 -0
  60. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/models.py +0 -0
  61. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/resources/__init__.py +0 -0
  62. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/resources/base.py +0 -0
  63. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/resources/browser.py +0 -0
  64. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/resources/mcp.py +0 -0
  65. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/resources/sqlite.py +0 -0
  66. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/types.py +0 -0
  67. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/__init__.py +0 -0
  68. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/bundler.py +0 -0
  69. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/code.py +0 -0
  70. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/db.py +0 -0
  71. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/decorator.py +0 -0
  72. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/parse.py +0 -0
  73. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/sql_differ.py +0 -0
  74. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet/verifiers/verifier.py +0 -0
  75. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet_python.egg-info/SOURCES.txt +0 -0
  76. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet_python.egg-info/dependency_links.txt +0 -0
  77. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet_python.egg-info/requires.txt +0 -0
  78. {fleet_python-0.2.34 → fleet_python-0.2.35}/fleet_python.egg-info/top_level.txt +0 -0
  79. {fleet_python-0.2.34 → fleet_python-0.2.35}/scripts/fix_sync_imports.py +0 -0
  80. {fleet_python-0.2.34 → fleet_python-0.2.35}/scripts/unasync.py +0 -0
  81. {fleet_python-0.2.34 → fleet_python-0.2.35}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.34
3
+ Version: 0.2.35
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -46,8 +46,11 @@ from ._async.verifiers import (
46
46
  AsyncVerifierFunction,
47
47
  )
48
48
 
49
- # Import async tasks (default tasks are async for modern usage)
50
- from ._async.tasks import Task
49
+ # Import async tasks (default tasks are async for modern usage)
50
+ from ._async.tasks import Task, load_tasks
51
+
52
+ # Import sync load_tasks function
53
+ from .tasks import load_tasks as load_tasks_sync
51
54
 
52
55
  # Import shared types
53
56
  from .types import VerifierFunction
@@ -94,19 +97,14 @@ __all__ = [
94
97
  "configure",
95
98
  "get_client",
96
99
  "reset_client",
100
+ # Module-level functions (async is default)
101
+ "load_tasks",
102
+ "load_tasks_sync",
97
103
  # Version
98
104
  "__version__",
99
105
  ]
100
106
 
101
107
 
102
- def load_tasks(env_key: Optional[str] = None) -> List[Task]:
103
- """Load tasks without explicitly creating a client.
104
-
105
- Example:
106
- tasks = fleet.load_tasks(env_key="fira")
107
- """
108
- # Use global client by default so users can configure once
109
- return _global_client.get_client().load_tasks(env_key=env_key)
110
108
 
111
109
 
112
110
  def configure(
@@ -35,7 +35,7 @@ from .verifiers import (
35
35
  )
36
36
 
37
37
  # Import async tasks
38
- from .tasks import Task
38
+ from .tasks import Task, load_tasks
39
39
 
40
40
  # Import shared types
41
41
  from ..types import VerifierFunction
@@ -93,33 +93,6 @@ __all__ = [
93
93
  ]
94
94
 
95
95
 
96
- async def load_tasks(
97
- env_key: Optional[str] = None,
98
- keys: Optional[List[str]] = None,
99
- version: Optional[str] = None,
100
- team_id: Optional[str] = None
101
- ) -> List[Task]:
102
- """Load tasks with optional filtering.
103
-
104
- Args:
105
- env_key: Optional environment key to filter tasks by
106
- keys: Optional list of task keys to filter by
107
- version: Optional version to filter tasks by
108
-
109
- Examples:
110
- tasks = await fleet.load_tasks(env_key="fira")
111
- tasks = await fleet.load_tasks(keys=["task1", "task2"])
112
- tasks = await fleet.load_tasks(env_key="fira", version="v1.0")
113
- """
114
- # Use global client by default so users can configure once
115
- return await _async_global_client.get_client().load_tasks(
116
- env_key=env_key,
117
- keys=keys,
118
- version=version,
119
- team_id=team_id
120
- )
121
-
122
-
123
96
  async def list_envs() -> List[Environment]:
124
97
  """List all available environments."""
125
98
  return await _async_global_client.get_client().list_envs()
@@ -50,7 +50,7 @@ from .instance.client import ValidatorType
50
50
  from .resources.base import Resource
51
51
  from .resources.sqlite import AsyncSQLiteResource
52
52
  from .resources.browser import AsyncBrowserResource
53
- from ..resources.mcp import MCPResource
53
+ from .resources.mcp import AsyncMCPResource
54
54
 
55
55
  logger = logging.getLogger(__name__)
56
56
 
@@ -105,9 +105,9 @@ class AsyncEnv(EnvironmentBase):
105
105
  return self.instance.browser(name)
106
106
 
107
107
  @property
108
- def mcp(self) -> MCPResource:
108
+ def mcp(self) -> AsyncMCPResource:
109
109
  mcp_url = f"{self.urls.root}mcp"
110
- return MCPResource(url=mcp_url, env_key=self.env_key)
110
+ return AsyncMCPResource(url=mcp_url, env_key=self.env_key)
111
111
 
112
112
  def state(self, uri: str) -> Resource:
113
113
  return self.instance.state(uri)
@@ -507,12 +507,6 @@ class AsyncFleet:
507
507
  sha256=verifier_sha,
508
508
  )
509
509
 
510
- # Ensure we return an AsyncVerifierFunction
511
- if not isinstance(verifier_func, AsyncVerifierFunction):
512
- raise TypeError(
513
- f"Expected AsyncVerifierFunction but got {type(verifier_func).__name__}"
514
- )
515
-
516
510
  # Store the original verifier code for reference
517
511
  verifier_func._verifier_code = verifier_code
518
512
 
@@ -125,6 +125,56 @@ class Task(BaseModel):
125
125
  return await AsyncFleet().make(env_key=self.env_key, region=region)
126
126
 
127
127
 
128
+ def verifier_from_string(
129
+ verifier_func: str,
130
+ verifier_id: str,
131
+ verifier_key: str,
132
+ sha256: str = ""
133
+ ) -> 'VerifierFunction':
134
+ """Create a verifier function from string code.
135
+
136
+ Args:
137
+ verifier_func: The verifier function code as a string
138
+ verifier_id: Unique identifier for the verifier
139
+ verifier_key: Key/name for the verifier
140
+ sha256: SHA256 hash of the verifier code
141
+
142
+ Returns:
143
+ VerifierFunction instance that can be used to verify tasks
144
+ """
145
+ try:
146
+ import inspect
147
+ from .verifiers import verifier, AsyncVerifierFunction
148
+
149
+ # Create a local namespace for executing the code
150
+ local_namespace = {}
151
+
152
+ # Execute the verifier code in the namespace
153
+ exec(verifier_func, globals(), local_namespace)
154
+
155
+ # Find the function that was defined
156
+ func_obj = None
157
+ for name, obj in local_namespace.items():
158
+ if inspect.isfunction(obj):
159
+ func_obj = obj
160
+ break
161
+
162
+ if func_obj is None:
163
+ raise ValueError("No function found in verifier code")
164
+
165
+ # Create an AsyncVerifierFunction instance
166
+ verifier_instance = AsyncVerifierFunction(func_obj, verifier_key, verifier_id)
167
+
168
+ # Store additional metadata
169
+ verifier_instance._verifier_code = verifier_func
170
+ verifier_instance._sha256 = sha256
171
+
172
+ return verifier_instance
173
+
174
+ except Exception as e:
175
+ raise ValueError(f"Failed to create verifier from string: {e}")
176
+
177
+
128
178
  async def load_tasks(
129
179
  env_key: Optional[str] = None,
130
180
  keys: Optional[List[str]] = None,
@@ -50,7 +50,7 @@ from .instance.client import ValidatorType
50
50
  from .resources.base import Resource
51
51
  from .resources.sqlite import SQLiteResource
52
52
  from .resources.browser import BrowserResource
53
- from ..resources.mcp import MCPResource
53
+ from .resources.mcp import SyncMCPResource
54
54
 
55
55
  logger = logging.getLogger(__name__)
56
56
 
@@ -105,9 +105,9 @@ class SyncEnv(EnvironmentBase):
105
105
  return self.instance.browser(name)
106
106
 
107
107
  @property
108
- def mcp(self) -> MCPResource:
108
+ def mcp(self) -> SyncMCPResource:
109
109
  mcp_url = f"{self.urls.root}mcp"
110
- return MCPResource(url=mcp_url, env_key=self.env_key)
110
+ return SyncMCPResource(url=mcp_url, env_key=self.env_key)
111
111
 
112
112
  def state(self, uri: str) -> Resource:
113
113
  return self.instance.state(uri)
@@ -496,14 +496,8 @@ class Fleet:
496
496
  Returns:
497
497
  AsyncVerifierFunction created from the verifier code
498
498
  """
499
- from ..tasks import verifier_from_string
500
- from .verifiers.verifier import SyncVerifierFunction
501
-
502
- # Convert async verifier code to sync
503
- if 'async def' in verifier_code:
504
- verifier_code = verifier_code.replace('async def', 'def')
505
- if 'await ' in verifier_code:
506
- verifier_code = verifier_code.replace('await ', '')
499
+ from .tasks import verifier_from_string
500
+ from .verifiers import SyncVerifierFunction
507
501
 
508
502
  # Use verifier_from_string to create the verifier
509
503
  verifier_func = verifier_from_string(
@@ -513,12 +507,6 @@ class Fleet:
513
507
  sha256=verifier_sha,
514
508
  )
515
509
 
516
- # Ensure we return an AsyncVerifierFunction
517
- if not isinstance(verifier_func, SyncVerifierFunction):
518
- raise TypeError(
519
- f"Expected AsyncVerifierFunction but got {type(verifier_func).__name__}"
520
- )
521
-
522
510
  # Store the original verifier code for reference
523
511
  verifier_func._verifier_code = verifier_code
524
512
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  from .client import (
4
4
  make,
5
- make_for_task,
5
+ make_for_task_async,
6
6
  list_envs,
7
7
  list_regions,
8
8
  get,
@@ -22,7 +22,7 @@ from .._async.env.client import (
22
22
 
23
23
  __all__ = [
24
24
  "make",
25
- "make_for_task",
25
+ "make_for_task_async",
26
26
  "list_envs",
27
27
  "list_regions",
28
28
  "list_instances",
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  from typing import Optional
4
4
 
5
5
  from .client import Fleet
6
- from ..config import DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT
6
+ from .config import DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT
7
7
 
8
8
 
9
9
  _default_client: Optional[Fleet] = None
@@ -124,6 +124,56 @@ class Task(BaseModel):
124
124
  return Fleet().make(env_key=self.env_key, region=region)
125
125
 
126
126
 
127
+ def verifier_from_string(
128
+ verifier_func: str,
129
+ verifier_id: str,
130
+ verifier_key: str,
131
+ sha256: str = ""
132
+ ) -> 'VerifierFunction':
133
+ """Create a verifier function from string code.
134
+
135
+ Args:
136
+ verifier_func: The verifier function code as a string
137
+ verifier_id: Unique identifier for the verifier
138
+ verifier_key: Key/name for the verifier
139
+ sha256: SHA256 hash of the verifier code
140
+
141
+ Returns:
142
+ VerifierFunction instance that can be used to verify tasks
143
+ """
144
+ try:
145
+ import inspect
146
+ from .verifiers import verifier, SyncVerifierFunction
147
+
148
+ # Create a local namespace for executing the code
149
+ local_namespace = {}
150
+
151
+ # Execute the verifier code in the namespace
152
+ exec(verifier_func, globals(), local_namespace)
153
+
154
+ # Find the function that was defined
155
+ func_obj = None
156
+ for name, obj in local_namespace.items():
157
+ if inspect.isfunction(obj):
158
+ func_obj = obj
159
+ break
160
+
161
+ if func_obj is None:
162
+ raise ValueError("No function found in verifier code")
163
+
164
+ # Create an AsyncVerifierFunction instance
165
+ verifier_instance = SyncVerifierFunction(func_obj, verifier_key, verifier_id)
166
+
167
+ # Store additional metadata
168
+ verifier_instance._verifier_code = verifier_func
169
+ verifier_instance._sha256 = sha256
170
+
171
+ return verifier_instance
172
+
173
+ except Exception as e:
174
+ raise ValueError(f"Failed to create verifier from string: {e}")
175
+
176
+
127
177
  def load_tasks(
128
178
  env_key: Optional[str] = None,
129
179
  keys: Optional[List[str]] = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.34
3
+ Version: 0.2.35
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.34"
7
+ version = "0.2.35"
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