fleet-python 0.2.12__py3-none-any.whl → 0.2.15__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.

Files changed (51) hide show
  1. examples/diff_example.py +161 -0
  2. examples/dsl_example.py +50 -1
  3. examples/example.py +1 -1
  4. examples/example_action_log.py +28 -0
  5. examples/example_mcp_anthropic.py +77 -0
  6. examples/example_mcp_openai.py +27 -0
  7. examples/example_sync.py +1 -1
  8. examples/example_task.py +199 -0
  9. examples/example_verifier.py +71 -0
  10. examples/query_builder_example.py +117 -0
  11. fleet/__init__.py +51 -40
  12. fleet/_async/base.py +15 -2
  13. fleet/_async/client.py +141 -23
  14. fleet/_async/env/client.py +5 -5
  15. fleet/_async/instance/__init__.py +2 -3
  16. fleet/_async/instance/base.py +5 -2
  17. fleet/_async/instance/client.py +5 -4
  18. fleet/_async/playwright.py +2 -2
  19. fleet/_async/resources/base.py +1 -1
  20. fleet/_async/resources/browser.py +1 -1
  21. fleet/_async/resources/sqlite.py +656 -2
  22. fleet/_async/tasks.py +44 -0
  23. fleet/_async/verifiers/__init__.py +17 -0
  24. fleet/_async/verifiers/bundler.py +699 -0
  25. fleet/_async/verifiers/verifier.py +301 -0
  26. fleet/base.py +14 -1
  27. fleet/client.py +650 -17
  28. fleet/config.py +2 -1
  29. fleet/instance/__init__.py +1 -2
  30. fleet/instance/base.py +5 -2
  31. fleet/instance/client.py +16 -6
  32. fleet/models.py +171 -4
  33. fleet/resources/browser.py +7 -8
  34. fleet/resources/mcp.py +60 -0
  35. fleet/resources/sqlite.py +654 -0
  36. fleet/tasks.py +44 -0
  37. fleet/types.py +18 -0
  38. fleet/verifiers/__init__.py +11 -5
  39. fleet/verifiers/bundler.py +699 -0
  40. fleet/verifiers/decorator.py +103 -0
  41. fleet/verifiers/verifier.py +301 -0
  42. {fleet_python-0.2.12.dist-info → fleet_python-0.2.15.dist-info}/METADATA +3 -42
  43. fleet_python-0.2.15.dist-info/RECORD +69 -0
  44. scripts/fix_sync_imports.py +30 -12
  45. fleet/_async/config.py +0 -8
  46. fleet/_async/instance/models.py +0 -141
  47. fleet/_async/models.py +0 -109
  48. fleet_python-0.2.12.dist-info/RECORD +0 -55
  49. {fleet_python-0.2.12.dist-info → fleet_python-0.2.15.dist-info}/WHEEL +0 -0
  50. {fleet_python-0.2.12.dist-info → fleet_python-0.2.15.dist-info}/licenses/LICENSE +0 -0
  51. {fleet_python-0.2.12.dist-info → fleet_python-0.2.15.dist-info}/top_level.txt +0 -0
fleet/tasks.py ADDED
@@ -0,0 +1,44 @@
1
+ """Fleet SDK Task Model."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import re
6
+ from datetime import datetime
7
+ from typing import Any, Dict, Optional
8
+ from uuid import UUID
9
+
10
+ from pydantic import BaseModel, Field, validator
11
+
12
+ # Import the shared VerifierFunction type that works for both async and sync
13
+ from ..types import VerifierFunction
14
+
15
+
16
+ class Task(BaseModel):
17
+ """A task model representing a single task in the Fleet system."""
18
+
19
+ key: str = Field(..., description="Unique task key identifier")
20
+ prompt: str = Field(..., description="Task prompt or instruction")
21
+ env_id: str = Field(..., description="Environment identifier")
22
+ created_at: Optional[datetime] = Field(None, description="Task creation timestamp")
23
+ verifier: Optional[Any] = Field(None, description="Verifier function with decorator (async or sync)")
24
+ metadata: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Additional task metadata")
25
+
26
+ @validator('key')
27
+ def validate_key_format(cls, v):
28
+ """Validate key follows kebab-case format."""
29
+ if not re.match(r'^[a-z0-9]+(-[a-z0-9]+)*$', v):
30
+ raise ValueError(f'Invalid task key format: {v}. Must follow kebab-case format.')
31
+ return v
32
+
33
+ @validator('created_at', pre=True, always=True)
34
+ def set_created_at(cls, v):
35
+ """Set created_at to current time if not provided."""
36
+ return v or datetime.now()
37
+
38
+ class Config:
39
+ """Pydantic model configuration."""
40
+ json_encoders = {
41
+ datetime: lambda v: v.isoformat(),
42
+ }
43
+ # Allow arbitrary types for the verifier field
44
+ arbitrary_types_allowed = True
fleet/types.py ADDED
@@ -0,0 +1,18 @@
1
+ """Fleet SDK Type Definitions.
2
+
3
+ This file contains type definitions that are shared between async and sync versions.
4
+ It is not processed by unasync, so we can define union types that work correctly
5
+ for both async and sync verifier functions.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from typing import Union, TYPE_CHECKING
11
+
12
+ if TYPE_CHECKING:
13
+ from .verifiers import SyncVerifierFunction
14
+ from ._async.verifiers import AsyncVerifierFunction
15
+
16
+ # Union type to support both async and sync verifiers
17
+ # This definition works for both the async and sync versions of the codebase
18
+ VerifierFunction = Union["SyncVerifierFunction", "AsyncVerifierFunction"]
@@ -1,11 +1,17 @@
1
- """Fleet verifiers module - database snapshot validation utilities."""
1
+ """Fleet verifiers module - database snapshot validation utilities and verifier decorator."""
2
2
 
3
- from .db import DatabaseSnapshot, IgnoreConfig, SnapshotDiff
4
- from .code import TASK_SUCCESSFUL_SCORE
3
+ from fleet.verifiers.db import DatabaseSnapshot, IgnoreConfig, SnapshotDiff
4
+ from fleet.verifiers.code import TASK_SUCCESSFUL_SCORE
5
+ from .decorator import (
6
+ verifier,
7
+ SyncVerifierFunction,
8
+ )
5
9
 
6
10
  __all__ = [
7
11
  "DatabaseSnapshot",
8
- "IgnoreConfig",
12
+ "IgnoreConfig",
9
13
  "SnapshotDiff",
10
14
  "TASK_SUCCESSFUL_SCORE",
11
- ]
15
+ "verifier",
16
+ "SyncVerifierFunction",
17
+ ]