fleet-python 0.2.27__tar.gz → 0.2.28__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 (75) hide show
  1. {fleet_python-0.2.27 → fleet_python-0.2.28}/PKG-INFO +1 -1
  2. fleet_python-0.2.28/fleet/tasks.py +82 -0
  3. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet_python.egg-info/PKG-INFO +1 -1
  4. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet_python.egg-info/SOURCES.txt +1 -0
  5. {fleet_python-0.2.27 → fleet_python-0.2.28}/pyproject.toml +1 -1
  6. {fleet_python-0.2.27 → fleet_python-0.2.28}/LICENSE +0 -0
  7. {fleet_python-0.2.27 → fleet_python-0.2.28}/README.md +0 -0
  8. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/diff_example.py +0 -0
  9. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/dsl_example.py +0 -0
  10. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example.py +0 -0
  11. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_action_log.py +0 -0
  12. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_client.py +0 -0
  13. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_mcp_anthropic.py +0 -0
  14. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_mcp_openai.py +0 -0
  15. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_sync.py +0 -0
  16. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_task.py +0 -0
  17. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_tasks.py +0 -0
  18. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/example_verifier.py +0 -0
  19. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/gemini_example.py +0 -0
  20. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/json_tasks_example.py +0 -0
  21. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/nova_act_example.py +0 -0
  22. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/openai_example.py +0 -0
  23. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/openai_simple_example.py +0 -0
  24. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/query_builder_example.py +0 -0
  25. {fleet_python-0.2.27 → fleet_python-0.2.28}/examples/quickstart.py +0 -0
  26. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/__init__.py +0 -0
  27. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/__init__.py +0 -0
  28. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/base.py +0 -0
  29. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/client.py +0 -0
  30. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/env/__init__.py +0 -0
  31. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/env/client.py +0 -0
  32. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/exceptions.py +0 -0
  33. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/instance/__init__.py +0 -0
  34. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/instance/base.py +0 -0
  35. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/instance/client.py +0 -0
  36. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/models.py +0 -0
  37. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/resources/__init__.py +0 -0
  38. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/resources/base.py +0 -0
  39. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/resources/browser.py +0 -0
  40. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/resources/sqlite.py +0 -0
  41. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/tasks.py +0 -0
  42. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/verifiers/__init__.py +0 -0
  43. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/verifiers/bundler.py +0 -0
  44. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/_async/verifiers/verifier.py +0 -0
  45. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/base.py +0 -0
  46. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/client.py +0 -0
  47. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/config.py +0 -0
  48. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/env/__init__.py +0 -0
  49. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/env/client.py +0 -0
  50. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/exceptions.py +0 -0
  51. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/instance/__init__.py +0 -0
  52. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/instance/base.py +0 -0
  53. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/instance/client.py +0 -0
  54. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/instance/models.py +0 -0
  55. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/models.py +0 -0
  56. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/resources/__init__.py +0 -0
  57. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/resources/base.py +0 -0
  58. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/resources/browser.py +0 -0
  59. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/resources/mcp.py +0 -0
  60. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/resources/sqlite.py +0 -0
  61. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/types.py +0 -0
  62. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/__init__.py +0 -0
  63. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/bundler.py +0 -0
  64. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/code.py +0 -0
  65. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/db.py +0 -0
  66. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/decorator.py +0 -0
  67. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/parse.py +0 -0
  68. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/sql_differ.py +0 -0
  69. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet/verifiers/verifier.py +0 -0
  70. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet_python.egg-info/dependency_links.txt +0 -0
  71. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet_python.egg-info/requires.txt +0 -0
  72. {fleet_python-0.2.27 → fleet_python-0.2.28}/fleet_python.egg-info/top_level.txt +0 -0
  73. {fleet_python-0.2.27 → fleet_python-0.2.28}/scripts/fix_sync_imports.py +0 -0
  74. {fleet_python-0.2.27 → fleet_python-0.2.28}/scripts/unasync.py +0 -0
  75. {fleet_python-0.2.27 → fleet_python-0.2.28}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.27
3
+ Version: 0.2.28
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -0,0 +1,82 @@
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 fleet.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
+ env_variables: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Environment variables")
23
+ created_at: Optional[datetime] = Field(None, description="Task creation timestamp")
24
+ version: Optional[str] = Field(None, description="Task version")
25
+ verifier_func: Optional[str] = Field(None, description="Verifier function code")
26
+ verifier: Optional[Any] = Field(None, description="Verifier function with decorator (async or sync)")
27
+ metadata: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Additional task metadata")
28
+
29
+ @validator('key')
30
+ def validate_key_format(cls, v):
31
+ """Validate key follows kebab-case format."""
32
+ if not re.match(r'^[a-z0-9]+(-[a-z0-9]+)*$', v):
33
+ raise ValueError(f'Invalid task key format: {v}. Must follow kebab-case format.')
34
+ return v
35
+
36
+ @validator('created_at', pre=True, always=True)
37
+ def set_created_at(cls, v):
38
+ """Set created_at to current time if not provided."""
39
+ return v or datetime.now()
40
+
41
+ @property
42
+ def env_key(self) -> str:
43
+ """Get the environment key combining env_id and version."""
44
+ if self.version:
45
+ return f"{self.env_id}:{self.version}"
46
+ return self.env_id
47
+
48
+ class Config:
49
+ """Pydantic model configuration."""
50
+ json_encoders = {
51
+ datetime: lambda v: v.isoformat(),
52
+ }
53
+ # Allow arbitrary types for the verifier field
54
+ arbitrary_types_allowed = True
55
+
56
+ def verify(self, env, *args, **kwargs) -> float:
57
+ """Verify the task using the verifier function (sync version).
58
+
59
+ For sync environments, calls the sync verifier directly.
60
+ For async verifiers, automatically runs them with asyncio.run().
61
+ """
62
+ if self.verifier:
63
+ return self.verifier.remote(env, *args, **kwargs)
64
+ else:
65
+ raise ValueError("No verifier function found for this task")
66
+
67
+ def verify_async(self, *args, **kwargs) -> float:
68
+ """Verify the task using the verifier function (async version).
69
+
70
+ For async environments, awaits the async verifier.
71
+ Works with both sync and async verifiers in async contexts.
72
+ """
73
+ if self.verifier:
74
+ result = self.verifier.remote(*args, **kwargs)
75
+ # If it's a coroutine, await it
76
+ import inspect
77
+ if inspect.iscoroutine(result):
78
+ return result
79
+ else:
80
+ return result
81
+ else:
82
+ raise ValueError("No verifier function found for this task")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.27
3
+ Version: 0.2.28
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -25,6 +25,7 @@ fleet/client.py
25
25
  fleet/config.py
26
26
  fleet/exceptions.py
27
27
  fleet/models.py
28
+ fleet/tasks.py
28
29
  fleet/types.py
29
30
  fleet/_async/__init__.py
30
31
  fleet/_async/base.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fleet-python"
7
- version = "0.2.27"
7
+ version = "0.2.28"
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