fleet-python 0.2.29__py3-none-any.whl → 0.2.32__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.
- examples/diff_example.py +30 -20
- examples/dsl_example.py +12 -7
- examples/example.py +4 -4
- examples/example_account.py +8 -0
- examples/example_action_log.py +2 -2
- examples/example_client.py +2 -2
- examples/example_mcp_anthropic.py +8 -5
- examples/example_mcp_openai.py +2 -2
- examples/example_sync.py +4 -4
- examples/example_task.py +16 -6
- examples/example_tasks.py +3 -6
- examples/example_verifier.py +16 -3
- examples/gemini_example.py +6 -6
- examples/json_tasks_example.py +2 -2
- examples/nova_act_example.py +2 -2
- examples/openai_example.py +3 -3
- examples/openai_simple_example.py +3 -3
- examples/query_builder_example.py +11 -7
- fleet/__init__.py +60 -5
- fleet/_async/__init__.py +258 -1
- fleet/_async/base.py +2 -1
- fleet/_async/client.py +164 -144
- fleet/_async/env/client.py +2 -0
- fleet/_async/global_client.py +43 -0
- fleet/_async/instance/client.py +1 -1
- fleet/_async/models.py +172 -171
- fleet/_async/resources/base.py +1 -1
- fleet/_async/resources/mcp.py +55 -0
- fleet/_async/resources/sqlite.py +141 -130
- fleet/_async/tasks.py +69 -16
- fleet/_async/verifiers/__init__.py +2 -2
- fleet/_async/verifiers/bundler.py +18 -14
- fleet/_async/verifiers/verifier.py +77 -71
- fleet/base.py +2 -1
- fleet/client.py +145 -158
- fleet/config.py +3 -2
- fleet/env/__init__.py +9 -1
- fleet/env/client.py +3 -0
- fleet/global_client.py +43 -0
- fleet/instance/__init__.py +1 -1
- fleet/instance/client.py +2 -4
- fleet/models.py +172 -171
- fleet/resources/base.py +1 -1
- fleet/resources/mcp.py +27 -33
- fleet/resources/sqlite.py +136 -131
- fleet/tasks.py +195 -16
- fleet/types.py +1 -1
- fleet/verifiers/__init__.py +2 -2
- fleet/verifiers/bundler.py +18 -14
- fleet/verifiers/code.py +1 -1
- fleet/verifiers/decorator.py +25 -34
- fleet/verifiers/parse.py +98 -68
- fleet/verifiers/verifier.py +77 -78
- {fleet_python-0.2.29.dist-info → fleet_python-0.2.32.dist-info}/METADATA +9 -9
- fleet_python-0.2.32.dist-info/RECORD +74 -0
- scripts/fix_sync_imports.py +87 -59
- scripts/unasync.py +10 -9
- fleet_python-0.2.29.dist-info/RECORD +0 -70
- {fleet_python-0.2.29.dist-info → fleet_python-0.2.32.dist-info}/WHEEL +0 -0
- {fleet_python-0.2.29.dist-info → fleet_python-0.2.32.dist-info}/licenses/LICENSE +0 -0
- {fleet_python-0.2.29.dist-info → fleet_python-0.2.32.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fleet-python
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.32
|
|
4
4
|
Summary: Python SDK for Fleet environments
|
|
5
5
|
Author-email: Fleet AI <nic@fleet.so>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -65,11 +65,11 @@ export FLEET_API_KEY="sk_your_key_here"
|
|
|
65
65
|
## Basic Usage
|
|
66
66
|
|
|
67
67
|
```python
|
|
68
|
-
import fleet
|
|
68
|
+
import fleet
|
|
69
69
|
import datetime
|
|
70
70
|
|
|
71
71
|
# Create environment by key
|
|
72
|
-
env =
|
|
72
|
+
env = fleet.env.make("fira")
|
|
73
73
|
|
|
74
74
|
# Reset environment with seed and options
|
|
75
75
|
env.reset(
|
|
@@ -91,10 +91,10 @@ env.close()
|
|
|
91
91
|
|
|
92
92
|
```python
|
|
93
93
|
# Create environment instance with explicit version
|
|
94
|
-
env =
|
|
94
|
+
env = fleet.env.make("fira:v1.2.5")
|
|
95
95
|
|
|
96
96
|
# Create environment instance with default (latest) version
|
|
97
|
-
env =
|
|
97
|
+
env = fleet.env.make("fira")
|
|
98
98
|
|
|
99
99
|
```
|
|
100
100
|
|
|
@@ -102,18 +102,18 @@ env = flt.env.make("fira")
|
|
|
102
102
|
|
|
103
103
|
```python
|
|
104
104
|
# Connect to a running instance
|
|
105
|
-
env =
|
|
105
|
+
env = fleet.env.get("env_instance_id")
|
|
106
106
|
|
|
107
107
|
# List all running instances
|
|
108
|
-
instances =
|
|
108
|
+
instances = fleet.env.list_instances()
|
|
109
109
|
for instance in instances:
|
|
110
110
|
print(f"Instance: {instance.instance_id}")
|
|
111
111
|
print(f"Type: {instance.environment_type}")
|
|
112
112
|
print(f"Status: {instance.status}")
|
|
113
113
|
|
|
114
114
|
# Filter instances by status (running, pending, stopped, error)
|
|
115
|
-
running_instances =
|
|
115
|
+
running_instances = fleet.env.list_instances(status_filter="running")
|
|
116
116
|
|
|
117
117
|
# List available environment types
|
|
118
|
-
available_envs =
|
|
118
|
+
available_envs = fleet.env.list_envs()
|
|
119
119
|
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
examples/diff_example.py,sha256=iLlpBW_NBjzXBqlvYwjx74uxYZkMGJfea6s3tJhvuNY,5684
|
|
2
|
+
examples/dsl_example.py,sha256=yFLgM-Was4-w575xJgPk9DIBmXa34hLJsIB4XwTADOE,7252
|
|
3
|
+
examples/example.py,sha256=yn9mqS2yJ6896s25btnJx9-_SLLbyS-Fu-SIcas6jok,1081
|
|
4
|
+
examples/example_account.py,sha256=t5_Tnr7DcLYfNpEAbuBySQIqsqiQQGySuiItIghCjAM,225
|
|
5
|
+
examples/example_action_log.py,sha256=pwvLro_Fkrw4DII002bHGuWfoZ6QRvUMDD9BnMqJgLQ,622
|
|
6
|
+
examples/example_client.py,sha256=M9Mfi1FcD2LtSDVk89R_-tgG98swvDYy4qx2zVayJ-0,1025
|
|
7
|
+
examples/example_mcp_anthropic.py,sha256=2ouLWAojhdnxhJc6yxkgo8e3TnNjC48yz8zpaPQm3Jw,2597
|
|
8
|
+
examples/example_mcp_openai.py,sha256=xhqJd2-mnQs4-ZmydGrX7pPs7_X5i-YFqkO1cr3L-5g,480
|
|
9
|
+
examples/example_sync.py,sha256=EkuWmUzB1ZsBJQk6ZRflB793rKsuRHeSg5HJZHVhBB0,975
|
|
10
|
+
examples/example_task.py,sha256=dhG6STAkNsTdHs9cO1RFH9WfuvRmq5bRC211hTeFrk8,7088
|
|
11
|
+
examples/example_tasks.py,sha256=Af57KbxpDxWWAVnjVC6IC0Rbxr_Z6kTEQk-XcDe4vTo,747
|
|
12
|
+
examples/example_verifier.py,sha256=0vwNITIG3m4CkSPwIxNXcGx9TqrxEsCGqK2A8keKZMM,2392
|
|
13
|
+
examples/gemini_example.py,sha256=qj9WDazQTYNiRHNeUg9Tjkp33lJMwbx8gDfpFe1sDQo,16180
|
|
14
|
+
examples/json_tasks_example.py,sha256=CYPESGGtOo0fmsDdLidujTfsE4QlJHw7rOhyVqPJ_Ls,5329
|
|
15
|
+
examples/nova_act_example.py,sha256=rH23Lp74Okf0rn8ynMdWjK2aviEf5NLPH4k_53Pyxho,831
|
|
16
|
+
examples/openai_example.py,sha256=dEWERrTEP5xBiGkLkQjBQGd2NqoxX6gcW6XteBPsWFQ,8231
|
|
17
|
+
examples/openai_simple_example.py,sha256=HmiufucrAZne7tHq9uoEsDWlEhjNC265bQAyIGBRU2o,1745
|
|
18
|
+
examples/query_builder_example.py,sha256=-cOMfWGNifYfYEt_Ds73XpwATZvFDL6F4KTkVxdMjzg,3951
|
|
19
|
+
examples/quickstart.py,sha256=1VT39IRRhemsJgxi0O0gprdpcw7HB4pYO97GAYagIcg,3788
|
|
20
|
+
fleet/__init__.py,sha256=LYJ8zS6Ldo5wLpRqsFMoiikkyosTmm7sRTUY4SnJAgE,3880
|
|
21
|
+
fleet/base.py,sha256=bc-340sTpq_DJs7yQ9d2pDWnmJFmA1SwDB9Lagvqtb4,9182
|
|
22
|
+
fleet/client.py,sha256=WC_fYzf28PXHWAqtp4aE97hbmAeNxzzu1TEbzpgbvMk,21366
|
|
23
|
+
fleet/config.py,sha256=uY02ZKxVoXqVDta-0IMWaYJeE1CTXF_fA9NI6QUutmU,319
|
|
24
|
+
fleet/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
25
|
+
fleet/global_client.py,sha256=frrDAFNM2ywN0JHLtlm9qbE1dQpnQJsavJpb7xSR_bU,1072
|
|
26
|
+
fleet/models.py,sha256=9tDjgcgKPMnf-R_MDh-Ocp_UMbyJ8tJyjb15XqU0N94,12454
|
|
27
|
+
fleet/tasks.py,sha256=rNUh-80xq_-Am3WJKNWEtQczBnxgvpAUR4zRd22mJ-4,9771
|
|
28
|
+
fleet/types.py,sha256=L4Y82xICf1tzyCLqhLYUgEoaIIS5h9T05TyFNHSWs3s,652
|
|
29
|
+
fleet/_async/__init__.py,sha256=1X00u-0Zu4S-e8MGE9nJWbZEt3H-DHZA-gfwN-JuP2U,7415
|
|
30
|
+
fleet/_async/base.py,sha256=oisVTQsx0M_yTmyQJc3oij63uKZ97MHz-xYFsWXxQE8,9202
|
|
31
|
+
fleet/_async/client.py,sha256=cX5eFE4J1nfdXddarc2HcNQpBYzQejlVWwbM2n3URlg,22497
|
|
32
|
+
fleet/_async/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
33
|
+
fleet/_async/global_client.py,sha256=4WskpLHbsDEgWW7hXMD09W-brkp4euy8w2ZJ88594rQ,1103
|
|
34
|
+
fleet/_async/models.py,sha256=9tDjgcgKPMnf-R_MDh-Ocp_UMbyJ8tJyjb15XqU0N94,12454
|
|
35
|
+
fleet/_async/tasks.py,sha256=jHGAvMkR3byayR429YSDiiIDV3W30y4UHZf9W6UhA8M,5721
|
|
36
|
+
fleet/_async/env/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
+
fleet/_async/env/client.py,sha256=Fx4jVEGlM4JB_pgk9lZutzPAOgp6Yi3vxt3waMPrMvM,971
|
|
38
|
+
fleet/_async/instance/__init__.py,sha256=PtmJq8J8bh0SOQ2V55QURz5GJfobozwtQoqhaOk3_tI,515
|
|
39
|
+
fleet/_async/instance/base.py,sha256=3qUBuUR8OVS36LzdP6KyZzngtwPKYO09HoY6Ekxp-KA,1625
|
|
40
|
+
fleet/_async/instance/client.py,sha256=z9q_-dIBwPc1X6VlQOi_aV2v6KOKueJGg8NMyP5iFQM,6082
|
|
41
|
+
fleet/_async/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
|
+
fleet/_async/resources/base.py,sha256=UfrenxUqcpL8SgYGOo8o8HgRvv2-ZO5G2Cdo91ofEdg,664
|
|
43
|
+
fleet/_async/resources/browser.py,sha256=oldoSiymJ1lJkADhpUG81ViOBDNyppX1jSoEwe9-W94,1369
|
|
44
|
+
fleet/_async/resources/mcp.py,sha256=TLEsLiFhfVfZFs0Fu_uDPm-h4FPdvqgQblYqs-PTHhc,1720
|
|
45
|
+
fleet/_async/resources/sqlite.py,sha256=h6pX41j8_aJaeZ7UVs25QQGgMWbHMPlGpDnPGMIAF6w,26133
|
|
46
|
+
fleet/_async/verifiers/__init__.py,sha256=1WTlCNq4tIFbbXaQu5Bf2WppZq0A8suhtZbxMTSOwxI,465
|
|
47
|
+
fleet/_async/verifiers/bundler.py,sha256=Sq0KkqEhM5Ng2x8R6Z4puXvQ8FMlEO7D3-ldBLktPi4,26205
|
|
48
|
+
fleet/_async/verifiers/verifier.py,sha256=lwVIV5ZpWJhM87tXShtjwN5KP7n5XDcPq0XX7AjV6_E,14343
|
|
49
|
+
fleet/env/__init__.py,sha256=6-zgP705M61tCquiDKw29dBZGq1US9mtsB1gQngJ4FQ,664
|
|
50
|
+
fleet/env/client.py,sha256=WcYc4_k7iUP-CSzhurHqcQXjl43O0C5pliVlk019n_M,799
|
|
51
|
+
fleet/instance/__init__.py,sha256=CyWUkbGAK-DBPw4DC4AnCW-MqqheGhZMA5QSRVu-ws4,479
|
|
52
|
+
fleet/instance/base.py,sha256=OYqzBwZFfTX9wlBGSG5gljqj98NbiJeKIfFJ3uj5I4s,1587
|
|
53
|
+
fleet/instance/client.py,sha256=6Jc3OMmm7mPit7SWRCf8ZTfqyFgOOMJIawsqRnOY_Nw,5894
|
|
54
|
+
fleet/instance/models.py,sha256=ZTiue0YOuhuwX8jYfJAoCzGfqjLqqXRLqK1LVFhq6rQ,4183
|
|
55
|
+
fleet/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
|
+
fleet/resources/base.py,sha256=AXZzT0_yWHkT497q3yekfr0xsD4cPGMCC6y7C43TIkk,663
|
|
57
|
+
fleet/resources/browser.py,sha256=hRNM0YMsVQUAraZGNi_B-KXxLpuddy4ntoEDFSw7czU,1295
|
|
58
|
+
fleet/resources/mcp.py,sha256=ptWC4sOhk5Slwr7p3USgGX0nM0K98726BxP8BhtSLaU,1486
|
|
59
|
+
fleet/resources/sqlite.py,sha256=dof2oQr7-GxscpyIZXlKJvp59AYoiF9_Ghdq5EzdVdY,25705
|
|
60
|
+
fleet/verifiers/__init__.py,sha256=IlImvlfgMRQ2V6f4_n7skXYBV8ZoUUjnWaFKnYQQsU8,459
|
|
61
|
+
fleet/verifiers/bundler.py,sha256=Sq0KkqEhM5Ng2x8R6Z4puXvQ8FMlEO7D3-ldBLktPi4,26205
|
|
62
|
+
fleet/verifiers/code.py,sha256=A1i_UabZspbyj1awzKVQ_HRxgMO3fU7NbkxYyTrp7So,48
|
|
63
|
+
fleet/verifiers/db.py,sha256=tssmvJjDHuBIy8qlL_P5-UdmEFUw2DZcqLsWZ8ot3Xw,27766
|
|
64
|
+
fleet/verifiers/decorator.py,sha256=nAP3O8szXu7md_kpwpz91hGSUNEVLYjwZQZTkQlV1DM,3260
|
|
65
|
+
fleet/verifiers/parse.py,sha256=0bAbj9VvT__yU4ZVREUK-Tn9dukh9LCpmfVsgj1DfP4,8508
|
|
66
|
+
fleet/verifiers/sql_differ.py,sha256=dmiGCFXVMEMbAX519OjhVqgA8ZvhnvdmC1BVpL7QCF0,6490
|
|
67
|
+
fleet/verifiers/verifier.py,sha256=jbWRqBUX0Cu6NPzU_2yCXAR_Avq1rJdcBIxJPH1Inhs,13896
|
|
68
|
+
fleet_python-0.2.32.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
69
|
+
scripts/fix_sync_imports.py,sha256=0XKTkAV7WdMxRfk8-x4Ts1LjSbUpyI0tPL0DcTQ_38w,7308
|
|
70
|
+
scripts/unasync.py,sha256=vWVQxRWX8SRZO5cmzEhpvnG_REhCWXpidIGIpWmEcvI,696
|
|
71
|
+
fleet_python-0.2.32.dist-info/METADATA,sha256=hw7hTd_JKk8DxieuOXfjpLIUb2-R1_65AMMz0Sa1T4c,3354
|
|
72
|
+
fleet_python-0.2.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
73
|
+
fleet_python-0.2.32.dist-info/top_level.txt,sha256=_3DSmTohvSDf3AIP_BYfGzhwO1ECFwuzg83X-wHCx3Y,23
|
|
74
|
+
fleet_python-0.2.32.dist-info/RECORD,,
|
scripts/fix_sync_imports.py
CHANGED
|
@@ -4,121 +4,148 @@
|
|
|
4
4
|
import re
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
def fix_file(filepath: Path) -> bool:
|
|
8
9
|
"""Fix imports and sleep calls in a single file."""
|
|
9
10
|
content = filepath.read_text()
|
|
10
11
|
original = content
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
# Handle asyncio imports - replace with inspect in verifier files, remove elsewhere
|
|
13
|
-
if
|
|
14
|
+
if "verifier" in str(filepath).lower() and "iscoroutinefunction" in content:
|
|
14
15
|
# In verifier files, replace asyncio with inspect
|
|
15
|
-
content = re.sub(
|
|
16
|
-
|
|
16
|
+
content = re.sub(
|
|
17
|
+
r"^import asyncio\b", "import inspect", content, flags=re.MULTILINE
|
|
18
|
+
)
|
|
19
|
+
content = content.replace(
|
|
20
|
+
"asyncio.iscoroutinefunction", "inspect.iscoroutinefunction"
|
|
21
|
+
)
|
|
17
22
|
else:
|
|
18
23
|
# In other files, remove asyncio imports
|
|
19
|
-
content = re.sub(r
|
|
20
|
-
content = re.sub(
|
|
24
|
+
content = re.sub(r"^import asyncio.*\n", "", content, flags=re.MULTILINE)
|
|
25
|
+
content = re.sub(
|
|
26
|
+
r"^import asyncio as async_time.*\n", "", content, flags=re.MULTILINE
|
|
27
|
+
)
|
|
21
28
|
# Also remove indented asyncio imports (like in functions)
|
|
22
|
-
content = re.sub(r
|
|
23
|
-
|
|
29
|
+
content = re.sub(r"^\s+import asyncio.*\n", "", content, flags=re.MULTILINE)
|
|
30
|
+
|
|
24
31
|
# Fix any remaining asyncio.sleep or async_time.sleep calls
|
|
25
|
-
content = content.replace(
|
|
26
|
-
content = content.replace(
|
|
27
|
-
|
|
32
|
+
content = content.replace("asyncio.sleep(", "time.sleep(")
|
|
33
|
+
content = content.replace("async_time.sleep(", "time.sleep(")
|
|
34
|
+
|
|
28
35
|
# Fix absolute imports to relative imports for verifiers based on file location
|
|
29
36
|
rel_path = filepath.relative_to(Path(__file__).parent.parent / "fleet")
|
|
30
37
|
depth = len(rel_path.parts) - 1 # -1 because the file itself doesn't count
|
|
31
38
|
|
|
32
39
|
# Fix verifier imports specifically - only in non-verifiers directories
|
|
33
|
-
if
|
|
34
|
-
content = content.replace(
|
|
35
|
-
|
|
40
|
+
if "verifiers" not in str(rel_path):
|
|
41
|
+
content = content.replace("from ..verifiers", "from .verifiers")
|
|
42
|
+
|
|
36
43
|
# Fix specific cases for verifiers/__init__.py
|
|
37
|
-
if rel_path == Path(
|
|
44
|
+
if rel_path == Path("verifiers/__init__.py"):
|
|
38
45
|
# These should be relative imports within the verifiers package
|
|
39
|
-
content = content.replace(
|
|
40
|
-
content = content.replace(
|
|
46
|
+
content = content.replace("from ...verifiers.db import", "from .db import")
|
|
47
|
+
content = content.replace("from ...verifiers.code import", "from .code import")
|
|
41
48
|
# Also handle the case where unasync transformed fleet.verifiers to ..verifiers
|
|
42
|
-
content = content.replace(
|
|
43
|
-
content = content.replace(
|
|
44
|
-
|
|
49
|
+
content = content.replace("from ..verifiers.db import", "from .db import")
|
|
50
|
+
content = content.replace("from ..verifiers.code import", "from .code import")
|
|
51
|
+
|
|
45
52
|
# Fix any remaining AsyncFleetPlaywrightWrapper references in docstrings
|
|
46
|
-
content = content.replace(
|
|
47
|
-
|
|
53
|
+
content = content.replace("AsyncFleetPlaywrightWrapper", "FleetPlaywrightWrapper")
|
|
54
|
+
|
|
48
55
|
# Fix httpx transport classes
|
|
49
|
-
content = content.replace(
|
|
50
|
-
|
|
56
|
+
content = content.replace("httpx.SyncHTTPTransport", "httpx.HTTPTransport")
|
|
57
|
+
|
|
51
58
|
# Fix imports based on file location
|
|
52
59
|
# Since async code now imports from sync models/config, we need to fix the generated sync imports
|
|
53
60
|
rel_path = filepath.relative_to(Path(__file__).parent.parent / "fleet")
|
|
54
|
-
|
|
61
|
+
|
|
55
62
|
# Fix imports for files in different subdirectories
|
|
56
63
|
if "fleet/instance" in str(filepath):
|
|
57
64
|
# Files in fleet/instance/ should use .. for fleet level imports
|
|
58
|
-
content = content.replace(
|
|
59
|
-
content = content.replace(
|
|
65
|
+
content = content.replace("from ...config import", "from ..config import")
|
|
66
|
+
content = content.replace(
|
|
67
|
+
"from ...instance.models import", "from .models import"
|
|
68
|
+
)
|
|
60
69
|
elif "fleet/env" in str(filepath):
|
|
61
70
|
# Files in fleet/env/ should use .. for fleet level imports
|
|
62
|
-
content = content.replace(
|
|
71
|
+
content = content.replace("from ...models import", "from ..models import")
|
|
63
72
|
elif "fleet/resources" in str(filepath):
|
|
64
73
|
# Files in fleet/resources/ should use .. for fleet level imports
|
|
65
|
-
content = content.replace(
|
|
66
|
-
|
|
74
|
+
content = content.replace(
|
|
75
|
+
"from ...instance.models import", "from ..instance.models import"
|
|
76
|
+
)
|
|
77
|
+
|
|
67
78
|
# Fix imports in top-level fleet files
|
|
68
|
-
if rel_path.parts[0] in [
|
|
79
|
+
if rel_path.parts[0] in ["base.py", "client.py"] and len(rel_path.parts) == 1:
|
|
69
80
|
# Top-level files should use . for fleet level imports
|
|
70
|
-
content = content.replace(
|
|
71
|
-
content = content.replace(
|
|
72
|
-
|
|
81
|
+
content = content.replace("from ..models import", "from .models import")
|
|
82
|
+
content = content.replace("from ..config import", "from .config import")
|
|
83
|
+
|
|
73
84
|
# Fix __init__.py imports - the class is called SyncEnv, not Environment
|
|
74
|
-
if rel_path.parts[0] ==
|
|
75
|
-
content = content.replace(
|
|
85
|
+
if rel_path.parts[0] == "__init__.py" and len(rel_path.parts) == 1:
|
|
86
|
+
content = content.replace(
|
|
87
|
+
"from .client import Fleet, Environment",
|
|
88
|
+
"from .client import Fleet, SyncEnv",
|
|
89
|
+
)
|
|
76
90
|
content = content.replace('"Environment",', '"SyncEnv",')
|
|
77
91
|
content = content.replace("'Environment',", "'SyncEnv',")
|
|
78
|
-
|
|
92
|
+
|
|
79
93
|
# Add async-to-sync conversion to client.py _create_verifier_from_data method
|
|
80
|
-
if rel_path.parts[0] ==
|
|
94
|
+
if rel_path.parts[0] == "client.py" and len(rel_path.parts) == 1:
|
|
81
95
|
# Find the _create_verifier_from_data method and add async-to-sync conversion
|
|
82
|
-
if
|
|
96
|
+
if (
|
|
97
|
+
"_create_verifier_from_data" in content
|
|
98
|
+
and "from .verifiers.verifier import SyncVerifierFunction" in content
|
|
99
|
+
):
|
|
83
100
|
# Look for the line where we have the verifier_code and add conversion before any other processing
|
|
84
|
-
insertion_point =
|
|
101
|
+
insertion_point = "from .verifiers.verifier import SyncVerifierFunction"
|
|
85
102
|
if insertion_point in content:
|
|
86
|
-
replacement =
|
|
103
|
+
replacement = (
|
|
104
|
+
insertion_point
|
|
105
|
+
+ """
|
|
87
106
|
|
|
88
107
|
# Convert async verifier code to sync
|
|
89
108
|
if 'async def' in verifier_code:
|
|
90
109
|
verifier_code = verifier_code.replace('async def', 'def')
|
|
91
110
|
if 'await ' in verifier_code:
|
|
92
|
-
verifier_code = verifier_code.replace('await ', '')
|
|
93
|
-
|
|
111
|
+
verifier_code = verifier_code.replace('await ', '')"""
|
|
112
|
+
)
|
|
113
|
+
|
|
94
114
|
content = content.replace(insertion_point, replacement)
|
|
95
|
-
|
|
115
|
+
|
|
96
116
|
# Fix playwright imports for sync version
|
|
97
|
-
if
|
|
117
|
+
if "playwright" in str(filepath):
|
|
98
118
|
# Fix the import statement
|
|
99
|
-
content = content.replace(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
119
|
+
content = content.replace(
|
|
120
|
+
"from playwright.async_api import sync_playwright, Browser, Page",
|
|
121
|
+
"from playwright.sync_api import sync_playwright, Browser, Page",
|
|
122
|
+
)
|
|
123
|
+
content = content.replace(
|
|
124
|
+
"from playwright.async_api import async_playwright, Browser, Page",
|
|
125
|
+
"from playwright.sync_api import sync_playwright, Browser, Page",
|
|
126
|
+
)
|
|
103
127
|
# Replace any remaining async_playwright references
|
|
104
|
-
content = content.replace(
|
|
128
|
+
content = content.replace("async_playwright", "sync_playwright")
|
|
105
129
|
# Fix await statements in docstrings
|
|
106
|
-
content = content.replace(
|
|
107
|
-
content = content.replace(
|
|
108
|
-
content = content.replace(
|
|
109
|
-
content = content.replace(
|
|
130
|
+
content = content.replace("await browser.start()", "browser.start()")
|
|
131
|
+
content = content.replace("await browser.screenshot()", "browser.screenshot()")
|
|
132
|
+
content = content.replace("await browser.close()", "browser.close()")
|
|
133
|
+
content = content.replace("await fleet.env.make(", "fleet.env.make(")
|
|
110
134
|
# Fix error message
|
|
111
|
-
content = content.replace(
|
|
112
|
-
|
|
135
|
+
content = content.replace(
|
|
136
|
+
"Call await browser.start() first", "Call browser.start() first"
|
|
137
|
+
)
|
|
138
|
+
|
|
113
139
|
if content != original:
|
|
114
140
|
filepath.write_text(content)
|
|
115
141
|
return True
|
|
116
142
|
return False
|
|
117
143
|
|
|
144
|
+
|
|
118
145
|
def main():
|
|
119
146
|
"""Fix all sync files."""
|
|
120
147
|
sync_dir = Path(__file__).parent.parent / "fleet"
|
|
121
|
-
|
|
148
|
+
|
|
122
149
|
# Process all Python files in the fleet directory (excluding _async)
|
|
123
150
|
fixed_count = 0
|
|
124
151
|
for filepath in sync_dir.rglob("*.py"):
|
|
@@ -126,9 +153,10 @@ def main():
|
|
|
126
153
|
if fix_file(filepath):
|
|
127
154
|
print(f"Fixed {filepath}")
|
|
128
155
|
fixed_count += 1
|
|
129
|
-
|
|
156
|
+
|
|
130
157
|
if fixed_count == 0:
|
|
131
158
|
print("No files needed fixing")
|
|
132
159
|
|
|
160
|
+
|
|
133
161
|
if __name__ == "__main__":
|
|
134
|
-
main()
|
|
162
|
+
main()
|
scripts/unasync.py
CHANGED
|
@@ -5,24 +5,25 @@ import subprocess
|
|
|
5
5
|
import sys
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
def run_unasync():
|
|
9
10
|
"""Run unasync on the fleet/_async directory."""
|
|
10
11
|
print("Running unasync to generate sync code...")
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
try:
|
|
13
14
|
# Run unasync
|
|
14
|
-
subprocess.run(
|
|
15
|
-
sys.executable, "-m", "unasync",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
subprocess.run(
|
|
16
|
+
[sys.executable, "-m", "unasync", "fleet/_async", "fleet", "--no-cache"],
|
|
17
|
+
check=True,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
20
|
print("Successfully generated sync code from async sources.")
|
|
21
21
|
return 0
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
except subprocess.CalledProcessError as e:
|
|
24
24
|
print(f"Error running unasync: {e}")
|
|
25
25
|
return 1
|
|
26
26
|
|
|
27
|
+
|
|
27
28
|
if __name__ == "__main__":
|
|
28
|
-
sys.exit(run_unasync())
|
|
29
|
+
sys.exit(run_unasync())
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
examples/diff_example.py,sha256=zXEPFC-_Ap_uEihf0Shs5R7W7Pq1I5i_Y_KC-TYxyQw,5643
|
|
2
|
-
examples/dsl_example.py,sha256=ApdJ8Dj4ZSHyE04M6pMFhWoACdkuvUSVKfEymSPs9Oc,7190
|
|
3
|
-
examples/example.py,sha256=SAz5iPxca8n9MvnHVoWHI7GCaTgJwkegX78rMutF9gE,1082
|
|
4
|
-
examples/example_action_log.py,sha256=XrLqFNS8hD-K6nKVSohYi6oJkYotLCZJYJsGSbHuqEc,627
|
|
5
|
-
examples/example_client.py,sha256=70HKEhz_Gb79YcvKQauCPdS08AAwjo9unt2dh1jN_Oo,1030
|
|
6
|
-
examples/example_mcp_anthropic.py,sha256=iyO0OCem5SWEtJQGan6pBuGfN3LZXeeIN9DdMHw9f9M,2542
|
|
7
|
-
examples/example_mcp_openai.py,sha256=5BQzMWrNdtBrBCNcUYgU6qB9Aabc10UTMKvaFb4NerI,492
|
|
8
|
-
examples/example_sync.py,sha256=l8l-QOGTMnijiSK0mt5aofzXqbv-kKU3WCow4QS-7yg,976
|
|
9
|
-
examples/example_task.py,sha256=W6Cuhtb06FWv2N972KjdVBdbNzkHwLBEZBTAeoHrweQ,7014
|
|
10
|
-
examples/example_tasks.py,sha256=tZMtT7wNzv6jb4VYoEKeR0eX-dJhwajTtoBN-os6-I4,776
|
|
11
|
-
examples/example_verifier.py,sha256=PfGphI6gnfhSM_SRb4KyhHYddJmapk2hhRrSIaxAtr4,2025
|
|
12
|
-
examples/gemini_example.py,sha256=8mDXGGCaodyK6uXgpWhxi-DQ5OA-GFW12Gfwh0b3EDY,16177
|
|
13
|
-
examples/json_tasks_example.py,sha256=3ub2LLiC6hXpVEH1175QxCmfCD3Blfo3yoG85uV5CS8,5334
|
|
14
|
-
examples/nova_act_example.py,sha256=hZLpObVsiXKQzqGwMZVMf4A2j_z4TYE-YO9pgNmaKPk,836
|
|
15
|
-
examples/openai_example.py,sha256=I2vk_SJN9BkSRQCYRJfbtGJ-HJ2xzQj-lOjwqmLos5M,8234
|
|
16
|
-
examples/openai_simple_example.py,sha256=I42ytIwv0INgDO39pp1MOQSqsJz2YYH8GeNNBaUtq3A,1748
|
|
17
|
-
examples/query_builder_example.py,sha256=Q3lUBETHpu1aS2FXAO79ADYqCxOjMMMZNgCcFVapiII,3918
|
|
18
|
-
examples/quickstart.py,sha256=1VT39IRRhemsJgxi0O0gprdpcw7HB4pYO97GAYagIcg,3788
|
|
19
|
-
fleet/__init__.py,sha256=2WHAk_ZRIxDs1uxrWf-sSeokiK4f_nDVHJJ1_VUFSPA,2306
|
|
20
|
-
fleet/base.py,sha256=0yYuMN0lBkrfTTZBt5NQp5112xWgziuWEk4GuHJB1wE,9189
|
|
21
|
-
fleet/client.py,sha256=GxpQufucXEJedb0MWE1wZL1G40CLV1c-GzUsUYNSxmU,22475
|
|
22
|
-
fleet/config.py,sha256=rqR-y2TbZS-VYACaqrg-PUe0y0UDbR1ZNU1KGJZBwNQ,272
|
|
23
|
-
fleet/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
24
|
-
fleet/models.py,sha256=6SqoWdTIygF3jriZW53a-jQ1JZoPatuWZ4JQ1qIY5MY,12453
|
|
25
|
-
fleet/tasks.py,sha256=koyaRk-ytn4yM5oOpGLHrY73KxtJyyJHsdhUFpTjPkk,3400
|
|
26
|
-
fleet/types.py,sha256=eXeI8BFmiU5hln0PVvJbUZs7BSjl6wSqAtN9zaJT6yY,652
|
|
27
|
-
fleet/_async/__init__.py,sha256=AJWCnuo7XKja4yBb8fK2wX7ntciLXQrpzdRHwjTRP6M,62
|
|
28
|
-
fleet/_async/base.py,sha256=s0rYOtXsMJeitOvpa-Oh8ciLV226p_TIPp3fplzWvV4,9209
|
|
29
|
-
fleet/_async/client.py,sha256=DMLjGtLpeDzl2bJ8VO753IzzvLaR0l9TeP5C8fmlfio,22382
|
|
30
|
-
fleet/_async/exceptions.py,sha256=fUmPwWhnT8SR97lYsRq0kLHQHKtSh2eJS0VQ2caSzEI,5055
|
|
31
|
-
fleet/_async/models.py,sha256=6SqoWdTIygF3jriZW53a-jQ1JZoPatuWZ4JQ1qIY5MY,12453
|
|
32
|
-
fleet/_async/tasks.py,sha256=WXZNGHYzNBeG5QF6EjOMNFpR5x3XZMdAwuwxZRTwFJI,4231
|
|
33
|
-
fleet/_async/env/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
34
|
-
fleet/_async/env/client.py,sha256=LJ0P9Dn06RhmzVCC9hnTTqd9k0LcWOaQ5nm4G7y1sOY,969
|
|
35
|
-
fleet/_async/instance/__init__.py,sha256=PtmJq8J8bh0SOQ2V55QURz5GJfobozwtQoqhaOk3_tI,515
|
|
36
|
-
fleet/_async/instance/base.py,sha256=3qUBuUR8OVS36LzdP6KyZzngtwPKYO09HoY6Ekxp-KA,1625
|
|
37
|
-
fleet/_async/instance/client.py,sha256=2ZNoBxRJXDQc8fohCLy_RNo-wmuUKXzJo5RZQeCQnkQ,6069
|
|
38
|
-
fleet/_async/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
fleet/_async/resources/base.py,sha256=ZFx2I9L7px-Z8LvbPUZJtbtajpqUn1yS1NFbZZutP9Q,668
|
|
40
|
-
fleet/_async/resources/browser.py,sha256=oldoSiymJ1lJkADhpUG81ViOBDNyppX1jSoEwe9-W94,1369
|
|
41
|
-
fleet/_async/resources/sqlite.py,sha256=DvDLRI5dJ7_v4WkHw-Zday1M_FQUdzAqUCy9FtfOY8w,26636
|
|
42
|
-
fleet/_async/verifiers/__init__.py,sha256=7dtLOFgirYQmEIiDMcx02-ZqR7yqrfjOiqBBuXBz914,466
|
|
43
|
-
fleet/_async/verifiers/bundler.py,sha256=A4yR3wBOcVZYFAv87CD58QlJn6L4QXeilrasnVm8n74,26185
|
|
44
|
-
fleet/_async/verifiers/verifier.py,sha256=vS2Nv-tLgDa_1xhMHdkw0297uNMzzSlRPsXe4zIJsqw,14528
|
|
45
|
-
fleet/env/__init__.py,sha256=w88In82IhmuGpRMW-bPlWGLTqdSWH2ic9eU6-8L8Rps,631
|
|
46
|
-
fleet/env/client.py,sha256=WbjtYME1N4_Z88HDoLtsrNHRw8N5XNuXvRK8w48K-So,796
|
|
47
|
-
fleet/instance/__init__.py,sha256=-Anms7Vw_FO8VBIvwnAnq4rQjwl_XNfAS-i7bypHMow,478
|
|
48
|
-
fleet/instance/base.py,sha256=OYqzBwZFfTX9wlBGSG5gljqj98NbiJeKIfFJ3uj5I4s,1587
|
|
49
|
-
fleet/instance/client.py,sha256=0gNXWRKNSXUqVTf6E5VUFO2gEZrBTF87QnvpLr5xaD8,5895
|
|
50
|
-
fleet/instance/models.py,sha256=ZTiue0YOuhuwX8jYfJAoCzGfqjLqqXRLqK1LVFhq6rQ,4183
|
|
51
|
-
fleet/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
|
-
fleet/resources/base.py,sha256=203gD54NP1IvjuSqFo-f7FvrkhtjChggtzrxJK7xf2E,667
|
|
53
|
-
fleet/resources/browser.py,sha256=hRNM0YMsVQUAraZGNi_B-KXxLpuddy4ntoEDFSw7czU,1295
|
|
54
|
-
fleet/resources/mcp.py,sha256=lDMyY4pMC3Khwp2Wycc6Ds6KeLAUOgHkDnmztuAnXm8,1872
|
|
55
|
-
fleet/resources/sqlite.py,sha256=FeAykW7T0Pol7ckDLCtcjJDHDTI7y9ilWp7fnw4tuM8,26266
|
|
56
|
-
fleet/verifiers/__init__.py,sha256=qfjAuF_QKu7rPD8yNtBcGMaAUiyCoECDma3MHgSTUuQ,459
|
|
57
|
-
fleet/verifiers/bundler.py,sha256=A4yR3wBOcVZYFAv87CD58QlJn6L4QXeilrasnVm8n74,26185
|
|
58
|
-
fleet/verifiers/code.py,sha256=EOi6ES8Zdzlm9iybRFaJmz9t2W4Ulo2wrCdbEBqxzbc,47
|
|
59
|
-
fleet/verifiers/db.py,sha256=tssmvJjDHuBIy8qlL_P5-UdmEFUw2DZcqLsWZ8ot3Xw,27766
|
|
60
|
-
fleet/verifiers/decorator.py,sha256=Q-KHhicnIYFwX7FX_VZguzNfu8ZslqNUeWxcS2CwNVY,3386
|
|
61
|
-
fleet/verifiers/parse.py,sha256=W4cBnto-XfPNrRwsYs7PFR3QJoI5UfWyB-QWsm1jUEg,7844
|
|
62
|
-
fleet/verifiers/sql_differ.py,sha256=dmiGCFXVMEMbAX519OjhVqgA8ZvhnvdmC1BVpL7QCF0,6490
|
|
63
|
-
fleet/verifiers/verifier.py,sha256=7yiqko332lX0pgjbyAQ6KbaGm_V8TX864ceH-4fvvW0,14470
|
|
64
|
-
fleet_python-0.2.29.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
65
|
-
scripts/fix_sync_imports.py,sha256=m2OHz1lCAdDVIRhPvn8grNXpRaPo1b99dRMYI7TiEes,7117
|
|
66
|
-
scripts/unasync.py,sha256=--Fmaae47o-dZ1HYgX1c3Nvi-rMjcFymTRlJcWWnmpw,725
|
|
67
|
-
fleet_python-0.2.29.dist-info/METADATA,sha256=jEanmSO_HJs7L4Xhw0a_iWu5SPqVH9F3ieqV94BmVBA,3347
|
|
68
|
-
fleet_python-0.2.29.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
69
|
-
fleet_python-0.2.29.dist-info/top_level.txt,sha256=_3DSmTohvSDf3AIP_BYfGzhwO1ECFwuzg83X-wHCx3Y,23
|
|
70
|
-
fleet_python-0.2.29.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|