diff --git a/fleet/__init__.py b/fleet/__init__.py index 9feeaf93..fc88e181 100644 --- a/fleet/__init__.py +++ b/fleet/__init__.py @@ -76,7 +76,7 @@ from . import global_client as _global_client from ._async import global_client as _async_global_client -__version__ = "0.2.125" +__version__ = "0.2.126" __all__ = [ # Core classes diff --git a/fleet/_async/__init__.py b/fleet/_async/__init__.py index bb8b7965..2f94672f 100644 --- a/fleet/_async/__init__.py +++ b/fleet/_async/__init__.py @@ -44,7 +44,7 @@ from .. import env from . import global_client as _async_global_client -__version__ = "0.2.125" +__version__ = "0.2.126" __all__ = [ # Core classes diff --git a/fleet/_async/base.py b/fleet/_async/base.py index 0b400208..67daae84 100644 --- a/fleet/_async/base.py +++ b/fleet/_async/base.py @@ -26,7 +26,7 @@ try: from .. import __version__ except ImportError: - __version__ = "0.2.125" + __version__ = "0.2.126" logger = logging.getLogger(__name__) diff --git a/fleet/_async/client.py b/fleet/_async/client.py index 5e140b90..6a07f3e6 100644 --- a/fleet/_async/client.py +++ b/fleet/_async/client.py @@ -601,7 +601,9 @@ async def make( ) instance = AsyncEnv(client=self.client, **response.json()) - await instance.instance.load() + # Resources are loaded lazily on first `db()`/`browser()`/`resources()` access + # via `_load_resources()`, so we don't preload here. Eagerly loading would + # fail-fast with a 502 while the container is still warming up. return instance async def make_for_task(self, task: Task) -> AsyncEnv: @@ -653,7 +655,7 @@ async def instance(self, instance_id: Union[str, Dict[str, str]]) -> AsyncEnv: else: response = await self.client.request("GET", f"/v1/env/instances/{instance_id}") instance = AsyncEnv(client=self.client, **response.json()) - await instance.instance.load() + # Resources load lazily on first `db()`/`browser()`/`resources()` access. return instance def _create_url_instance(self, base_url: str) -> AsyncEnv: diff --git a/fleet/_async/models.py b/fleet/_async/models.py index 2159b932..35aec741 100644 --- a/fleet/_async/models.py +++ b/fleet/_async/models.py @@ -51,6 +51,7 @@ class Instance(BaseModel): team_id: str = Field(..., title="Team Id") region: str = Field(..., title="Region") env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables") + multi_env_list: Optional[List[str]] = Field(None, title="Multi Env List") class InstanceRequest(BaseModel): @@ -357,6 +358,7 @@ class InstanceResponse(BaseModel): data_version: Optional[str] = Field(None, title="Data Version") urls: Optional[InstanceURLs] = Field(None, title="Urls") health: Optional[bool] = Field(None, title="Health") + multi_env_list: Optional[List[str]] = Field(None, title="Multi Env List") class AccountResponse(BaseModel): diff --git a/fleet/base.py b/fleet/base.py index 919bce37..0cf7afbb 100644 --- a/fleet/base.py +++ b/fleet/base.py @@ -27,7 +27,7 @@ try: from . import __version__ except ImportError: - __version__ = "0.2.125" + __version__ = "0.2.126" logger = logging.getLogger(__name__) diff --git a/fleet/client.py b/fleet/client.py index 276d1b93..1db3e748 100644 --- a/fleet/client.py +++ b/fleet/client.py @@ -613,7 +613,9 @@ def make( ) instance = SyncEnv(client=self.client, **response.json()) - instance.instance.load() + # Resources load lazily on first `db()`/`browser()`/`resources()` access via + # `_load_resources()`. Skipping the eager preload avoids fail-fast 502s while + # the container is still warming up. return instance def make_for_task(self, task: Task) -> SyncEnv: @@ -665,7 +667,7 @@ def instance(self, instance_id: Union[str, Dict[str, str]]) -> SyncEnv: else: response = self.client.request("GET", f"/v1/env/instances/{instance_id}") instance = SyncEnv(client=self.client, **response.json()) - instance.instance.load() + # Resources load lazily on first `db()`/`browser()`/`resources()` access. return instance def _create_url_instance(self, base_url: str) -> SyncEnv: diff --git a/fleet/models.py b/fleet/models.py index 30439f33..ccf5a0a5 100644 --- a/fleet/models.py +++ b/fleet/models.py @@ -52,6 +52,7 @@ class Instance(BaseModel): region: str = Field(..., title="Region") env_variables: Optional[Dict[str, Any]] = Field(None, title="Env Variables") run_id: Optional[str] = Field(None, title="Run Id") + multi_env_list: Optional[List[str]] = Field(None, title="Multi Env List") class InstanceRequest(BaseModel): @@ -369,6 +370,7 @@ class InstanceResponse(BaseModel): profile_id: Optional[str] = Field(None, title="Profile Id") heartbeat_interval: Optional[int] = Field(None, title="Heartbeat Interval") heartbeat_region: Optional[str] = Field(None, title="Heartbeat Region") + multi_env_list: Optional[List[str]] = Field(None, title="Multi Env List") class Run(BaseModel): diff --git a/pyproject.toml b/pyproject.toml index 34d1c4ac..91b9d1e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "fleet-python" -version = "0.2.125" +version = "0.2.126" description = "Python SDK for Fleet environments" authors = [ {name = "Fleet AI", email = "nic@fleet.so"}, diff --git a/uv.lock b/uv.lock index 2490bcbb..a9e234b3 100644 --- a/uv.lock +++ b/uv.lock @@ -661,7 +661,7 @@ wheels = [ [[package]] name = "fleet-python" -version = "0.2.125" +version = "0.2.126" source = { editable = "." } dependencies = [ { name = "aiohttp" },