fleet-python 0.2.35__py3-none-any.whl → 0.2.37__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.
Potentially problematic release.
This version of fleet-python might be problematic. Click here for more details.
- fleet/_async/__init__.py +4 -3
- fleet/_async/client.py +3 -3
- fleet/_async/env/client.py +3 -3
- fleet/_async/tasks.py +8 -1
- fleet/client.py +3 -3
- fleet/env/client.py +3 -3
- fleet/tasks.py +8 -1
- {fleet_python-0.2.35.dist-info → fleet_python-0.2.37.dist-info}/METADATA +1 -1
- {fleet_python-0.2.35.dist-info → fleet_python-0.2.37.dist-info}/RECORD +13 -13
- scripts/fix_sync_imports.py +16 -1
- {fleet_python-0.2.35.dist-info → fleet_python-0.2.37.dist-info}/WHEEL +0 -0
- {fleet_python-0.2.35.dist-info → fleet_python-0.2.37.dist-info}/licenses/LICENSE +0 -0
- {fleet_python-0.2.35.dist-info → fleet_python-0.2.37.dist-info}/top_level.txt +0 -0
fleet/_async/__init__.py
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
"""Fleet Python SDK - Async Environment-based AI agent interactions."""
|
|
16
16
|
|
|
17
|
-
from typing import Optional, List
|
|
17
|
+
from typing import Optional, List, Dict, Any
|
|
18
18
|
|
|
19
19
|
from ..exceptions import (
|
|
20
20
|
FleetError,
|
|
@@ -108,13 +108,14 @@ async def environment(env_key: str) -> Environment:
|
|
|
108
108
|
return await _async_global_client.get_client().environment(env_key)
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
async def make(env_key: str, region: Optional[str] = None) -> AsyncEnv:
|
|
111
|
+
async def make(env_key: str, region: Optional[str] = None, env_variables: Optional[Dict[str, Any]] = None) -> AsyncEnv:
|
|
112
112
|
"""Create a new environment instance.
|
|
113
113
|
|
|
114
114
|
Example:
|
|
115
115
|
env = await fleet.make("fira")
|
|
116
|
+
env_with_vars = await fleet.make("fira", env_variables={"LOGGED_IN_NAME": "Alice"})
|
|
116
117
|
"""
|
|
117
|
-
return await _async_global_client.get_client().make(env_key, region)
|
|
118
|
+
return await _async_global_client.get_client().make(env_key, region, env_variables)
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
async def make_for_task(task: Task) -> AsyncEnv:
|
fleet/_async/client.py
CHANGED
|
@@ -20,7 +20,7 @@ import httpx
|
|
|
20
20
|
import json
|
|
21
21
|
import logging
|
|
22
22
|
import os
|
|
23
|
-
from typing import List, Optional, Dict, TYPE_CHECKING
|
|
23
|
+
from typing import List, Optional, Dict, Any, TYPE_CHECKING
|
|
24
24
|
|
|
25
25
|
from .base import EnvironmentBase, AsyncWrapper
|
|
26
26
|
from ..models import (
|
|
@@ -196,7 +196,7 @@ class AsyncFleet:
|
|
|
196
196
|
response = await self.client.request("GET", f"/v1/env/{env_key}")
|
|
197
197
|
return EnvironmentModel(**response.json())
|
|
198
198
|
|
|
199
|
-
async def make(self, env_key: str, region: Optional[str] = None) -> AsyncEnv:
|
|
199
|
+
async def make(self, env_key: str, region: Optional[str] = None, env_variables: Optional[Dict[str, Any]] = None) -> AsyncEnv:
|
|
200
200
|
if ":" in env_key:
|
|
201
201
|
env_key_part, version = env_key.split(":", 1)
|
|
202
202
|
if (
|
|
@@ -210,7 +210,7 @@ class AsyncFleet:
|
|
|
210
210
|
version = None
|
|
211
211
|
|
|
212
212
|
request = InstanceRequest(
|
|
213
|
-
env_key=env_key_part, version=version, region=region, created_from="sdk"
|
|
213
|
+
env_key=env_key_part, version=version, region=region, env_variables=env_variables, created_from="sdk"
|
|
214
214
|
)
|
|
215
215
|
region_base_url = REGION_BASE_URL.get(region)
|
|
216
216
|
response = await self.client.request(
|
fleet/_async/env/client.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from ..client import AsyncFleet, AsyncEnv, Task
|
|
2
2
|
from ...models import Environment as EnvironmentModel, AccountResponse
|
|
3
|
-
from typing import List, Optional
|
|
3
|
+
from typing import List, Optional, Dict, Any
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
async def make_async(env_key: str, region: Optional[str] = None) -> AsyncEnv:
|
|
7
|
-
return await AsyncFleet().make(env_key, region=region)
|
|
6
|
+
async def make_async(env_key: str, region: Optional[str] = None, env_variables: Optional[Dict[str, Any]] = None) -> AsyncEnv:
|
|
7
|
+
return await AsyncFleet().make(env_key, region=region, env_variables=env_variables)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
async def make_for_task_async(task: Task) -> AsyncEnv:
|
fleet/_async/tasks.py
CHANGED
|
@@ -145,9 +145,16 @@ def verifier_from_string(
|
|
|
145
145
|
try:
|
|
146
146
|
import inspect
|
|
147
147
|
from .verifiers import verifier, AsyncVerifierFunction
|
|
148
|
+
from fleet.verifiers.code import TASK_SUCCESSFUL_SCORE, TASK_FAILED_SCORE
|
|
149
|
+
from fleet.verifiers.db import IgnoreConfig
|
|
148
150
|
|
|
149
151
|
# Create a local namespace for executing the code
|
|
150
|
-
local_namespace = {
|
|
152
|
+
local_namespace = {
|
|
153
|
+
'TASK_SUCCESSFUL_SCORE': TASK_SUCCESSFUL_SCORE,
|
|
154
|
+
'TASK_FAILED_SCORE': TASK_FAILED_SCORE,
|
|
155
|
+
'IgnoreConfig': IgnoreConfig,
|
|
156
|
+
'Environment': object # Add Environment type if needed
|
|
157
|
+
}
|
|
151
158
|
|
|
152
159
|
# Execute the verifier code in the namespace
|
|
153
160
|
exec(verifier_func, globals(), local_namespace)
|
fleet/client.py
CHANGED
|
@@ -20,7 +20,7 @@ import httpx
|
|
|
20
20
|
import json
|
|
21
21
|
import logging
|
|
22
22
|
import os
|
|
23
|
-
from typing import List, Optional, Dict, TYPE_CHECKING
|
|
23
|
+
from typing import List, Optional, Dict, Any, TYPE_CHECKING
|
|
24
24
|
|
|
25
25
|
from .base import EnvironmentBase, SyncWrapper
|
|
26
26
|
from .models import (
|
|
@@ -196,7 +196,7 @@ class Fleet:
|
|
|
196
196
|
response = self.client.request("GET", f"/v1/env/{env_key}")
|
|
197
197
|
return EnvironmentModel(**response.json())
|
|
198
198
|
|
|
199
|
-
def make(self, env_key: str, region: Optional[str] = None) -> SyncEnv:
|
|
199
|
+
def make(self, env_key: str, region: Optional[str] = None, env_variables: Optional[Dict[str, Any]] = None) -> SyncEnv:
|
|
200
200
|
if ":" in env_key:
|
|
201
201
|
env_key_part, version = env_key.split(":", 1)
|
|
202
202
|
if (
|
|
@@ -210,7 +210,7 @@ class Fleet:
|
|
|
210
210
|
version = None
|
|
211
211
|
|
|
212
212
|
request = InstanceRequest(
|
|
213
|
-
env_key=env_key_part, version=version, region=region, created_from="sdk"
|
|
213
|
+
env_key=env_key_part, version=version, region=region, env_variables=env_variables, created_from="sdk"
|
|
214
214
|
)
|
|
215
215
|
region_base_url = REGION_BASE_URL.get(region)
|
|
216
216
|
response = self.client.request(
|
fleet/env/client.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
from ..client import Fleet, SyncEnv, Task
|
|
2
2
|
from ..models import Environment as EnvironmentModel, AccountResponse
|
|
3
|
-
from typing import List, Optional
|
|
3
|
+
from typing import List, Optional, Dict, Any
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
def make(env_key: str, region: Optional[str] = None) -> SyncEnv:
|
|
7
|
-
return Fleet().make(env_key, region=region)
|
|
6
|
+
def make(env_key: str, region: Optional[str] = None, env_variables: Optional[Dict[str, Any]] = None) -> SyncEnv:
|
|
7
|
+
return Fleet().make(env_key, region=region, env_variables=env_variables)
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def make_for_task_async(task: Task) -> SyncEnv:
|
fleet/tasks.py
CHANGED
|
@@ -144,9 +144,16 @@ def verifier_from_string(
|
|
|
144
144
|
try:
|
|
145
145
|
import inspect
|
|
146
146
|
from .verifiers import verifier, SyncVerifierFunction
|
|
147
|
+
from fleet.verifiers.code import TASK_SUCCESSFUL_SCORE, TASK_FAILED_SCORE
|
|
148
|
+
from fleet.verifiers.db import IgnoreConfig
|
|
147
149
|
|
|
148
150
|
# Create a local namespace for executing the code
|
|
149
|
-
local_namespace = {
|
|
151
|
+
local_namespace = {
|
|
152
|
+
'TASK_SUCCESSFUL_SCORE': TASK_SUCCESSFUL_SCORE,
|
|
153
|
+
'TASK_FAILED_SCORE': TASK_FAILED_SCORE,
|
|
154
|
+
'IgnoreConfig': IgnoreConfig,
|
|
155
|
+
'Environment': object # Add Environment type if needed
|
|
156
|
+
}
|
|
150
157
|
|
|
151
158
|
# Execute the verifier code in the namespace
|
|
152
159
|
exec(verifier_func, globals(), local_namespace)
|
|
@@ -21,22 +21,22 @@ examples/quickstart.py,sha256=1VT39IRRhemsJgxi0O0gprdpcw7HB4pYO97GAYagIcg,3788
|
|
|
21
21
|
examples/test_cdp_logging.py,sha256=AkCwQCgOTQEI8w3v0knWK_4eXMph7L9x07wj9yIYM10,2836
|
|
22
22
|
fleet/__init__.py,sha256=F6PrtihwOKZxmaOkeHmGLBM3feTpRTEDT5tSqeSD7ts,3749
|
|
23
23
|
fleet/base.py,sha256=bc-340sTpq_DJs7yQ9d2pDWnmJFmA1SwDB9Lagvqtb4,9182
|
|
24
|
-
fleet/client.py,sha256=
|
|
24
|
+
fleet/client.py,sha256=nxYynq06wa7pWeMzPvwgAC6XBrb9rzujQfPi2hl_gmM,21876
|
|
25
25
|
fleet/config.py,sha256=uY02ZKxVoXqVDta-0IMWaYJeE1CTXF_fA9NI6QUutmU,319
|
|
26
26
|
fleet/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
27
27
|
fleet/global_client.py,sha256=frrDAFNM2ywN0JHLtlm9qbE1dQpnQJsavJpb7xSR_bU,1072
|
|
28
28
|
fleet/models.py,sha256=9tDjgcgKPMnf-R_MDh-Ocp_UMbyJ8tJyjb15XqU0N94,12454
|
|
29
|
-
fleet/tasks.py,sha256=
|
|
29
|
+
fleet/tasks.py,sha256=6S15V1lZoXYFOVga2ca5nnXyFUQB3knHcGD4uLJbkww,7610
|
|
30
30
|
fleet/types.py,sha256=L4Y82xICf1tzyCLqhLYUgEoaIIS5h9T05TyFNHSWs3s,652
|
|
31
|
-
fleet/_async/__init__.py,sha256=
|
|
31
|
+
fleet/_async/__init__.py,sha256=lrnDD6N9p0Oqpi_djxTnxh8I5F7nA7KNn0khciGmgpg,6747
|
|
32
32
|
fleet/_async/base.py,sha256=oisVTQsx0M_yTmyQJc3oij63uKZ97MHz-xYFsWXxQE8,9202
|
|
33
|
-
fleet/_async/client.py,sha256=
|
|
33
|
+
fleet/_async/client.py,sha256=WNaBwHJWRrOyYB79_qujdKkRMPmhpSucHbfTic9uc6A,22335
|
|
34
34
|
fleet/_async/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
35
35
|
fleet/_async/global_client.py,sha256=4WskpLHbsDEgWW7hXMD09W-brkp4euy8w2ZJ88594rQ,1103
|
|
36
36
|
fleet/_async/models.py,sha256=9tDjgcgKPMnf-R_MDh-Ocp_UMbyJ8tJyjb15XqU0N94,12454
|
|
37
|
-
fleet/_async/tasks.py,sha256=
|
|
37
|
+
fleet/_async/tasks.py,sha256=pY01ImjiX0CPWfTy0HcOUjLSeqzItigOhWUAAAiSj6M,7685
|
|
38
38
|
fleet/_async/env/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
fleet/_async/env/client.py,sha256=
|
|
39
|
+
fleet/_async/env/client.py,sha256=9GOSkEWNncwTtiZNaJ2vNGrFCPutyan9lBNhD87dAzQ,1059
|
|
40
40
|
fleet/_async/instance/__init__.py,sha256=PtmJq8J8bh0SOQ2V55QURz5GJfobozwtQoqhaOk3_tI,515
|
|
41
41
|
fleet/_async/instance/base.py,sha256=3qUBuUR8OVS36LzdP6KyZzngtwPKYO09HoY6Ekxp-KA,1625
|
|
42
42
|
fleet/_async/instance/client.py,sha256=z9q_-dIBwPc1X6VlQOi_aV2v6KOKueJGg8NMyP5iFQM,6082
|
|
@@ -49,7 +49,7 @@ fleet/_async/verifiers/__init__.py,sha256=1WTlCNq4tIFbbXaQu5Bf2WppZq0A8suhtZbxMT
|
|
|
49
49
|
fleet/_async/verifiers/bundler.py,sha256=Sq0KkqEhM5Ng2x8R6Z4puXvQ8FMlEO7D3-ldBLktPi4,26205
|
|
50
50
|
fleet/_async/verifiers/verifier.py,sha256=lwVIV5ZpWJhM87tXShtjwN5KP7n5XDcPq0XX7AjV6_E,14343
|
|
51
51
|
fleet/env/__init__.py,sha256=cS9zCYobM5jypppDMZIQMYd6hOg5f4sgqRXEQ67pckk,676
|
|
52
|
-
fleet/env/client.py,sha256=
|
|
52
|
+
fleet/env/client.py,sha256=wvZbmHdftkuhAgpzOGiA4Yl_Th9BUIHFR_6JUYg6Nc8,893
|
|
53
53
|
fleet/instance/__init__.py,sha256=CyWUkbGAK-DBPw4DC4AnCW-MqqheGhZMA5QSRVu-ws4,479
|
|
54
54
|
fleet/instance/base.py,sha256=OYqzBwZFfTX9wlBGSG5gljqj98NbiJeKIfFJ3uj5I4s,1587
|
|
55
55
|
fleet/instance/client.py,sha256=O6B0A2Z0b5SxOLs4TipZ9Ol8yG-b-LG15vVOKMmd6BQ,5908
|
|
@@ -67,10 +67,10 @@ fleet/verifiers/decorator.py,sha256=nAP3O8szXu7md_kpwpz91hGSUNEVLYjwZQZTkQlV1DM,
|
|
|
67
67
|
fleet/verifiers/parse.py,sha256=0bAbj9VvT__yU4ZVREUK-Tn9dukh9LCpmfVsgj1DfP4,8508
|
|
68
68
|
fleet/verifiers/sql_differ.py,sha256=dmiGCFXVMEMbAX519OjhVqgA8ZvhnvdmC1BVpL7QCF0,6490
|
|
69
69
|
fleet/verifiers/verifier.py,sha256=53oBWAf0yy3bZmZx9eH9AWIf65H7OP2UUm0YwWCL6Mc,14286
|
|
70
|
-
fleet_python-0.2.
|
|
71
|
-
scripts/fix_sync_imports.py,sha256=
|
|
70
|
+
fleet_python-0.2.37.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
71
|
+
scripts/fix_sync_imports.py,sha256=X9fWLTpiPGkSHsjyQUDepOJkxOqw1DPj7nd8wFlFqLQ,8368
|
|
72
72
|
scripts/unasync.py,sha256=vWVQxRWX8SRZO5cmzEhpvnG_REhCWXpidIGIpWmEcvI,696
|
|
73
|
-
fleet_python-0.2.
|
|
74
|
-
fleet_python-0.2.
|
|
75
|
-
fleet_python-0.2.
|
|
76
|
-
fleet_python-0.2.
|
|
73
|
+
fleet_python-0.2.37.dist-info/METADATA,sha256=4xd5BDBKVjFMuve0RE5h-w1t_ikItOR0LOV7KQf6-Nw,3354
|
|
74
|
+
fleet_python-0.2.37.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
75
|
+
fleet_python-0.2.37.dist-info/top_level.txt,sha256=_3DSmTohvSDf3AIP_BYfGzhwO1ECFwuzg83X-wHCx3Y,23
|
|
76
|
+
fleet_python-0.2.37.dist-info/RECORD,,
|
scripts/fix_sync_imports.py
CHANGED
|
@@ -76,10 +76,25 @@ def fix_file(filepath: Path) -> bool:
|
|
|
76
76
|
)
|
|
77
77
|
|
|
78
78
|
# Fix imports in top-level fleet files
|
|
79
|
-
if rel_path.parts[0] in ["base.py", "client.py"] and len(rel_path.parts) == 1:
|
|
79
|
+
if rel_path.parts[0] in ["base.py", "client.py", "global_client.py"] and len(rel_path.parts) == 1:
|
|
80
80
|
# Top-level files should use . for fleet level imports
|
|
81
81
|
content = content.replace("from ..models import", "from .models import")
|
|
82
82
|
content = content.replace("from ..config import", "from .config import")
|
|
83
|
+
content = content.replace("from ..tasks import", "from .tasks import")
|
|
84
|
+
|
|
85
|
+
# Fix sync client error messages and imports
|
|
86
|
+
if rel_path.parts[0] == "client.py":
|
|
87
|
+
content = content.replace("Expected AsyncVerifierFunction but got", "Expected SyncVerifierFunction but got")
|
|
88
|
+
content = content.replace("# Ensure we return an AsyncVerifierFunction", "# Ensure we return a SyncVerifierFunction")
|
|
89
|
+
content = content.replace("from .verifiers.verifier import SyncVerifierFunction", "from .verifiers import SyncVerifierFunction")
|
|
90
|
+
|
|
91
|
+
# Remove the type check entirely since it's causing import issues
|
|
92
|
+
content = re.sub(
|
|
93
|
+
r'\s*# Ensure we return a SyncVerifierFunction\s*\n\s*if not isinstance\(verifier_func, SyncVerifierFunction\):\s*\n\s*raise TypeError\(\s*f"Expected SyncVerifierFunction but got \{type\(verifier_func\)\.__name__\}"\s*\)\s*\n\s*',
|
|
94
|
+
'',
|
|
95
|
+
content,
|
|
96
|
+
flags=re.MULTILINE
|
|
97
|
+
)
|
|
83
98
|
|
|
84
99
|
# Fix __init__.py imports - the class is called SyncEnv, not Environment
|
|
85
100
|
if rel_path.parts[0] == "__init__.py" and len(rel_path.parts) == 1:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|