fleet-python 0.2.21__py3-none-any.whl → 0.2.23__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/__init__.py +3 -3
- fleet/_async/client.py +40 -8
- fleet/_async/models.py +321 -0
- fleet/_async/resources/sqlite.py +1 -1
- fleet/_async/tasks.py +1 -1
- fleet/_async/verifiers/verifier.py +4 -6
- fleet/client.py +64 -542
- fleet/env/client.py +4 -4
- fleet/instance/client.py +4 -15
- fleet/models.py +235 -190
- fleet/resources/browser.py +8 -7
- fleet/resources/sqlite.py +42 -459
- fleet/tasks.py +2 -2
- fleet/verifiers/verifier.py +10 -13
- {fleet_python-0.2.21.dist-info → fleet_python-0.2.23.dist-info}/METADATA +1 -1
- {fleet_python-0.2.21.dist-info → fleet_python-0.2.23.dist-info}/RECORD +20 -19
- scripts/fix_sync_imports.py +6 -0
- {fleet_python-0.2.21.dist-info → fleet_python-0.2.23.dist-info}/WHEEL +0 -0
- {fleet_python-0.2.21.dist-info → fleet_python-0.2.23.dist-info}/licenses/LICENSE +0 -0
- {fleet_python-0.2.21.dist-info → fleet_python-0.2.23.dist-info}/top_level.txt +0 -0
fleet/verifiers/verifier.py
CHANGED
|
@@ -9,14 +9,12 @@ that verifiers operate within an environment context.
|
|
|
9
9
|
|
|
10
10
|
import functools
|
|
11
11
|
import uuid
|
|
12
|
-
import asyncio
|
|
13
12
|
import logging
|
|
14
13
|
import hashlib
|
|
15
|
-
import
|
|
16
|
-
from typing import Any, Callable, Dict, Optional, List, TypeVar, Set, Union
|
|
14
|
+
from typing import Any, Callable, Dict, Optional, List, TypeVar, Set
|
|
17
15
|
|
|
18
16
|
from .bundler import FunctionBundler
|
|
19
|
-
from ..client import
|
|
17
|
+
from ..client import SyncEnv
|
|
20
18
|
|
|
21
19
|
logger = logging.getLogger(__name__)
|
|
22
20
|
|
|
@@ -44,7 +42,6 @@ class SyncVerifierFunction:
|
|
|
44
42
|
):
|
|
45
43
|
self.func = func
|
|
46
44
|
self.key = key
|
|
47
|
-
self.name = key # Keep name for backward compatibility
|
|
48
45
|
self.verifier_id = verifier_id or str(uuid.uuid4())
|
|
49
46
|
self.extra_requirements = extra_requirements or []
|
|
50
47
|
self._bundler = FunctionBundler()
|
|
@@ -65,11 +62,11 @@ class SyncVerifierFunction:
|
|
|
65
62
|
self.verifier_id
|
|
66
63
|
)
|
|
67
64
|
self._bundle_sha = _get_bundle_sha(self._bundle_data)
|
|
68
|
-
logger.debug(f"Created bundle for {self.
|
|
65
|
+
logger.debug(f"Created bundle for {self.key} with SHA: {self._bundle_sha}")
|
|
69
66
|
|
|
70
67
|
return self._bundle_data, self._bundle_sha
|
|
71
68
|
|
|
72
|
-
def _check_bundle_status(self, env:
|
|
69
|
+
def _check_bundle_status(self, env: SyncEnv) -> tuple[str, bool]:
|
|
73
70
|
"""Check if bundle needs to be uploaded and return (sha, needs_upload)."""
|
|
74
71
|
bundle_data, bundle_sha = self._get_or_create_bundle()
|
|
75
72
|
|
|
@@ -93,7 +90,7 @@ class SyncVerifierFunction:
|
|
|
93
90
|
logger.info(f"Bundle {bundle_sha[:8]}... needs to be uploaded")
|
|
94
91
|
return bundle_sha, True # Upload needed
|
|
95
92
|
|
|
96
|
-
def __call__(self, env:
|
|
93
|
+
def __call__(self, env: SyncEnv, *args, **kwargs) -> float:
|
|
97
94
|
"""Local execution of the verifier function with env as first parameter."""
|
|
98
95
|
try:
|
|
99
96
|
if self._is_async:
|
|
@@ -118,15 +115,15 @@ class SyncVerifierFunction:
|
|
|
118
115
|
raise ValueError(f"Verifier function must return a score (number). Got {type(result)}")
|
|
119
116
|
|
|
120
117
|
except Exception as e:
|
|
121
|
-
logger.error(f"Error in verifier {self.
|
|
118
|
+
logger.error(f"Error in verifier {self.key}: {e}")
|
|
122
119
|
# Return error score 0
|
|
123
120
|
return 0.0
|
|
124
121
|
|
|
125
|
-
def remote(self, env:
|
|
122
|
+
def remote(self, env: SyncEnv, *args, **kwargs) -> float:
|
|
126
123
|
"""Remote execution of the verifier function with SHA-based bundle caching."""
|
|
127
124
|
if self._is_async:
|
|
128
125
|
raise NotImplementedError(
|
|
129
|
-
f"Async verifier '{self.
|
|
126
|
+
f"Async verifier '{self.key}' cannot be executed remotely. "
|
|
130
127
|
"The remote execution environment only supports synchronous functions. "
|
|
131
128
|
"Please provide a synchronous version of your verifier."
|
|
132
129
|
)
|
|
@@ -223,7 +220,7 @@ Remote traceback:
|
|
|
223
220
|
except:
|
|
224
221
|
raise RuntimeError(full_message)
|
|
225
222
|
|
|
226
|
-
def _get_env_id(self, env:
|
|
223
|
+
def _get_env_id(self, env: SyncEnv) -> str:
|
|
227
224
|
"""Generate a unique identifier for the environment."""
|
|
228
225
|
# Use instance base URL or similar unique identifier
|
|
229
226
|
if hasattr(env, 'instance') and hasattr(env.instance, 'base_url'):
|
|
@@ -298,4 +295,4 @@ def verifier(
|
|
|
298
295
|
verifier_uuid
|
|
299
296
|
)
|
|
300
297
|
|
|
301
|
-
return decorator
|
|
298
|
+
return decorator
|
|
@@ -15,19 +15,20 @@ examples/openai_example.py,sha256=I2vk_SJN9BkSRQCYRJfbtGJ-HJ2xzQj-lOjwqmLos5M,82
|
|
|
15
15
|
examples/openai_simple_example.py,sha256=I42ytIwv0INgDO39pp1MOQSqsJz2YYH8GeNNBaUtq3A,1748
|
|
16
16
|
examples/query_builder_example.py,sha256=Q3lUBETHpu1aS2FXAO79ADYqCxOjMMMZNgCcFVapiII,3918
|
|
17
17
|
examples/quickstart.py,sha256=1VT39IRRhemsJgxi0O0gprdpcw7HB4pYO97GAYagIcg,3788
|
|
18
|
-
fleet/__init__.py,sha256=
|
|
18
|
+
fleet/__init__.py,sha256=5js0jYu1wddNyfy4sJIcoVGMZNZeHHSAPJJzfFXN-Po,2276
|
|
19
19
|
fleet/base.py,sha256=0yYuMN0lBkrfTTZBt5NQp5112xWgziuWEk4GuHJB1wE,9189
|
|
20
|
-
fleet/client.py,sha256=
|
|
20
|
+
fleet/client.py,sha256=SDrq3gfmbAa-F-wmewHN7PyoUc2SWKy2DdaYmJHx1dk,11591
|
|
21
21
|
fleet/config.py,sha256=zd19st83NJdW9DdOq7Irpc0x-iUnMad0JOtAr_nD5DM,273
|
|
22
22
|
fleet/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
23
|
-
fleet/models.py,sha256=
|
|
24
|
-
fleet/tasks.py,sha256=
|
|
23
|
+
fleet/models.py,sha256=aPjcwbGfyEoDaS5Iip3cAyy3j5NDqhP0wyrvtVvF3M8,11410
|
|
24
|
+
fleet/tasks.py,sha256=OScp0tHIbCmOpmCFzHATBmA7WiJMlehP3rvEfeMAoPk,1648
|
|
25
25
|
fleet/types.py,sha256=eXeI8BFmiU5hln0PVvJbUZs7BSjl6wSqAtN9zaJT6yY,652
|
|
26
26
|
fleet/_async/__init__.py,sha256=AJWCnuo7XKja4yBb8fK2wX7ntciLXQrpzdRHwjTRP6M,62
|
|
27
27
|
fleet/_async/base.py,sha256=s0rYOtXsMJeitOvpa-Oh8ciLV226p_TIPp3fplzWvV4,9209
|
|
28
|
-
fleet/_async/client.py,sha256=
|
|
28
|
+
fleet/_async/client.py,sha256=jByARVSmtsOS9Qlukwij_exPzIQW5TBMtIGKnLqlF00,11924
|
|
29
29
|
fleet/_async/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
30
|
-
fleet/_async/
|
|
30
|
+
fleet/_async/models.py,sha256=aPjcwbGfyEoDaS5Iip3cAyy3j5NDqhP0wyrvtVvF3M8,11410
|
|
31
|
+
fleet/_async/tasks.py,sha256=7ddJWkgulGW7dTPVQUUcl2L0HgsajmMQY6AUblHpG8A,1649
|
|
31
32
|
fleet/_async/env/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
33
|
fleet/_async/env/client.py,sha256=PQGKcvnVTr3o2KNsgQM7ZBqaCjimv-wEn-XiYGm44Ko,753
|
|
33
34
|
fleet/_async/instance/__init__.py,sha256=PtmJq8J8bh0SOQ2V55QURz5GJfobozwtQoqhaOk3_tI,515
|
|
@@ -36,21 +37,21 @@ fleet/_async/instance/client.py,sha256=2ZNoBxRJXDQc8fohCLy_RNo-wmuUKXzJo5RZQeCQn
|
|
|
36
37
|
fleet/_async/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
38
|
fleet/_async/resources/base.py,sha256=ZFx2I9L7px-Z8LvbPUZJtbtajpqUn1yS1NFbZZutP9Q,668
|
|
38
39
|
fleet/_async/resources/browser.py,sha256=oldoSiymJ1lJkADhpUG81ViOBDNyppX1jSoEwe9-W94,1369
|
|
39
|
-
fleet/_async/resources/sqlite.py,sha256=
|
|
40
|
+
fleet/_async/resources/sqlite.py,sha256=DvDLRI5dJ7_v4WkHw-Zday1M_FQUdzAqUCy9FtfOY8w,26636
|
|
40
41
|
fleet/_async/verifiers/__init__.py,sha256=Z2Ic77mw6-mhF5CmVrucmDnAGSTAtiejR_eZjTjPPA0,447
|
|
41
42
|
fleet/_async/verifiers/bundler.py,sha256=A4yR3wBOcVZYFAv87CD58QlJn6L4QXeilrasnVm8n74,26185
|
|
42
|
-
fleet/_async/verifiers/verifier.py,sha256=
|
|
43
|
+
fleet/_async/verifiers/verifier.py,sha256=fhy1bs_n0Ki2xDtisZI86McIZ09-v5WUFo5tZCBRsvA,12153
|
|
43
44
|
fleet/env/__init__.py,sha256=yYk657kVDnMWYbuPS_2o0kpVC99AYD85o5WG1jCaWSY,531
|
|
44
|
-
fleet/env/client.py,sha256=
|
|
45
|
+
fleet/env/client.py,sha256=pG5S1ylDN0pqUGQtRqayDSnYI7ZVpCFvTbtC4LuMRts,628
|
|
45
46
|
fleet/instance/__init__.py,sha256=-Anms7Vw_FO8VBIvwnAnq4rQjwl_XNfAS-i7bypHMow,478
|
|
46
47
|
fleet/instance/base.py,sha256=OYqzBwZFfTX9wlBGSG5gljqj98NbiJeKIfFJ3uj5I4s,1587
|
|
47
|
-
fleet/instance/client.py,sha256=
|
|
48
|
+
fleet/instance/client.py,sha256=4x-3IZZNwlK02OJLKp7mhSymRgXk8NToRCDU3ZuDnJ0,5891
|
|
48
49
|
fleet/instance/models.py,sha256=ZTiue0YOuhuwX8jYfJAoCzGfqjLqqXRLqK1LVFhq6rQ,4183
|
|
49
50
|
fleet/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
51
|
fleet/resources/base.py,sha256=203gD54NP1IvjuSqFo-f7FvrkhtjChggtzrxJK7xf2E,667
|
|
51
|
-
fleet/resources/browser.py,sha256=
|
|
52
|
+
fleet/resources/browser.py,sha256=hRNM0YMsVQUAraZGNi_B-KXxLpuddy4ntoEDFSw7czU,1295
|
|
52
53
|
fleet/resources/mcp.py,sha256=lDMyY4pMC3Khwp2Wycc6Ds6KeLAUOgHkDnmztuAnXm8,1872
|
|
53
|
-
fleet/resources/sqlite.py,sha256=
|
|
54
|
+
fleet/resources/sqlite.py,sha256=FeAykW7T0Pol7ckDLCtcjJDHDTI7y9ilWp7fnw4tuM8,26266
|
|
54
55
|
fleet/verifiers/__init__.py,sha256=9sRqYEjPN-EGMhytkw0Q68vay7azmpY9TvkBJQ3_8Os,489
|
|
55
56
|
fleet/verifiers/bundler.py,sha256=A4yR3wBOcVZYFAv87CD58QlJn6L4QXeilrasnVm8n74,26185
|
|
56
57
|
fleet/verifiers/code.py,sha256=EOi6ES8Zdzlm9iybRFaJmz9t2W4Ulo2wrCdbEBqxzbc,47
|
|
@@ -58,11 +59,11 @@ fleet/verifiers/db.py,sha256=tssmvJjDHuBIy8qlL_P5-UdmEFUw2DZcqLsWZ8ot3Xw,27766
|
|
|
58
59
|
fleet/verifiers/decorator.py,sha256=Q-KHhicnIYFwX7FX_VZguzNfu8ZslqNUeWxcS2CwNVY,3386
|
|
59
60
|
fleet/verifiers/parse.py,sha256=FYbzgX86dLAxoAZ3jXfu6zRPlNxgzjTkhO3yxMC0hZ4,5261
|
|
60
61
|
fleet/verifiers/sql_differ.py,sha256=dmiGCFXVMEMbAX519OjhVqgA8ZvhnvdmC1BVpL7QCF0,6490
|
|
61
|
-
fleet/verifiers/verifier.py,sha256
|
|
62
|
-
fleet_python-0.2.
|
|
63
|
-
scripts/fix_sync_imports.py,sha256=
|
|
62
|
+
fleet/verifiers/verifier.py,sha256=-iEnLi4BOpqMV8tJgSPcTi_mGWM3vMJiAYTmaJolo2c,12080
|
|
63
|
+
fleet_python-0.2.23.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
64
|
+
scripts/fix_sync_imports.py,sha256=zangqElfqIvIc-E0S46m6R-51pTZ6gbd8oUVkvCGzJo,4768
|
|
64
65
|
scripts/unasync.py,sha256=--Fmaae47o-dZ1HYgX1c3Nvi-rMjcFymTRlJcWWnmpw,725
|
|
65
|
-
fleet_python-0.2.
|
|
66
|
-
fleet_python-0.2.
|
|
67
|
-
fleet_python-0.2.
|
|
68
|
-
fleet_python-0.2.
|
|
66
|
+
fleet_python-0.2.23.dist-info/METADATA,sha256=BnRRdSDuEiBGpMKUnjrB89CfR4SYbqgo7LhDy6yC6DI,3297
|
|
67
|
+
fleet_python-0.2.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
68
|
+
fleet_python-0.2.23.dist-info/top_level.txt,sha256=_3DSmTohvSDf3AIP_BYfGzhwO1ECFwuzg83X-wHCx3Y,23
|
|
69
|
+
fleet_python-0.2.23.dist-info/RECORD,,
|
scripts/fix_sync_imports.py
CHANGED
|
@@ -50,6 +50,12 @@ def fix_file(filepath: Path) -> bool:
|
|
|
50
50
|
content = content.replace('from ..models import', 'from .models import')
|
|
51
51
|
content = content.replace('from ..config import', 'from .config import')
|
|
52
52
|
|
|
53
|
+
# Fix __init__.py imports - the class is called SyncEnv, not Environment
|
|
54
|
+
if rel_path.parts[0] == '__init__.py' and len(rel_path.parts) == 1:
|
|
55
|
+
content = content.replace('from .client import Fleet, Environment', 'from .client import Fleet, SyncEnv')
|
|
56
|
+
content = content.replace('"Environment",', '"SyncEnv",')
|
|
57
|
+
content = content.replace("'Environment',", "'SyncEnv',")
|
|
58
|
+
|
|
53
59
|
# Fix playwright imports for sync version
|
|
54
60
|
if 'playwright' in str(filepath):
|
|
55
61
|
# Fix the import statement
|
|
File without changes
|
|
File without changes
|
|
File without changes
|