fleet-python 0.1.0__tar.gz → 0.1.1__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.
- {fleet_python-0.1.0/fleet_python.egg-info → fleet_python-0.1.1}/PKG-INFO +1 -1
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/__init__.py +1 -1
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/env/__init__.py +2 -12
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/env/base.py +33 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/env/factory.py +35 -144
- {fleet_python-0.1.0 → fleet_python-0.1.1/fleet_python.egg-info}/PKG-INFO +1 -1
- {fleet_python-0.1.0 → fleet_python-0.1.1}/pyproject.toml +1 -1
- {fleet_python-0.1.0 → fleet_python-0.1.1}/LICENSE +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/README.md +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/examples/quickstart.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/client.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/config.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/exceptions.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/facets/__init__.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/facets/base.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/facets/factory.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet/manager_client.py +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet_python.egg-info/SOURCES.txt +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet_python.egg-info/dependency_links.txt +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet_python.egg-info/requires.txt +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/fleet_python.egg-info/top_level.txt +0 -0
- {fleet_python-0.1.0 → fleet_python-0.1.1}/setup.cfg +0 -0
|
@@ -20,7 +20,7 @@ from .config import get_config, FleetConfig
|
|
|
20
20
|
from .client import FleetAPIClient, InstanceRequest, InstanceResponse, EnvDetails as APIEnvironment, HealthResponse, ManagerURLs, InstanceURLs
|
|
21
21
|
from .manager_client import FleetManagerClient, ManagerHealthResponse, TimestampResponse
|
|
22
22
|
|
|
23
|
-
__version__ = "0.1.
|
|
23
|
+
__version__ = "0.1.1"
|
|
24
24
|
__all__ = [
|
|
25
25
|
"env",
|
|
26
26
|
"FleetError",
|
|
@@ -6,25 +6,15 @@ from .factory import (
|
|
|
6
6
|
get,
|
|
7
7
|
list_instances,
|
|
8
8
|
list_envs,
|
|
9
|
-
|
|
10
|
-
list_categories,
|
|
11
|
-
list_names,
|
|
12
|
-
list_versions,
|
|
13
|
-
is_environment_supported,
|
|
14
|
-
EnvironmentInstance
|
|
9
|
+
InstanceInfo
|
|
15
10
|
)
|
|
16
11
|
|
|
17
12
|
__all__ = [
|
|
18
13
|
"Environment",
|
|
19
14
|
"EnvironmentConfig",
|
|
20
|
-
"
|
|
15
|
+
"InstanceInfo",
|
|
21
16
|
"make",
|
|
22
17
|
"get",
|
|
23
18
|
"list_instances",
|
|
24
19
|
"list_envs",
|
|
25
|
-
"list_environments",
|
|
26
|
-
"list_categories",
|
|
27
|
-
"list_names",
|
|
28
|
-
"list_versions",
|
|
29
|
-
"is_environment_supported",
|
|
30
20
|
]
|
|
@@ -101,6 +101,11 @@ class Environment(ABC):
|
|
|
101
101
|
"""Get the current step count."""
|
|
102
102
|
return self._step_count
|
|
103
103
|
|
|
104
|
+
@property
|
|
105
|
+
def env_key(self) -> Optional[str]:
|
|
106
|
+
"""Get the environment key."""
|
|
107
|
+
return getattr(self.config, 'environment_type', None)
|
|
108
|
+
|
|
104
109
|
def _increment_step(self) -> None:
|
|
105
110
|
"""Increment the step counter."""
|
|
106
111
|
self._step_count += 1
|
|
@@ -143,6 +148,34 @@ class RemoteEnvironment(Environment):
|
|
|
143
148
|
|
|
144
149
|
# Initialize manager client (will be set when instance URLs are available)
|
|
145
150
|
self._manager_client: Optional[FleetManagerClient] = None
|
|
151
|
+
|
|
152
|
+
@property
|
|
153
|
+
def env_key(self) -> Optional[str]:
|
|
154
|
+
"""Get the environment key from instance response or config."""
|
|
155
|
+
if self._instance_response:
|
|
156
|
+
return self._instance_response.env_key
|
|
157
|
+
return self.config.environment_type
|
|
158
|
+
|
|
159
|
+
@property
|
|
160
|
+
def region(self) -> Optional[str]:
|
|
161
|
+
"""Get the region from instance response."""
|
|
162
|
+
if self._instance_response:
|
|
163
|
+
return self._instance_response.region
|
|
164
|
+
return self.config.metadata.get('region')
|
|
165
|
+
|
|
166
|
+
@property
|
|
167
|
+
def status(self) -> Optional[str]:
|
|
168
|
+
"""Get the current instance status."""
|
|
169
|
+
if self._instance_response:
|
|
170
|
+
return self._instance_response.status
|
|
171
|
+
return None
|
|
172
|
+
|
|
173
|
+
@property
|
|
174
|
+
def subdomain(self) -> Optional[str]:
|
|
175
|
+
"""Get the instance subdomain."""
|
|
176
|
+
if self._instance_response:
|
|
177
|
+
return self._instance_response.subdomain
|
|
178
|
+
return None
|
|
146
179
|
|
|
147
180
|
async def reset(
|
|
148
181
|
self,
|
|
@@ -10,54 +10,12 @@ from ..config import get_config, FleetConfig
|
|
|
10
10
|
from ..client import FleetAPIClient, EnvDetails, InstanceRequest
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
"browser": {
|
|
16
|
-
"chrome-desktop": {
|
|
17
|
-
"v1": "web_browser",
|
|
18
|
-
"v2": "web_browser",
|
|
19
|
-
"latest": "v2"
|
|
20
|
-
},
|
|
21
|
-
"firefox-desktop": {
|
|
22
|
-
"v1": "web_browser",
|
|
23
|
-
"latest": "v1"
|
|
24
|
-
},
|
|
25
|
-
"safari-desktop": {
|
|
26
|
-
"v1": "web_browser",
|
|
27
|
-
"latest": "v1"
|
|
28
|
-
},
|
|
29
|
-
"chrome-mobile": {
|
|
30
|
-
"v1": "mobile_browser",
|
|
31
|
-
"latest": "v1"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"database": {
|
|
35
|
-
"postgres": {
|
|
36
|
-
"v1": "database",
|
|
37
|
-
"latest": "v1"
|
|
38
|
-
},
|
|
39
|
-
"mysql": {
|
|
40
|
-
"v1": "database",
|
|
41
|
-
"latest": "v1"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"file-system": {
|
|
45
|
-
"unix": {
|
|
46
|
-
"v1": "file_system",
|
|
47
|
-
"latest": "v1"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"api": {
|
|
51
|
-
"rest": {
|
|
52
|
-
"v1": "api",
|
|
53
|
-
"latest": "v1"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
13
|
+
# All environment information is now fetched via the Fleet API
|
|
14
|
+
# Use list_envs() to get available environments dynamically
|
|
57
15
|
|
|
58
16
|
|
|
59
|
-
class
|
|
60
|
-
"""
|
|
17
|
+
class InstanceInfo:
|
|
18
|
+
"""Metadata about a live environment instance."""
|
|
61
19
|
|
|
62
20
|
def __init__(
|
|
63
21
|
self,
|
|
@@ -73,6 +31,31 @@ class EnvironmentInstance:
|
|
|
73
31
|
self.created_at = created_at
|
|
74
32
|
self.metadata = metadata or {}
|
|
75
33
|
|
|
34
|
+
@property
|
|
35
|
+
def version(self) -> Optional[str]:
|
|
36
|
+
"""Get the environment version."""
|
|
37
|
+
return self.metadata.get("version")
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def region(self) -> Optional[str]:
|
|
41
|
+
"""Get the AWS region."""
|
|
42
|
+
return self.metadata.get("region")
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def team_id(self) -> Optional[str]:
|
|
46
|
+
"""Get the team ID."""
|
|
47
|
+
return self.metadata.get("team_id")
|
|
48
|
+
|
|
49
|
+
@property
|
|
50
|
+
def subdomain(self) -> str:
|
|
51
|
+
"""Get the subdomain for this instance."""
|
|
52
|
+
return f"{self.instance_id}.fleetai.com"
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def health(self) -> Optional[str]:
|
|
56
|
+
"""Get the health status."""
|
|
57
|
+
return self.metadata.get("health")
|
|
58
|
+
|
|
76
59
|
def to_dict(self) -> Dict[str, Any]:
|
|
77
60
|
"""Convert instance to dictionary representation."""
|
|
78
61
|
return {
|
|
@@ -245,7 +228,7 @@ async def list_instances(
|
|
|
245
228
|
status: Optional[str] = None,
|
|
246
229
|
env_key_filter: Optional[str] = None,
|
|
247
230
|
**kwargs: Any,
|
|
248
|
-
) -> List[
|
|
231
|
+
) -> List[InstanceInfo]:
|
|
249
232
|
"""Get a directory of all live environment instances.
|
|
250
233
|
|
|
251
234
|
Args:
|
|
@@ -253,8 +236,8 @@ async def list_instances(
|
|
|
253
236
|
env_key_filter: Filter by environment key (e.g., 'fira', 'dropbox')
|
|
254
237
|
**kwargs: Additional query parameters
|
|
255
238
|
|
|
256
|
-
|
|
257
|
-
List of
|
|
239
|
+
Returns:
|
|
240
|
+
List of InstanceInfo objects representing live instances
|
|
258
241
|
|
|
259
242
|
Raises:
|
|
260
243
|
FleetAuthenticationError: If API key is missing or invalid
|
|
@@ -282,7 +265,7 @@ async def list_instances(
|
|
|
282
265
|
if env_key_filter and instance.env_key != env_key_filter:
|
|
283
266
|
continue
|
|
284
267
|
|
|
285
|
-
env_instance =
|
|
268
|
+
env_instance = InstanceInfo(
|
|
286
269
|
instance_id=instance.instance_id,
|
|
287
270
|
env_key=instance.env_key,
|
|
288
271
|
status=instance.status,
|
|
@@ -331,100 +314,8 @@ async def list_envs(**kwargs: Any) -> List[EnvDetails]:
|
|
|
331
314
|
return environments
|
|
332
315
|
|
|
333
316
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
Returns:
|
|
338
|
-
List of environment specifications in format "category/name:version"
|
|
339
|
-
"""
|
|
340
|
-
env_specs = []
|
|
341
|
-
for category, names in ENVIRONMENT_REGISTRY.items():
|
|
342
|
-
for name, versions in names.items():
|
|
343
|
-
for version in versions.keys():
|
|
344
|
-
if version != "latest": # Don't include "latest" in the list
|
|
345
|
-
env_specs.append(f"{category}/{name}:{version}")
|
|
346
|
-
|
|
347
|
-
return sorted(env_specs)
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
def list_categories() -> List[str]:
|
|
351
|
-
"""List all available environment categories.
|
|
352
|
-
|
|
353
|
-
Returns:
|
|
354
|
-
List of category names
|
|
355
|
-
"""
|
|
356
|
-
return list(ENVIRONMENT_REGISTRY.keys())
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
def list_names(category: str) -> List[str]:
|
|
360
|
-
"""List all available environment names in a category.
|
|
361
|
-
|
|
362
|
-
Args:
|
|
363
|
-
category: Environment category
|
|
364
|
-
|
|
365
|
-
Returns:
|
|
366
|
-
List of environment names in the category
|
|
367
|
-
|
|
368
|
-
Raises:
|
|
369
|
-
FleetEnvironmentError: If category is not found
|
|
370
|
-
"""
|
|
371
|
-
if category not in ENVIRONMENT_REGISTRY:
|
|
372
|
-
available_categories = ", ".join(ENVIRONMENT_REGISTRY.keys())
|
|
373
|
-
raise FleetEnvironmentError(
|
|
374
|
-
f"Unknown environment category: {category}. "
|
|
375
|
-
f"Available categories: {available_categories}"
|
|
376
|
-
)
|
|
377
|
-
|
|
378
|
-
return list(ENVIRONMENT_REGISTRY[category].keys())
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
def list_versions(category: str, name: str) -> List[str]:
|
|
382
|
-
"""List all available versions for an environment.
|
|
383
|
-
|
|
384
|
-
Args:
|
|
385
|
-
category: Environment category
|
|
386
|
-
name: Environment name
|
|
387
|
-
|
|
388
|
-
Returns:
|
|
389
|
-
List of available versions (excluding "latest")
|
|
390
|
-
|
|
391
|
-
Raises:
|
|
392
|
-
FleetEnvironmentError: If category or name is not found
|
|
393
|
-
"""
|
|
394
|
-
if category not in ENVIRONMENT_REGISTRY:
|
|
395
|
-
available_categories = ", ".join(ENVIRONMENT_REGISTRY.keys())
|
|
396
|
-
raise FleetEnvironmentError(
|
|
397
|
-
f"Unknown environment category: {category}. "
|
|
398
|
-
f"Available categories: {available_categories}"
|
|
399
|
-
)
|
|
400
|
-
|
|
401
|
-
if name not in ENVIRONMENT_REGISTRY[category]:
|
|
402
|
-
available_names = ", ".join(ENVIRONMENT_REGISTRY[category].keys())
|
|
403
|
-
raise FleetEnvironmentError(
|
|
404
|
-
f"Unknown environment name: {name} in category {category}. "
|
|
405
|
-
f"Available names: {available_names}"
|
|
406
|
-
)
|
|
407
|
-
|
|
408
|
-
versions = [v for v in ENVIRONMENT_REGISTRY[category][name].keys() if v != "latest"]
|
|
409
|
-
return sorted(versions)
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
def is_environment_supported(environment_spec: str) -> bool:
|
|
413
|
-
"""Check if an environment specification is supported.
|
|
414
|
-
|
|
415
|
-
Args:
|
|
416
|
-
environment_spec: Environment specification to check
|
|
417
|
-
|
|
418
|
-
Returns:
|
|
419
|
-
True if the environment is supported, False otherwise
|
|
420
|
-
"""
|
|
421
|
-
try:
|
|
422
|
-
env_name, version = _parse_environment_spec(environment_spec)
|
|
423
|
-
# For now, we'll just check if we can parse it successfully
|
|
424
|
-
# In the future, we could validate against the API
|
|
425
|
-
return True
|
|
426
|
-
except FleetEnvironmentError:
|
|
427
|
-
return False
|
|
317
|
+
# Registry-based functions removed - use API-based list_envs() instead
|
|
318
|
+
# All environment information is now fetched dynamically from the Fleet API
|
|
428
319
|
|
|
429
320
|
|
|
430
321
|
async def _initialize_environment(env: Environment) -> None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|